gruffy 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 716b97c9641a4da2d335447930cadc9c8e655252
4
- data.tar.gz: dc994d5a2024ed911ebdd7bf18aea516b09e34c3
3
+ metadata.gz: 63f477231d82e41b3c6c22d654d880329ed45e21
4
+ data.tar.gz: e548d23c404fb6a1b273b3f59d17c54424dcbaed
5
5
  SHA512:
6
- metadata.gz: a588d6a47f33e8b8eb1e9e48ab87d474840ef99aecaf36c621db24183ef99b86ea420393621d0955b7cfa0b51e905d54ee3dd88ee3a650bdf6fd02b8b36c59d5
7
- data.tar.gz: 42746e19694e9fabd5bfda934d38fee76847224cec2686cdd7aef73c4eaa01a2fbee27defd383735a787d99984268737eecdff827ddc9c11a108570637e27ee4
6
+ metadata.gz: 9d656ffbce7aefbe43fd307619182047a64a492da1902e8e32a849a7db44c5c2a847b622be5d2698640167d97bf11c12dbd9b69381948ff07a2dee4953a94b83
7
+ data.tar.gz: df1cec0423bd25b4952cf0abd7d47a8509957c731085dc9f13bebaf5f31ab9bedec4e7379d06a5f4f22a44c8e36495700226d9d3911d6155db23fb882009486c
@@ -210,6 +210,8 @@ module Gruffy
210
210
  # Default 0
211
211
  attr_accessor :label_rotation
212
212
 
213
+ # Position of label Y axis
214
+ # Default 0
213
215
  attr_accessor :label_y_axis
214
216
 
215
217
  # Background height of picture and ignoring content
@@ -2,18 +2,12 @@ require File.dirname(__FILE__) + '/base'
2
2
  require File.dirname(__FILE__) + '/side_bar'
3
3
  require File.dirname(__FILE__) + '/stacked_mixin'
4
4
 
5
- ##
6
- # New gruffy graph type added to enable sideways stacking bar charts
7
- # (basically looks like a x/y flip of a standard stacking bar chart)
8
- #
9
- # alun.eyre@googlemail.com
10
-
11
5
  class Gruffy::SideStackedBar < Gruffy::SideBar
12
6
  include StackedMixin
13
7
 
14
8
  # Spacing factor applied between bars
15
9
  attr_accessor :bar_spacing
16
-
10
+
17
11
  def draw
18
12
  @has_left_labels = true
19
13
  get_maximum_by_stack
@@ -42,10 +36,8 @@ class Gruffy::SideStackedBar < Gruffy::SideBar
42
36
 
43
37
  ## using the original calcs from the stacked bar chart to get the difference between
44
38
  ## part of the bart chart we wish to stack.
45
- temp1 = @graph_left + (@graph_width -
46
- data_point * @graph_width -
47
- height[point_index]) + 1
48
- temp2 = @graph_left + @graph_width - height[point_index] - 1
39
+ temp1 = @graph_left + (@graph_width - data_point * @graph_width - height[point_index])
40
+ temp2 = @graph_left + @graph_width - height[point_index]
49
41
  difference = temp2 - temp1
50
42
 
51
43
  @d = @d.fill data_row[DATA_COLOR_INDEX]
@@ -56,12 +48,12 @@ class Gruffy::SideStackedBar < Gruffy::SideBar
56
48
  right_y = left_y + @bar_width * @bar_spacing
57
49
  length[point_index] += difference
58
50
  height[point_index] += (data_point * @graph_width - 2)
59
-
51
+
60
52
  if @show_labels_for_bar_values
61
53
  label_values[point_index][:value] += @norm_data[row_index][3][point_index]
62
54
  label_values[point_index][:right_x] = right_x
63
55
  end
64
-
56
+
65
57
  # if a data point is 0 it can result in weird really thing lines
66
58
  # that shouldn't even be there being drawn on top of the existing
67
59
  # bar - this is bad
@@ -82,8 +74,8 @@ class Gruffy::SideStackedBar < Gruffy::SideBar
82
74
  draw_value_label(data[:right_x]+40, (@graph_top + (((i+1) * @bar_width) - (@bar_width / 2)))-12, val.commify, true)
83
75
  end
84
76
  end
85
-
86
- @d.draw(@base_image)
77
+
78
+ @d.draw(@base_image)
87
79
  end
88
80
 
89
81
  def larger_than_max?(data_point, index=0)
@@ -1,3 +1,3 @@
1
1
  module Gruffy
2
- VERSION = '1.0.4'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wuttikrai Limsakul