Method: Writexlsx::ChartArea#initialize

Defined in:
lib/write_xlsx/chart.rb

#initialize(params = {}) ⇒ ChartArea

Returns a new instance of ChartArea.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/write_xlsx/chart.rb', line 57

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