gruffy 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gruffy/base.rb +11 -4
- data/lib/gruffy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1cbef84a86f64a21574531f304f31c9896ce1550
|
|
4
|
+
data.tar.gz: a0c8e948744c9fde3abe593c453cd3df5c3bb13a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfe3b768e081e0cdd16a2dbf8fac1d45044f25d6799c449ab6899dacc0e32ddf4f1deb2c17305cf0ec6762ceb483f0cddc64c14d4e360a46f8736259b0ec75e5
|
|
7
|
+
data.tar.gz: 8008eb94ee54f28f2e2a9cf47ec92c8935321bc0a10dd1009b44dae6e6a96dc2f8d7be76327327a50e25b24c39dca5492030cde4b87b84779f9ee8ec39666176
|
data/lib/gruffy/base.rb
CHANGED
|
@@ -210,6 +210,9 @@ module Gruffy
|
|
|
210
210
|
# Default 0
|
|
211
211
|
attr_accessor :label_rotation
|
|
212
212
|
|
|
213
|
+
# Background height of picture and ignoring content
|
|
214
|
+
attr_accessor :background_height
|
|
215
|
+
|
|
213
216
|
# With Side Bars use the data label for the marker value to the left of the bar
|
|
214
217
|
# Default is false
|
|
215
218
|
attr_accessor :use_data_label
|
|
@@ -247,6 +250,7 @@ module Gruffy
|
|
|
247
250
|
# Internal for calculations
|
|
248
251
|
@raw_columns = 800.0
|
|
249
252
|
@raw_rows = 800.0 * (@rows/@columns)
|
|
253
|
+
@background_height = 0
|
|
250
254
|
@column_count = 0
|
|
251
255
|
@data = Array.new
|
|
252
256
|
@marker_count = nil
|
|
@@ -863,7 +867,10 @@ module Gruffy
|
|
|
863
867
|
end
|
|
864
868
|
end
|
|
865
869
|
|
|
866
|
-
|
|
870
|
+
label_size = (label_text.size - different_size)
|
|
871
|
+
y_offset += (label_size * 4) + 10 unless @label_rotation.nil?
|
|
872
|
+
@background_height = label_size if @background_height < label_size
|
|
873
|
+
|
|
867
874
|
if x_offset >= @graph_left && x_offset <= @graph_right
|
|
868
875
|
@d.rotation = (@label_rotation.to_i * (-1)) unless @label_rotation.nil?
|
|
869
876
|
@d.fill = @font_color
|
|
@@ -933,7 +940,7 @@ module Gruffy
|
|
|
933
940
|
|
|
934
941
|
# Make a new image at the current size with a solid +color+.
|
|
935
942
|
def render_solid_background(color)
|
|
936
|
-
@rows += (
|
|
943
|
+
@rows += (@background_height * 7) unless @label_rotation.nil?
|
|
937
944
|
Image.new(@columns, @rows) {
|
|
938
945
|
self.background_color = color
|
|
939
946
|
}
|
|
@@ -956,7 +963,7 @@ module Gruffy
|
|
|
956
963
|
gradient_fill = GradientFill.new(0, 0, 100, 0, top_color, bottom_color)
|
|
957
964
|
end
|
|
958
965
|
|
|
959
|
-
@rows += (
|
|
966
|
+
@rows += (@background_height * 7) unless @label_rotation.nil?
|
|
960
967
|
Image.new(@columns, @rows, gradient_fill)
|
|
961
968
|
end
|
|
962
969
|
|
|
@@ -971,7 +978,7 @@ module Gruffy
|
|
|
971
978
|
|
|
972
979
|
# Use with a theme to make a transparent background
|
|
973
980
|
def render_transparent_background
|
|
974
|
-
@rows += (
|
|
981
|
+
@rows += (@background_height * 7) unless @label_rotation.nil?
|
|
975
982
|
Image.new(@columns, @rows) do
|
|
976
983
|
self.background_color = 'transparent'
|
|
977
984
|
end
|
data/lib/gruffy/version.rb
CHANGED