gruffy 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cbef84a86f64a21574531f304f31c9896ce1550
4
- data.tar.gz: a0c8e948744c9fde3abe593c453cd3df5c3bb13a
3
+ metadata.gz: 5b71279c627c87a1c9b0fc388ffcff8f1692aa21
4
+ data.tar.gz: de75567a792366e27fd4bd731905aee354ed36c7
5
5
  SHA512:
6
- metadata.gz: cfe3b768e081e0cdd16a2dbf8fac1d45044f25d6799c449ab6899dacc0e32ddf4f1deb2c17305cf0ec6762ceb483f0cddc64c14d4e360a46f8736259b0ec75e5
7
- data.tar.gz: 8008eb94ee54f28f2e2a9cf47ec92c8935321bc0a10dd1009b44dae6e6a96dc2f8d7be76327327a50e25b24c39dca5492030cde4b87b84779f9ee8ec39666176
6
+ metadata.gz: 501a0f2033e592833667a342496f22a86507d7f963612c4e997d37f7c82498e1176da4890e8a491966832f454eadd0379b377d02e0f0d682d548f60b366800a5
7
+ data.tar.gz: af27bb4eb68837bd656e8867e32bb558a68cbe4d3591cecf17744788293d3f8e0d4ec7b7eca91387e259762d8d76abd86d0b3039f6b293fd97f2827a8744c097
@@ -211,7 +211,7 @@ module Gruffy
211
211
  attr_accessor :label_rotation
212
212
 
213
213
  # Background height of picture and ignoring content
214
- attr_accessor :background_height
214
+ attr_accessor :background_label_height
215
215
 
216
216
  # With Side Bars use the data label for the marker value to the left of the bar
217
217
  # Default is false
@@ -250,7 +250,7 @@ module Gruffy
250
250
  # Internal for calculations
251
251
  @raw_columns = 800.0
252
252
  @raw_rows = 800.0 * (@rows/@columns)
253
- @background_height = 0
253
+ @background_label_height = 0
254
254
  @column_count = 0
255
255
  @data = Array.new
256
256
  @marker_count = nil
@@ -867,10 +867,7 @@ module Gruffy
867
867
  end
868
868
  end
869
869
 
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
-
870
+ y_offset += ((label_text.size - different_size) * 4) + 10 unless @label_rotation.nil?
874
871
  if x_offset >= @graph_left && x_offset <= @graph_right
875
872
  @d.rotation = (@label_rotation.to_i * (-1)) unless @label_rotation.nil?
876
873
  @d.fill = @font_color
@@ -940,7 +937,8 @@ module Gruffy
940
937
 
941
938
  # Make a new image at the current size with a solid +color+.
942
939
  def render_solid_background(color)
943
- @rows += (@background_height * 7) unless @label_rotation.nil?
940
+ @background_label_height = @labels.values.sort_by {|v| v.size }.last.size if @background_label_height == 0
941
+ @rows += (@background_label_height * 7) unless @label_rotation.nil?
944
942
  Image.new(@columns, @rows) {
945
943
  self.background_color = color
946
944
  }
@@ -963,7 +961,8 @@ module Gruffy
963
961
  gradient_fill = GradientFill.new(0, 0, 100, 0, top_color, bottom_color)
964
962
  end
965
963
 
966
- @rows += (@background_height * 7) unless @label_rotation.nil?
964
+ @background_label_height = @labels.values.sort_by {|v| v.size }.last.size if @background_label_height == 0
965
+ @rows += (@background_label_height * 7) unless @label_rotation.nil?
967
966
  Image.new(@columns, @rows, gradient_fill)
968
967
  end
969
968
 
@@ -978,7 +977,8 @@ module Gruffy
978
977
 
979
978
  # Use with a theme to make a transparent background
980
979
  def render_transparent_background
981
- @rows += (@background_height * 7) unless @label_rotation.nil?
980
+ @background_label_height = @labels.values.sort_by {|v| v.size }.last.size if @background_label_height == 0
981
+ @rows += (@background_label_height * 7) unless @label_rotation.nil?
982
982
  Image.new(@columns, @rows) do
983
983
  self.background_color = 'transparent'
984
984
  end
@@ -1,3 +1,3 @@
1
1
  module Gruffy
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wuttikrai Limsakul