Class: Ccharts::Settings::SparkSettings
- Inherits:
-
Object
- Object
- Ccharts::Settings::SparkSettings
- Defined in:
- lib/ccharts/settings.rb
Overview
sparkline
Instance Method Summary collapse
- #area(v) ⇒ Object
-
#initialize ⇒ SparkSettings
constructor
A new instance of SparkSettings.
- #min_above(v) ⇒ Object
- #min_below(v) ⇒ Object
- #plain(v) ⇒ Object
- #rise(v) ⇒ Object
- #to_ffi ⇒ Object
Constructor Details
#initialize ⇒ SparkSettings
Returns a new instance of SparkSettings.
150 151 152 153 154 155 156 |
# File 'lib/ccharts/settings.rb', line 150 def initialize @rise = nil @area = nil @min_above = 0 @min_below = 0 @plain = false end |
Instance Method Details
#area(v) ⇒ Object
159 |
# File 'lib/ccharts/settings.rb', line 159 def area(v); @area = v; self; end |
#min_above(v) ⇒ Object
160 |
# File 'lib/ccharts/settings.rb', line 160 def min_above(v); @min_above = v; self; end |
#min_below(v) ⇒ Object
161 |
# File 'lib/ccharts/settings.rb', line 161 def min_below(v); @min_below = v; self; end |
#plain(v) ⇒ Object
162 |
# File 'lib/ccharts/settings.rb', line 162 def plain(v); @plain = !!v; self; end |
#rise(v) ⇒ Object
158 |
# File 'lib/ccharts/settings.rb', line 158 def rise(v); @rise = v; self; end |
#to_ffi ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/ccharts/settings.rb', line 164 def to_ffi s = FFI::SparkSettings.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) s[:min_above] = @min_above s[:min_below] = @min_below [s, keep] end |