Class: Ccharts::Settings::BarSettings
- Inherits:
-
Object
- Object
- Ccharts::Settings::BarSettings
- Defined in:
- lib/ccharts/settings.rb
Overview
bar
Instance Method Summary collapse
- #background(v) ⇒ Object
-
#initialize ⇒ BarSettings
constructor
A new instance of BarSettings.
- #plain(v) ⇒ Object
- #rise(v) ⇒ Object
- #show_labels(v) ⇒ Object
- #show_prices(v) ⇒ Object
- #to_ffi ⇒ Object
Constructor Details
#initialize ⇒ BarSettings
Returns a new instance of BarSettings.
182 183 184 185 186 187 188 |
# File 'lib/ccharts/settings.rb', line 182 def initialize @rise = nil @bg = nil @show_labels = false @show_prices = false @plain = false end |
Instance Method Details
#background(v) ⇒ Object
191 |
# File 'lib/ccharts/settings.rb', line 191 def background(v); @bg = v; self; end |
#plain(v) ⇒ Object
194 |
# File 'lib/ccharts/settings.rb', line 194 def plain(v); @plain = !!v; self; end |
#rise(v) ⇒ Object
190 |
# File 'lib/ccharts/settings.rb', line 190 def rise(v); @rise = v; self; end |
#show_labels(v) ⇒ Object
192 |
# File 'lib/ccharts/settings.rb', line 192 def show_labels(v); @show_labels = !!v; self; end |
#show_prices(v) ⇒ Object
193 |
# File 'lib/ccharts/settings.rb', line 193 def show_prices(v); @show_prices = !!v; self; end |
#to_ffi ⇒ Object
196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/ccharts/settings.rb', line 196 def to_ffi s = FFI::BarSettings.malloc keep = [] set = lambda do |field, val| p = FFI.color_ptr(val, @plain) keep << p s[field] = p.to_i end set.call(:rise_color, @rise) set.call(:bg_color, @bg) s[:show_labels] = @show_labels ? 1 : 0 s[:show_prices] = @show_prices ? 1 : 0 [s, keep] end |