Class: Ccharts::Settings::BoxSettings
- Inherits:
-
Object
- Object
- Ccharts::Settings::BoxSettings
- Defined in:
- lib/ccharts/settings.rb
Overview
box plot
Instance Method Summary collapse
- #area(v) ⇒ Object
- #background(v) ⇒ Object
-
#initialize ⇒ BoxSettings
constructor
A new instance of BoxSettings.
- #plain(v) ⇒ Object
- #rise(v) ⇒ Object
- #show_prices(v) ⇒ Object
- #to_ffi ⇒ Object
Constructor Details
#initialize ⇒ BoxSettings
Returns a new instance of BoxSettings.
335 336 337 338 339 340 341 |
# File 'lib/ccharts/settings.rb', line 335 def initialize @rise = nil @area = nil @bg = nil @show_prices = false @plain = false end |
Instance Method Details
#area(v) ⇒ Object
344 |
# File 'lib/ccharts/settings.rb', line 344 def area(v); @area = v; self; end |
#background(v) ⇒ Object
345 |
# File 'lib/ccharts/settings.rb', line 345 def background(v); @bg = v; self; end |
#plain(v) ⇒ Object
347 |
# File 'lib/ccharts/settings.rb', line 347 def plain(v); @plain = !!v; self; end |
#rise(v) ⇒ Object
343 |
# File 'lib/ccharts/settings.rb', line 343 def rise(v); @rise = v; self; end |
#show_prices(v) ⇒ Object
346 |
# File 'lib/ccharts/settings.rb', line 346 def show_prices(v); @show_prices = !!v; self; end |
#to_ffi ⇒ Object
349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/ccharts/settings.rb', line 349 def to_ffi s = FFI::BoxSettings.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(:area_color, @area) set.call(:bg_color, @bg) s[:show_prices] = @show_prices ? 1 : 0 [s, keep] end |