Class: Writexlsx::Chart::Series
- Inherits:
-
Object
- Object
- Writexlsx::Chart::Series
- 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.
-
#gradient ⇒ Object
readonly
Returns the value of attribute gradient.
-
#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 Gradient
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, #process_workbook_options, #ptrue?, #put_deprecate_message, #quote_sheetname, #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.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/write_xlsx/chart/series.rb', line 178 def initialize(chart, params = {}) @chart = chart @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(params) @line = line_properties(params[:border] || params[:line]) @fill = fill_properties(params[:fill]) @gradient = gradient_properties(params[:gradient]) @fill = nil if ptrue?(@gradient) @marker = Marker.new(params[:marker]) if params[:marker] @trendline = Trendline.new(params[:trendline]) if params[:trendline] = (params[:x_error_bars], params[:y_error_bars]) @points = params[:points].collect { |p| p ? Point.new(p) : p } if params[:points] @label_positions = chart.label_positions @label_position_default = chart.label_position_default @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.
173 174 175 |
# File 'lib/write_xlsx/chart/series.rb', line 173 def cat_data_id @cat_data_id end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
172 173 174 |
# File 'lib/write_xlsx/chart/series.rb', line 172 def categories @categories end |
#error_bars ⇒ Object (readonly)
Returns the value of attribute error_bars.
175 176 177 |
# File 'lib/write_xlsx/chart/series.rb', line 175 def end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
173 174 175 |
# File 'lib/write_xlsx/chart/series.rb', line 173 def fill @fill end |
#gradient ⇒ Object (readonly)
Returns the value of attribute gradient.
173 174 175 |
# File 'lib/write_xlsx/chart/series.rb', line 173 def gradient @gradient end |
#invert_if_negative ⇒ Object (readonly)
Returns the value of attribute invert_if_negative.
174 175 176 |
# File 'lib/write_xlsx/chart/series.rb', line 174 def invert_if_negative @invert_if_negative end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
174 175 176 |
# File 'lib/write_xlsx/chart/series.rb', line 174 def labels @labels end |
#line ⇒ Object
Returns the value of attribute line.
176 177 178 |
# File 'lib/write_xlsx/chart/series.rb', line 176 def line @line end |
#marker ⇒ Object
Returns the value of attribute marker.
176 177 178 |
# File 'lib/write_xlsx/chart/series.rb', line 176 def marker @marker end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
172 173 174 |
# File 'lib/write_xlsx/chart/series.rb', line 172 def name @name end |
#name_formula ⇒ Object (readonly)
Returns the value of attribute name_formula.
172 173 174 |
# File 'lib/write_xlsx/chart/series.rb', line 172 def name_formula @name_formula end |
#name_id ⇒ Object (readonly)
Returns the value of attribute name_id.
172 173 174 |
# File 'lib/write_xlsx/chart/series.rb', line 172 def name_id @name_id end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
175 176 177 |
# File 'lib/write_xlsx/chart/series.rb', line 175 def points @points end |
#smooth ⇒ Object (readonly)
Returns the value of attribute smooth.
174 175 176 |
# File 'lib/write_xlsx/chart/series.rb', line 174 def smooth @smooth end |
#trendline ⇒ Object (readonly)
Returns the value of attribute trendline.
174 175 176 |
# File 'lib/write_xlsx/chart/series.rb', line 174 def trendline @trendline end |
#val_data_id ⇒ Object (readonly)
Returns the value of attribute val_data_id.
173 174 175 |
# File 'lib/write_xlsx/chart/series.rb', line 173 def val_data_id @val_data_id end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
172 173 174 |
# File 'lib/write_xlsx/chart/series.rb', line 172 def values @values end |
#x2_axis ⇒ Object (readonly)
Returns the value of attribute x2_axis.
175 176 177 |
# File 'lib/write_xlsx/chart/series.rb', line 175 def x2_axis @x2_axis end |
#y2_axis ⇒ Object (readonly)
Returns the value of attribute y2_axis.
175 176 177 |
# File 'lib/write_xlsx/chart/series.rb', line 175 def y2_axis @y2_axis end |
Instance Method Details
#==(other) ⇒ Object
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/write_xlsx/chart/series.rb', line 206 def ==(other) methods = %w[categories values name name_formula name_id cat_data_id val_data_id line fill gradient 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
217 218 219 |
# File 'lib/write_xlsx/chart/series.rb', line 217 def line_defined? line && ptrue?(line[:_defined]) end |