Class: Daytona::Charts::CompositeChart

Inherits:
Chart
  • Object
show all
Defined in:
lib/daytona/common/charts.rb

Instance Attribute Summary collapse

Attributes inherited from Chart

#png, #title, #type

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CompositeChart

Returns a new instance of CompositeChart.

Parameters:

  • data (Hash<Symbol, Object>)


277
278
279
280
281
# File 'lib/daytona/common/charts.rb', line 277

def initialize(data)
  super
  @type = ChartType::COMPOSITE_CHART
  @elements = data.fetch(:elements, []).map { |e| Charts.parse(e) }
end

Instance Attribute Details

#elementsArray<Daytona::Charts::Chart> (readonly)

Returns The charts of the composite chart.

Returns:



274
275
276
# File 'lib/daytona/common/charts.rb', line 274

def elements
  @elements
end

Instance Method Details

#to_hObject



283
# File 'lib/daytona/common/charts.rb', line 283

def to_h = super.merge(elements: elements.map(&:to_h))