Sha256: d4201fd2b72a28b2ba7a1f0f70b070ac98125286dc97f53fee577157c09cf73b

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

module Prawn
  module Graph
    module Charts
      module Legacy
        class Line < Prawn::Graph::Charts::Legacy::Base

          private
          
          def plot_values
            base_x = @grid.start_x + 1
            base_y = @grid.start_y + 1
            p = [ [base_x, base_y] ]
            bar_width = calculate_bar_width
            @document.line_width bar_width
            last_position = base_x + bar_width
            point_spacing = calculate_plot_spacing
            @values.each do |value|
              @document.move_to [base_x + last_position, base_y]
              bar_height = calculate_point_height_from value
              point = [base_x + last_position, base_y + bar_height]
              p << point
              @document.fill_color @theme.series.last
              @document.fill_circle_at point, :radius => 1
              last_position += point_spacing
            end
            @document.line_width 2
            @document.stroke_color @theme.series.last
            p.each_with_index do |point,i|
              next if point == p.last
              @document.move_to point
              @document.stroke_line_to p[i+1]
            end
          end

        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
prawn-graph-0.9.10 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.9 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.7 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.6 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.5 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.4 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.3 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.2 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.1 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-0.9.0 lib/prawn/graph/charts/legacy/line.rb
prawn-graph-1.0.0.pre1 lib/prawn/graph/charts/legacy/line.rb