class ActiveCharts::RectangularChart
Constants
- TOP_LEFT_OFFSET
Attributes
grid_height[R]
grid_width[R]
svg_height[R]
svg_width[R]
Public Class Methods
new(collection, options = {})
click to toggle source
Calls superclass method
ActiveCharts::Chart::new
# File lib/active_charts/rectangular_chart.rb, line 5 def initialize(collection, options = {}) super prereq_calcs values = values_calcs width_calcs(values.map(&width_filter)) height_calcs(values.map(&height_filter)) end
Public Instance Methods
grid_rect_tag()
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 18 def grid_rect_tag tag.rect( x: TOP_LEFT_OFFSET, y: TOP_LEFT_OFFSET, height: grid_height - TOP_LEFT_OFFSET * 2, width: grid_width - TOP_LEFT_OFFSET * 2, class: 'grid' ) end
Private Instance Methods
height_calcs(_values)
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 53 def height_calcs(_values); end
height_filter()
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 47 def height_filter :last end
prereq_calcs()
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 37 def prereq_calcs; end
process_options(options)
click to toggle source
Calls superclass method
ActiveCharts::Chart#process_options
# File lib/active_charts/rectangular_chart.rb, line 30 def process_options(options) super @grid_width = @svg_width = options[:width] || MARGIN * 30 @grid_height = @svg_height = options[:height] || MARGIN * 20 end
tick_line_tag(x1, x2, y1, y2)
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 60 def tick_line_tag(x1, x2, y1, y2) %(<line #{tag_options(x1: x1, x2: x2, y1: y1, y2: y2)} class="ac-grid-line" />) end
ticks(vertical_ticks, horizontal_ticks)
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 55 def ticks(vertical_ticks, horizontal_ticks) (vertical_ticks.map { |x| tick_line_tag(x, x, TOP_LEFT_OFFSET, grid_height - TOP_LEFT_OFFSET) } + horizontal_ticks.map { |y| tick_line_tag(TOP_LEFT_OFFSET, grid_width - TOP_LEFT_OFFSET, y, y) }) end
values_calcs()
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 39 def values_calcs [] end
width_calcs(_values)
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 51 def width_calcs(_values); end
width_filter()
click to toggle source
# File lib/active_charts/rectangular_chart.rb, line 43 def width_filter :first end