lib/gruffy/base.rb in gruffy-1.0.1 vs lib/gruffy/base.rb in gruffy-1.0.2

- old
+ new

@@ -208,10 +208,12 @@ # Set label rotation # Default 0 attr_accessor :label_rotation + attr_accessor :label_y_axis + # Background height of picture and ignoring content attr_accessor :background_label_height # With Side Bars use the data label for the marker value to the left of the bar # Default is false @@ -249,10 +251,11 @@ def initialize_ivars # Internal for calculations @raw_columns = 800.0 @raw_rows = 800.0 * (@rows/@columns) @background_label_height = 0 + @label_y_axis = 0 @column_count = 0 @data = Array.new @marker_count = nil @maximum_value = @minimum_value = nil @has_data = false @@ -865,11 +868,11 @@ else # @label_truncation_style is :absolute (default) label_text = label_text[0 .. (@label_max_size - 1)] end end - y_offset += ((label_text.size - different_size) * 4) + 10 unless @label_rotation.nil? + y_offset += ((label_text.size - different_size) * 4) + 10 + @label_y_axis unless @label_rotation.nil? if x_offset >= @graph_left && x_offset <= @graph_right @d.rotation = (@label_rotation.to_i * (-1)) unless @label_rotation.nil? @d.fill = @font_color @d.font = @font if @font @d.stroke('transparent') @@ -935,11 +938,11 @@ end end # Make a new image at the current size with a solid +color+. def render_solid_background(color) - @rows += (@background_label_height * 7) unless @label_rotation.nil? + @rows += (@background_label_height * 7) Image.new(@columns, @rows) { self.background_color = color } end @@ -958,11 +961,11 @@ gradient_fill = GradientFill.new(0, 0, 100, 100, bottom_color, top_color) else gradient_fill = GradientFill.new(0, 0, 100, 0, top_color, bottom_color) end - @rows += (@background_label_height * 7) unless @label_rotation.nil? + @rows += (@background_label_height * 7) Image.new(@columns, @rows, gradient_fill) end # Use with a theme to use an image (800x600 original) background. def render_image_background(image_path) @@ -973,10 +976,10 @@ image[0] end # Use with a theme to make a transparent background def render_transparent_background - @rows += (@background_label_height * 7) unless @label_rotation.nil? + @rows += (@background_label_height * 7) Image.new(@columns, @rows) do self.background_color = 'transparent' end end