Class: Writexlsx::Chart::Chartline

Inherits:
Object
  • Object
show all
Includes:
Gradient, Utility::ChartFormatting, Utility::Common, Utility::RichText
Defined in:
lib/write_xlsx/chart/series.rb

Direct Known Subclasses

Gridline, Marker, Point, Trendline

Constant Summary

Constants included from Utility::ChartFormatting

Utility::ChartFormatting::PATTERN_TYPES

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gradient

#gradient_properties

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::Common

#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message

Constructor Details

#initialize(params) ⇒ Chartline

Returns a new instance of Chartline.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/write_xlsx/chart/series.rb', line 21

def initialize(params)
  @line      = params[:line]
  @fill      = params[:fill]
  @pattern   = params[:pattern]
  @gradient  = params[:gradient]
  # Set the line properties for the marker..
  @line = line_properties(@line)
  # Allow 'border' as a synonym for 'line'.
  @line = line_properties(params[:border]) if params[:border]
  # Set the fill properties for the marker.
  @fill = fill_properties(@fill)
  # Set the pattern properties for the series.
  @pattern = pattern_properties(@pattern)
  # Set the gradient fill properties for the series.
  @gradient = gradient_properties(@gradient)
  # Pattern fill overrides solid fill.
  @fill = nil if ptrue?(@gradient)
  # Gradient fill overrides solid and pattern fills.
  if ptrue?(@gradient)
    @pattern = nil
    @fill    = nil
  end
end

Instance Attribute Details

#fill ⇒ Object (readonly)

Returns the value of attribute fill.



19
20
21
# File 'lib/write_xlsx/chart/series.rb', line 19

def fill
  @fill
end

#gradient ⇒ Object (readonly)

Returns the value of attribute gradient.



19
20
21
# File 'lib/write_xlsx/chart/series.rb', line 19

def gradient
  @gradient
end

#line ⇒ Object (readonly)

Returns the value of attribute line.



19
20
21
# File 'lib/write_xlsx/chart/series.rb', line 19

def line
  @line
end

#pattern ⇒ Object (readonly)

Returns the value of attribute pattern.



19
20
21
# File 'lib/write_xlsx/chart/series.rb', line 19

def pattern
  @pattern
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



19
20
21
# File 'lib/write_xlsx/chart/series.rb', line 19

def type
  @type
end

Instance Method Details

#fill_defined? ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/write_xlsx/chart/series.rb', line 49

def fill_defined?
  fill && ptrue?(fill[:_defined])
end

#line_defined? ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/write_xlsx/chart/series.rb', line 45

def line_defined?
  line && ptrue?(line[:_defined])
end