Class: ChartCandy::Builder::Counter
- Defined in:
- lib/chart-candy/builder/counter.rb
Instance Method Summary collapse
- #add_primary(id, value) ⇒ Object
-
#initialize(id, options = {}) ⇒ Counter
constructor
A new instance of Counter.
Methods inherited from Base
#close_chart, #filename, #id, #l, #period, #set_period_from_data, #t, #title, #to_json, #to_xls
Constructor Details
#initialize(id, options = {}) ⇒ Counter
Returns a new instance of Counter.
3 4 5 6 7 |
# File 'lib/chart-candy/builder/counter.rb', line 3 def initialize(id, ={}) super @chart.merge! nature: 'count', data: [] end |
Instance Method Details
#add_primary(id, value) ⇒ Object
9 10 11 |
# File 'lib/chart-candy/builder/counter.rb', line 9 def add_primary(id, value) @chart[:data] << { nature: :primary, label: t("data.#{id}.label"), id: id, value: value } end |