Object
Original Author: David Stokar
This class perfoms the y coordinats conversion for the bar class. There are three cases: 1. Bars all go from zero in positive direction 2. Bars all go from zero to negative direction 3. Bars either go from zero to positive or from zero to negative
# File lib/gruff/bar_conversion.rb, line 20 20: def getLeftYRightYscaled( data_point, result ) 21: case @mode 22: when 1 then # Case one 23: # minimum value >= 0 ( only positiv values ) 24: result[0] = @graph_top + @graph_height*(1 - data_point) + 1 25: result[1] = @graph_top + @graph_height - 1 26: when 2 then # Case two 27: # only negativ values 28: result[0] = @graph_top + 1 29: result[1] = @graph_top + @graph_height*(1 - data_point) - 1 30: when 3 then # Case three 31: # positiv and negativ values 32: val = data_point-@minimum_value/@spread 33: if ( data_point >= @zero ) then 34: result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1 35: result[1] = @graph_top + @graph_height*(1 - @zero) - 1 36: else 37: result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1 38: result[1] = @graph_top + @graph_height*(1 - @zero) - 1 39: end 40: else 41: result[0] = 0.0 42: result[1] = 0.0 43: end 44: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.