lib/gruff/side_bar.rb
# Instead of base class version, draws vertical background lines and label
Instead of base class version, draws vertical background lines and label
Instead of base class version draws vertical background lines and label
def draw_line_markers
    return if @hide_line_markers
    number_of_lines = marker_count
    number_of_lines = 1 if number_of_lines == 0
    increment = significant(@spread.to_f / number_of_lines)
    (0..number_of_lines).each do |index|
      line_diff = (@graph_right - @graph_left) / number_of_lines
      x = @graph_right - (line_diff * index) - 1
      line_renderer = Gruff::Renderer::Line.new(renderer, color: @marker_color, shadow_color: @marker_shadow_color)
      line_renderer.render(x, @graph_bottom, x, @graph_top)
      unless @hide_line_numbers
        diff = index - number_of_lines
        marker_label = BigDecimal(diff.abs.to_s) * BigDecimal(increment.to_s) + BigDecimal(minimum_value.to_s)
        label = x_axis_label(marker_label, @increment)
        text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
        text_renderer.add_to_render_queue(0, 0, x, @graph_bottom + LABEL_MARGIN, Magick::CenterGravity)
      end
    end
  end
def draw_line_markers return if @hide_line_markers number_of_lines = marker_count number_of_lines = 1 if number_of_lines == 0 increment = significant ( @spread . to_f / number_of_lines ) ( 0 .. number_of_lines ) . each do | index | line_diff = ( @graph_right - @graph_left ) / number_of_lines x = @graph_right - ( line_diff * index ) - 1 line_renderer = Gruff :: Renderer :: Line . new ( renderer , color : @marker_color , shadow_color : @marker_shadow_color ) line_renderer . render ( x , @graph_bottom , x , @graph_top ) unless @hide_line_numbers diff = index - number_of_lines marker_label = BigDecimal ( diff . abs . to_s ) * BigDecimal ( increment . to_s ) + BigDecimal ( minimum_value . to_s ) label = x_axis_label ( marker_label , @increment ) text_renderer = Gruff :: Renderer :: Text . new ( renderer , label , font : @marker_font ) text_renderer . add_to_render_queue ( 0 , 0 , x , @graph_bottom + LABEL_MARGIN , Magick :: CenterGravity ) end end end
Instead of base class version, draws vertical background lines and label
Instead of base class version draws vertical background lines and label
# Draw horizontal line markers and annotate with numbers # TODO: Round maximum marker value to a round number like 100, 0.1, 0.5, etc.