Class: Daytona::Charts::BarChart
- Defined in:
- lib/daytona/common/charts.rb
Instance Attribute Summary collapse
-
#elements ⇒ Array<Daytona::Charts::BarData>
readonly
The bars of the chart.
Attributes inherited from Chart2D
Attributes inherited from Chart
Instance Method Summary collapse
-
#initialize(data) ⇒ BarChart
constructor
A new instance of BarChart.
- #to_h ⇒ Hash<Symbol, Object>
Constructor Details
#initialize(data) ⇒ BarChart
170 171 172 173 174 |
# File 'lib/daytona/common/charts.rb', line 170 def initialize(data) super @type = ChartType::BAR @elements = data.fetch(:elements, []).map { |e| BarData.new(e) } end |
Instance Attribute Details
#elements ⇒ Array<Daytona::Charts::BarData> (readonly)
167 168 169 |
# File 'lib/daytona/common/charts.rb', line 167 def elements @elements end |
Instance Method Details
#to_h ⇒ Hash<Symbol, Object>
177 |
# File 'lib/daytona/common/charts.rb', line 177 def to_h = super.merge(elements: elements.map(&:to_h)) |