lib/gruff/base.rb
# Draws horizontal background lines and labels
Draws horizontal background lines and labels
Draws horizontal background lines and labels
def draw_line_markers
      return if @hide_line_markers
      increment_scaled = @graph_height.to_f / (@spread / @increment)
      (0..marker_count).each do |index|
        y = @graph_top + @graph_height - index.to_f * increment_scaled
        line_renderer = Gruff::Renderer::Line.new(renderer, color: @marker_color, shadow_color: @marker_shadow_color)
        line_renderer.render(@graph_left, y, @graph_right, y)
        unless @hide_line_numbers
          marker_label = BigDecimal(index.to_s) * BigDecimal(@increment.to_s) + BigDecimal(minimum_value.to_s)
          label = y_axis_label(marker_label, @increment)
          text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
          text_renderer.add_to_render_queue(@graph_left - LABEL_MARGIN, 1.0, 0.0, y, Magick::EastGravity)
        end
      end
    end
def draw_line_markers return if @hide_line_markers increment_scaled = @graph_height . to_f / ( @spread / @increment ) ( 0 .. marker_count ) . each do | index | y = @graph_top + @graph_height - index . to_f * increment_scaled line_renderer = Gruff :: Renderer :: Line . new ( renderer , color : @marker_color , shadow_color : @marker_shadow_color ) line_renderer . render ( @graph_left , y , @graph_right , y ) unless @hide_line_numbers marker_label = BigDecimal ( index . to_s ) * BigDecimal ( @increment . to_s ) + BigDecimal ( minimum_value . to_s ) label = y_axis_label ( marker_label , @increment ) text_renderer = Gruff :: Renderer :: Text . new ( renderer , label , font : @marker_font ) text_renderer . add_to_render_queue ( @graph_left - LABEL_MARGIN , 1.0 , 0.0 , y , Magick :: EastGravity ) end end end
Draws horizontal background lines and labels
Draws horizontal background lines and labels
# Draw horizontal line markers and annotate with numbers