class RubyvisCharts::LineTimelineChart

Constants

LONG_MONTH_DAYS
LONG_MONTH_PADDING

Attributes

lines_colors[R]

Public Class Methods

new( lines_colors: DefaultArguments::LINES_COLORS, **other ) click to toggle source
# File lib/rubyvis_charts/line_timeline_chart.rb, line 12
def initialize(
  lines_colors: DefaultArguments::LINES_COLORS,
  **other
)
  super(other)
  @lines_colors = lines_colors
  initialize_lines!
end

Private Instance Methods

initialize_lines!() click to toggle source
# File lib/rubyvis_charts/line_timeline_chart.rb, line 23
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