lib/gruff/ldata_mixin.rb
# Same as data, but you can defined groups of lines.
# The lines points will be x centered on the bar corresponding to
# the group.
Same as data, but you can defined groups of lines.
The lines points will be x centered on the bar corresponding to
the group.
Same as data but you can defined groups of lines . The lines points will be x centered on the bar corresponding to the group .
def ldata(name, data_points=[], attrs={})
    attrs[:color] = increment_color if(attrs[:color].nil? or 
                                       attrs[:color] == 'auto')
    attrs[:group] = 0 if attrs[:group].nil?
    attrs[:line_width] = 5.0 if attrs[:line_width].nil?
    attrs[:dot_width] = 0.01 if attrs[:dot_width].nil?
    ldata_points = Array(data_points)
    @ldata << [name, ldata_points, attrs[:color], attrs]
    ldata_points.each_with_index do |data_point, index|
      next if data_point.nil?
      if @maximum_value.nil? && @minimum_value.nil?
        @maximum_value = @minimum_value = data_point
      end
      @maximum_value = larger_than_max?(data_point) ? data_point : @maximum_value
      @has_ldata = true if @maximum_value > 0
      @minimum_value = less_than_min?(data_point) ? data_point : @minimum_value
      @has_ldata = true if @minimum_value < 0
      @has_data = true if @has_ldata
    end
  end
def ldata ( name , data_points = [ ] , attrs = { } ) attrs [ :color ] = increment_color if ( attrs [ :color ] . nil? or attrs [ :color ] == 'auto' ) attrs [ :group ] = 0 if attrs [ :group ] . nil? attrs [ :line_width ] = 5.0 if attrs [ :line_width ] . nil? attrs [ :dot_width ] = 0.01 if attrs [ :dot_width ] . nil? ldata_points = Array ( data_points ) @ldata << [ name , ldata_points , attrs [ :color ] , attrs ] ldata_points . each_with_index do | data_point , index | next if data_point . nil? if @maximum_value . nil? && @minimum_value . nil? @maximum_value = @minimum_value = data_point end @maximum_value = larger_than_max? ( data_point ) ? data_point : @maximum_value @has_ldata = true if @maximum_value > 0 @minimum_value = less_than_min? ( data_point ) ? data_point : @minimum_value @has_ldata = true if @minimum_value < 0 @has_data = true if @has_ldata end end
Same as data, but you can defined groups of lines.
Same as data but you can defined groups of lines .
# Pre-normalize # Setup max/min so spread starts at the low end of the data points # Make sure we draw the graph if we have line data, even if we # don't have data, or all the data is 0
name
<not_specific>
data_points
<not_specific>
attrs
<not_specific>