Class: Writexlsx::Chart::Series
- Inherits:
-
Object
- Object
- Writexlsx::Chart::Series
- Includes:
- Utility
- Defined in:
- lib/write_xlsx/chart/series.rb
Constant Summary
Constants included from Utility
Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX
Instance Attribute Summary collapse
-
#cat_data_id ⇒ Object
readonly
Returns the value of attribute cat_data_id.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#error_bars ⇒ Object
readonly
Returns the value of attribute error_bars.
-
#fill ⇒ Object
readonly
Returns the value of attribute fill.
-
#invert_if_negative ⇒ Object
readonly
Returns the value of attribute invert_if_negative.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#line ⇒ Object
Returns the value of attribute line.
-
#marker ⇒ Object
Returns the value of attribute marker.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#name_formula ⇒ Object
readonly
Returns the value of attribute name_formula.
-
#name_id ⇒ Object
readonly
Returns the value of attribute name_id.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#smooth ⇒ Object
readonly
Returns the value of attribute smooth.
-
#trendline ⇒ Object
readonly
Returns the value of attribute trendline.
-
#val_data_id ⇒ Object
readonly
Returns the value of attribute val_data_id.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
-
#x2_axis ⇒ Object
readonly
Returns the value of attribute x2_axis.
-
#y2_axis ⇒ Object
readonly
Returns the value of attribute y2_axis.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(chart, params = {}) ⇒ Series
constructor
A new instance of Series.
- #line_defined? ⇒ Boolean
Methods included from Utility
#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #convert_date_time, #dash_types, delete_files, #fill_properties, #float_to_str, #layout_properties, #line_fill_properties, #line_properties, #palette_color, #pixels_to_points, #ptrue?, #put_deprecate_message, #r_id_attributes, #row_col_notation, #shape_style_base, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #v_shape_attributes_base, #v_shape_style_base, #value_or_raise, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_div, #write_fill, #write_font, #write_stroke, #write_xml_declaration, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str
Constructor Details
#initialize(chart, params = {}) ⇒ Series
Returns a new instance of Series.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/write_xlsx/chart/series.rb', line 170 def initialize(chart, params = {}) @values = aref_to_formula(params[:values]) @categories = aref_to_formula(params[:categories]) @name, @name_formula = chart.process_names(params[:name], params[:name_formula]) set_data_ids(chart, params) @line = line_properties(params[:border] || params[:line]) @fill = fill_properties(params[:fill]) @marker = Marker.new(params[:marker]) if params[:marker] @trendline = Trendline.new(params[:trendline]) if params[:trendline] @error_bars = (params[:x_error_bars], params[:y_error_bars]) @points = params[:points].collect { |p| p ? Point.new(p) : p } if params[:points] @labels = labels_properties(params[:data_labels]) [:smooth, :invert_if_negative, :x2_axis, :y2_axis]. each { |key| instance_variable_set("@#{key}", params[key]) } end |
Instance Attribute Details
#cat_data_id ⇒ Object (readonly)
Returns the value of attribute cat_data_id.
165 166 167 |
# File 'lib/write_xlsx/chart/series.rb', line 165 def cat_data_id @cat_data_id end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
164 165 166 |
# File 'lib/write_xlsx/chart/series.rb', line 164 def categories @categories end |
#error_bars ⇒ Object (readonly)
Returns the value of attribute error_bars.
167 168 169 |
# File 'lib/write_xlsx/chart/series.rb', line 167 def @error_bars end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
165 166 167 |
# File 'lib/write_xlsx/chart/series.rb', line 165 def fill @fill end |
#invert_if_negative ⇒ Object (readonly)
Returns the value of attribute invert_if_negative.
166 167 168 |
# File 'lib/write_xlsx/chart/series.rb', line 166 def invert_if_negative @invert_if_negative end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
166 167 168 |
# File 'lib/write_xlsx/chart/series.rb', line 166 def labels @labels end |
#line ⇒ Object
Returns the value of attribute line.
168 169 170 |
# File 'lib/write_xlsx/chart/series.rb', line 168 def line @line end |
#marker ⇒ Object
Returns the value of attribute marker.
168 169 170 |
# File 'lib/write_xlsx/chart/series.rb', line 168 def marker @marker end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
164 165 166 |
# File 'lib/write_xlsx/chart/series.rb', line 164 def name @name end |
#name_formula ⇒ Object (readonly)
Returns the value of attribute name_formula.
164 165 166 |
# File 'lib/write_xlsx/chart/series.rb', line 164 def name_formula @name_formula end |
#name_id ⇒ Object (readonly)
Returns the value of attribute name_id.
164 165 166 |
# File 'lib/write_xlsx/chart/series.rb', line 164 def name_id @name_id end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
167 168 169 |
# File 'lib/write_xlsx/chart/series.rb', line 167 def points @points end |
#smooth ⇒ Object (readonly)
Returns the value of attribute smooth.
166 167 168 |
# File 'lib/write_xlsx/chart/series.rb', line 166 def smooth @smooth end |
#trendline ⇒ Object (readonly)
Returns the value of attribute trendline.
166 167 168 |
# File 'lib/write_xlsx/chart/series.rb', line 166 def trendline @trendline end |
#val_data_id ⇒ Object (readonly)
Returns the value of attribute val_data_id.
165 166 167 |
# File 'lib/write_xlsx/chart/series.rb', line 165 def val_data_id @val_data_id end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
164 165 166 |
# File 'lib/write_xlsx/chart/series.rb', line 164 def values @values end |
#x2_axis ⇒ Object (readonly)
Returns the value of attribute x2_axis.
167 168 169 |
# File 'lib/write_xlsx/chart/series.rb', line 167 def x2_axis @x2_axis end |
#y2_axis ⇒ Object (readonly)
Returns the value of attribute y2_axis.
167 168 169 |
# File 'lib/write_xlsx/chart/series.rb', line 167 def y2_axis @y2_axis end |
Instance Method Details
#==(other) ⇒ Object
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/write_xlsx/chart/series.rb', line 191 def ==(other) methods = %w[categories values name name_formula name_id cat_data_id val_data_id line fill marker trendline smooth labels invert_if_neg x2_axis y2_axis error_bars points ] methods.each do |method| return false unless self.instance_variable_get("@#{method}") == other.instance_variable_get("@#{method}") end true end |
#line_defined? ⇒ Boolean
202 203 204 |
# File 'lib/write_xlsx/chart/series.rb', line 202 def line_defined? line && ptrue?(line[:_defined]) end |