Class: Writexlsx::Chart::ChartArea

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

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::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 = {}) ⇒ ChartArea

Returns a new instance of ChartArea.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/write_xlsx/chart/chart_area.rb', line 13

def initialize(params = {})
  @layout = layout_properties(params[:layout])

  # Allow 'border' as a synonym for 'line'.
  border = params_to_border(params)

  # Set the line properties for the chartarea.
  @line = line_properties(border || params[:line])

  # Set the pattern properties for the series.
  @pattern = pattern_properties(params[:pattern])

  # Set the gradient fill properties for the series.
  @gradient = gradient_properties(params[:gradient])

  # Map deprecated Spreadsheet::WriteExcel fill colour.
  fill = params[:color] ? { color: params[:color] } : params[:fill]
  @fill = fill_properties(fill)

  # Pattern fill overrides solid fill.
  @fill = nil if ptrue?(@pattern)

  # Gradient fill overrides solid and pattern fills.
  if ptrue?(@gradient)
    @pattern = nil
    @fill    = nil
  end
end

Instance Attribute Details

#fillObject (readonly)

Returns the value of attribute fill.



11
12
13
# File 'lib/write_xlsx/chart/chart_area.rb', line 11

def fill
  @fill
end

#gradientObject (readonly)

Returns the value of attribute gradient.



11
12
13
# File 'lib/write_xlsx/chart/chart_area.rb', line 11

def gradient
  @gradient
end

#layoutObject (readonly)

Returns the value of attribute layout.



11
12
13
# File 'lib/write_xlsx/chart/chart_area.rb', line 11

def layout
  @layout
end

#lineObject (readonly)

Returns the value of attribute line.



11
12
13
# File 'lib/write_xlsx/chart/chart_area.rb', line 11

def line
  @line
end

#patternObject (readonly)

Returns the value of attribute pattern.



11
12
13
# File 'lib/write_xlsx/chart/chart_area.rb', line 11

def pattern
  @pattern
end