Sha256: d29b66818ea5285035bb6d2382edfba4af4b59e7f4800f9cab02f542422e3652
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
module RubyvisCharts class LineTimelineChart < AbstractTimelineChart module DefaultArguments LINES_COLORS = %w[#4d79da #31d49e].freeze end LONG_MONTH_PADDING = 20 LONG_MONTH_DAYS = 31 attr_reader :lines_colors def initialize( lines_colors: DefaultArguments::LINES_COLORS, **other ) super(**other) @lines_colors = lines_colors initialize_lines! end private def initialize_lines! chart = self area_left_offset = -> { chart.send(:graph_width).scale(self.index) + chart.send(:graph_width).scale(1)/2 } height = ->(d) { chart.send(:bars_heights).scale(d) } values.each_with_index do |line_data, index| @layer_timeline.add(Rubyvis::Line) .data(line_data) .left(area_left_offset) .bottom(height) .lineWidth(1) .strokeStyle(lines_colors[index]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyvis_charts-0.1.6 | lib/rubyvis_charts/line_timeline_chart.rb |