Class: Scruffy::Layers::SparklineBar
- Defined in:
- lib/scruffy/layers/sparkline_bar.rb
Overview
Experimental, do not use.
Instance Attribute Summary
Attributes inherited from Base
#color, #complexity, #height, #max_value, #min_value, #opacity, #options, #points, #preferred_color, #relevant_data, #title, #width
Instance Method Summary collapse
Methods inherited from Base
#bottom_value, #initialize, #legend_data, #relevant_data?, #render, #sum_values, #top_value
Constructor Details
This class inherits a constructor from Scruffy::Layers::Base
Instance Method Details
#draw(svg, coords, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/scruffy/layers/sparkline_bar.rb', line 6 def draw(svg, coords, = {}) zero_point = @height / 2.0 coords.each do |coord| x, y, = (coord.first-(@bar_width * 0.5)), coord.last, (height - coord.last) = (y > zero_point) ? 'black' : 'red' = ( - zero_point) #y = (bar_height < 0) ? # svg.rect( :x => x, :y => zero_point, :width => @bar_width, :height => , # :fill => bar_color, :stroke => 'none', 'style' => "opacity: #{opacity}" ) end end |