Class: Writexlsx::Chart::Series
- Inherits:
-
Object
- Object
- Writexlsx::Chart::Series
- Includes:
- Gradient, Utility::CellReference, Utility::ChartFormatting, Utility::Common, Utility::RichText, Utility::SheetnameQuoting
- Defined in:
- lib/write_xlsx/chart/series.rb
Constant Summary
Constants included from Utility::ChartFormatting
Utility::ChartFormatting::PATTERN_TYPES
Constants included from Writexlsx::Constants
Writexlsx::Constants::COL_MAX, Writexlsx::Constants::ROW_MAX, Writexlsx::Constants::SHEETNAME_MAX, Writexlsx::Constants::STR_MAX
Constants included from Utility::Common
Utility::Common::PERL_TRUE_VALUES
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.
-
#inverted_color ⇒ Object
readonly
Returns the value of attribute inverted_color.
-
#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.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#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::SheetnameQuoting
Methods included from Utility::RichText
#convert_font_args, #get_font_latin_attributes, #get_font_style_attributes, #params_to_font, #underline_attributes, #write_a_body_pr, #write_a_def_rpr, #write_a_end_para_rpr, #write_a_lst_style, #write_a_p_formula, #write_a_p_pr_formula, #write_def_rpr_r_pr_common, #write_tx_pr
Methods included from Utility::ChartFormatting
#color, #dash_types, #fill_properties, #layout_properties, #legend_properties, #line_fill_properties, #line_properties, #palette_color_from_index, #pattern_properties, #value_or_raise, #write_a_solid_fill, #write_a_srgb_clr
Methods included from Utility::CellReference
#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell
Methods included from Utility::Common
#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message
Constructor Details
#initialize(chart, params = {}) ⇒ Series
Returns a new instance of Series.
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/write_xlsx/chart/series.rb', line 247 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]) @pattern = pattern_properties(params[:pattern]) @gradient = gradient_properties(params[:gradient]) # Pattern fill overrides solid fill. @fill = nil if ptrue?(@pattern) # Gradient fill overrides solid and patter fills. if ptrue?(@gradient) @pattern = nil @fill = nil end # Set the marker properties for the series. @marker = Marker.new(params[:marker]) if params[:marker] # Set the trendline properties for the series. @trendline = Trendline.new(params[:trendline]) if params[:trendline] @error_bars = (params[:x_error_bars], params[:y_error_bars]) if params[:points] @points = params[:points].collect { |p| p ? Point.new(p) : p } end @label_positions = chart.label_positions @label_position_default = chart.label_position_default @labels = labels_properties(params[:data_labels]) @inverted_color = params[:invert_if_negative_color] %i[ 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.
241 242 243 |
# File 'lib/write_xlsx/chart/series.rb', line 241 def cat_data_id @cat_data_id end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
240 241 242 |
# File 'lib/write_xlsx/chart/series.rb', line 240 def categories @categories end |
#error_bars ⇒ Object (readonly)
Returns the value of attribute error_bars.
244 245 246 |
# File 'lib/write_xlsx/chart/series.rb', line 244 def @error_bars end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
241 242 243 |
# File 'lib/write_xlsx/chart/series.rb', line 241 def fill @fill end |
#gradient ⇒ Object (readonly)
Returns the value of attribute gradient.
241 242 243 |
# File 'lib/write_xlsx/chart/series.rb', line 241 def gradient @gradient end |
#invert_if_negative ⇒ Object (readonly)
Returns the value of attribute invert_if_negative.
242 243 244 |
# File 'lib/write_xlsx/chart/series.rb', line 242 def invert_if_negative @invert_if_negative end |
#inverted_color ⇒ Object (readonly)
Returns the value of attribute inverted_color.
243 244 245 |
# File 'lib/write_xlsx/chart/series.rb', line 243 def inverted_color @inverted_color end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
242 243 244 |
# File 'lib/write_xlsx/chart/series.rb', line 242 def labels @labels end |
#line ⇒ Object
Returns the value of attribute line.
245 246 247 |
# File 'lib/write_xlsx/chart/series.rb', line 245 def line @line end |
#marker ⇒ Object
Returns the value of attribute marker.
245 246 247 |
# File 'lib/write_xlsx/chart/series.rb', line 245 def marker @marker end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
240 241 242 |
# File 'lib/write_xlsx/chart/series.rb', line 240 def name @name end |
#name_formula ⇒ Object (readonly)
Returns the value of attribute name_formula.
240 241 242 |
# File 'lib/write_xlsx/chart/series.rb', line 240 def name_formula @name_formula end |
#name_id ⇒ Object (readonly)
Returns the value of attribute name_id.
240 241 242 |
# File 'lib/write_xlsx/chart/series.rb', line 240 def name_id @name_id end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
241 242 243 |
# File 'lib/write_xlsx/chart/series.rb', line 241 def pattern @pattern end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
244 245 246 |
# File 'lib/write_xlsx/chart/series.rb', line 244 def points @points end |
#smooth ⇒ Object (readonly)
Returns the value of attribute smooth.
242 243 244 |
# File 'lib/write_xlsx/chart/series.rb', line 242 def smooth @smooth end |
#trendline ⇒ Object (readonly)
Returns the value of attribute trendline.
242 243 244 |
# File 'lib/write_xlsx/chart/series.rb', line 242 def trendline @trendline end |
#val_data_id ⇒ Object (readonly)
Returns the value of attribute val_data_id.
241 242 243 |
# File 'lib/write_xlsx/chart/series.rb', line 241 def val_data_id @val_data_id end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
240 241 242 |
# File 'lib/write_xlsx/chart/series.rb', line 240 def values @values end |
#x2_axis ⇒ Object (readonly)
Returns the value of attribute x2_axis.
244 245 246 |
# File 'lib/write_xlsx/chart/series.rb', line 244 def x2_axis @x2_axis end |
#y2_axis ⇒ Object (readonly)
Returns the value of attribute y2_axis.
244 245 246 |
# File 'lib/write_xlsx/chart/series.rb', line 244 def y2_axis @y2_axis end |
Instance Method Details
#==(other) ⇒ Object
287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/write_xlsx/chart/series.rb', line 287 def ==(other) methods = %w[ categories values name name_formula name_id cat_data_id val_data_id line fill gradient marker trendline smooth labels inverted_color x2_axis y2_axis error_bars points ] methods.each do |method| return false unless instance_variable_get("@#{method}") == other.instance_variable_get("@#{method}") end true end |
#line_defined? ⇒ Boolean
301 302 303 |
# File 'lib/write_xlsx/chart/series.rb', line 301 def line_defined? line && ptrue?(line[:_defined]) end |