gruffy 0.1.0 → 0.1.1

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: 4a2e0aba18f99a0d0ad130505bf71d8024eadc91
4
- data.tar.gz: 004531b5e248e45eeaa3a445d7c21a13a3b3e179
3
+ metadata.gz: 1cbef84a86f64a21574531f304f31c9896ce1550
4
+ data.tar.gz: a0c8e948744c9fde3abe593c453cd3df5c3bb13a
5
5
  SHA512:
6
- metadata.gz: 3fa05615c1af2e5e7eaac57e93ef02d7685bf0d84fd148bb6fe373e959a031cd4a01ce60d0e6d3187d0bf43415e011669f8579b3621d48bf68e2d6f6bbdc5699
7
- data.tar.gz: 2511f546e04460ffdbc8bf9aa1e654b4eab8d3ce7861f78eca26c027e50d51561d44d1791d1e17f502403771a7358426c5b2d7313524711fc4d9858c0ad0141e
6
+ metadata.gz: cfe3b768e081e0cdd16a2dbf8fac1d45044f25d6799c449ab6899dacc0e32ddf4f1deb2c17305cf0ec6762ceb483f0cddc64c14d4e360a46f8736259b0ec75e5
7
+ data.tar.gz: 8008eb94ee54f28f2e2a9cf47ec92c8935321bc0a10dd1009b44dae6e6a96dc2f8d7be76327327a50e25b24c39dca5492030cde4b87b84779f9ee8ec39666176
@@ -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
- y_offset += ((label_text.size - different_size) * 4) + 10 unless @label_rotation.nil?
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 += ((@rows * 20) / 100) unless @label_rotation.nil?
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 += ((@rows * 20) / 100) unless @label_rotation.nil?
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 += ((@rows * 20) / 100) unless @label_rotation.nil?
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
@@ -1,3 +1,3 @@
1
1
  module Gruffy
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
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: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wuttikrai Limsakul