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::CHAR_WIDTHS, Utility::COL_MAX, Utility::DEFAULT_COL_PIXELS, Utility::MAX_DIGIT_WIDTH, Utility::PADDING, Utility::PERL_TRUE_VALUES, 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.
-
#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
#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #color, #convert_date_time, #convert_font_args, #dash_types, delete_files, #escape_url, #fill_properties, #float_to_str, #get_font_latin_attributes, #get_font_style_attributes, #layout_properties, #legend_properties, #line_fill_properties, #line_properties, #palette_color_from_index, #params_to_font, #pattern_properties, #pixels_to_points, #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_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_a_solid_fill, #write_a_srgb_clr, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_def_rpr_r_pr_common, #write_div, #write_fill, #write_font, #write_stroke, #write_tx_pr, #write_xml_declaration, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xl_string_pixel_width, #xml_str
Constructor Details
#initialize(chart, params = {}) ⇒ Series
Returns a new instance of Series.
236 237 238 239 240 241 242 243 244 245 246 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 |
# File 'lib/write_xlsx/chart/series.rb', line 236 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.
230 231 232 |
# File 'lib/write_xlsx/chart/series.rb', line 230 def cat_data_id @cat_data_id end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
229 230 231 |
# File 'lib/write_xlsx/chart/series.rb', line 229 def categories @categories end |
#error_bars ⇒ Object (readonly)
Returns the value of attribute error_bars.
233 234 235 |
# File 'lib/write_xlsx/chart/series.rb', line 233 def @error_bars end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
230 231 232 |
# File 'lib/write_xlsx/chart/series.rb', line 230 def fill @fill end |
#gradient ⇒ Object (readonly)
Returns the value of attribute gradient.
230 231 232 |
# File 'lib/write_xlsx/chart/series.rb', line 230 def gradient @gradient end |
#invert_if_negative ⇒ Object (readonly)
Returns the value of attribute invert_if_negative.
231 232 233 |
# File 'lib/write_xlsx/chart/series.rb', line 231 def invert_if_negative @invert_if_negative end |
#inverted_color ⇒ Object (readonly)
Returns the value of attribute inverted_color.
232 233 234 |
# File 'lib/write_xlsx/chart/series.rb', line 232 def inverted_color @inverted_color end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
231 232 233 |
# File 'lib/write_xlsx/chart/series.rb', line 231 def labels @labels end |
#line ⇒ Object
Returns the value of attribute line.
234 235 236 |
# File 'lib/write_xlsx/chart/series.rb', line 234 def line @line end |
#marker ⇒ Object
Returns the value of attribute marker.
234 235 236 |
# File 'lib/write_xlsx/chart/series.rb', line 234 def marker @marker end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
229 230 231 |
# File 'lib/write_xlsx/chart/series.rb', line 229 def name @name end |
#name_formula ⇒ Object (readonly)
Returns the value of attribute name_formula.
229 230 231 |
# File 'lib/write_xlsx/chart/series.rb', line 229 def name_formula @name_formula end |
#name_id ⇒ Object (readonly)
Returns the value of attribute name_id.
229 230 231 |
# File 'lib/write_xlsx/chart/series.rb', line 229 def name_id @name_id end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
230 231 232 |
# File 'lib/write_xlsx/chart/series.rb', line 230 def pattern @pattern end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
233 234 235 |
# File 'lib/write_xlsx/chart/series.rb', line 233 def points @points end |
#smooth ⇒ Object (readonly)
Returns the value of attribute smooth.
231 232 233 |
# File 'lib/write_xlsx/chart/series.rb', line 231 def smooth @smooth end |
#trendline ⇒ Object (readonly)
Returns the value of attribute trendline.
231 232 233 |
# File 'lib/write_xlsx/chart/series.rb', line 231 def trendline @trendline end |
#val_data_id ⇒ Object (readonly)
Returns the value of attribute val_data_id.
230 231 232 |
# File 'lib/write_xlsx/chart/series.rb', line 230 def val_data_id @val_data_id end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
229 230 231 |
# File 'lib/write_xlsx/chart/series.rb', line 229 def values @values end |
#x2_axis ⇒ Object (readonly)
Returns the value of attribute x2_axis.
233 234 235 |
# File 'lib/write_xlsx/chart/series.rb', line 233 def x2_axis @x2_axis end |
#y2_axis ⇒ Object (readonly)
Returns the value of attribute y2_axis.
233 234 235 |
# File 'lib/write_xlsx/chart/series.rb', line 233 def y2_axis @y2_axis end |
Instance Method Details
#==(other) ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/write_xlsx/chart/series.rb', line 276 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
290 291 292 |
# File 'lib/write_xlsx/chart/series.rb', line 290 def line_defined? line && ptrue?(line[:_defined]) end |