prawn-graph 1.0.0.pre1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +0,0 @@
1
- module Prawn
2
- module Graph
3
- module Charts
4
- module Legacy
5
-
6
- class Grid
7
-
8
- attr_accessor :width, :height, :point, :spacing, :document
9
-
10
- def initialize(grid_x_start, grid_y_start, grid_width, grid_height, spacing, document, theme = Prawn::Graph::Theme::Default)
11
- @point = [grid_x_start, grid_y_start]
12
- @width = grid_width
13
- @height = grid_height
14
- @spacing = spacing
15
- @document = document
16
- @theme = Prawn::Graph::Theme::Default
17
- end
18
-
19
- def start_x; @point.first; end
20
- def start_y; @point.last; end
21
-
22
- # Draws the Grid on the specified Prawn::Document
23
- #
24
- def draw
25
- @document.stroke_color @theme.markers
26
- if @theme.stroke_grid_markers
27
- (@height / @spacing).times do |x|
28
- offset = @spacing * (x + 1)
29
- @document.move_to [@point.first, (@point.last + offset)]
30
- @document.line_width(0.5)
31
- @document.stroke_line_to([(@point.first + @width), (@point.last + offset)])
32
- end
33
- end
34
- @document.move_to @point
35
- @document.line_width(2)
36
- @document.stroke_line_to([@point.first, @point.last + @height])
37
- @document.move_to @point
38
- @document.line_width(2)
39
- @document.stroke_line_to([(@point.first + @width), @point.last])
40
- @document.move_to @point.first, (@point.last + height)
41
- @document.stroke_color '000000'
42
- @document.line_width(1)
43
- @document.move_to @point
44
- end
45
-
46
- end
47
-
48
- end
49
- end
50
- end
51
- end
@@ -1,39 +0,0 @@
1
- module Prawn
2
- module Graph
3
- module Charts
4
- module Legacy
5
- class Line < Prawn::Graph::Charts::Legacy::Base
6
-
7
- private
8
-
9
- def plot_values
10
- base_x = @grid.start_x + 1
11
- base_y = @grid.start_y + 1
12
- p = [ [base_x, base_y] ]
13
- bar_width = calculate_bar_width
14
- @document.line_width bar_width
15
- last_position = base_x + bar_width
16
- point_spacing = calculate_plot_spacing
17
- @values.each do |value|
18
- @document.move_to [base_x + last_position, base_y]
19
- bar_height = calculate_point_height_from value
20
- point = [base_x + last_position, base_y + bar_height]
21
- p << point
22
- @document.fill_color @theme.series.last
23
- @document.fill_circle_at point, :radius => 1
24
- last_position += point_spacing
25
- end
26
- @document.line_width 2
27
- @document.stroke_color @theme.series.last
28
- p.each_with_index do |point,i|
29
- next if point == p.last
30
- @document.move_to point
31
- @document.stroke_line_to p[i+1]
32
- end
33
- end
34
-
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,18 +0,0 @@
1
- module Prawn
2
- module Graph
3
- module Charts
4
- class Line < Base
5
-
6
- private
7
-
8
- def chart_object
9
- Prawn::Graph::Charts::Legacy::Line.new(@series.collect(&:to_a), @prawn, @options)
10
- end
11
-
12
- def series_type
13
- :line
14
- end
15
- end
16
- end
17
- end
18
- end