lib/gruff/scatter.rb
# Maximum X Value. The value will get overwritten by the max in the
# datasets.
Maximum X Value. The value will get overwritten by the max in the
datasets.
Maximum X Value . The value will get overwritten by the max in the datasets .
def draw_graph
    @x_increment = (@x_spread > 1) ? (@graph_width / (@x_spread - 1).to_f) : @graph_width
    store.norm_data.each do |data_row|
      data_row.coordinates.each do |x_value, y_value|
        next if y_value.nil? || x_value.nil?
        new_x = get_x_coord(x_value, @graph_width, @graph_left)
        new_y = @graph_top + (@graph_height - y_value * @graph_height)
        stroke_width  = @stroke_width  || clip_value_if_greater_than(@columns / (store.norm_data.first[1].size * 4), 5.0)
        circle_radius = @circle_radius || clip_value_if_greater_than(@columns / (store.norm_data.first[1].size * 2.5), 5.0)
        Gruff::Renderer::Circle.new(renderer, color: data_row.color, width: stroke_width).render(new_x, new_y, new_x - circle_radius, new_y)
      end
    end
  end
def draw_graph @x_increment = ( @x_spread > 1 ) ? ( @graph_width / ( @x_spread - 1 ) . to_f ) : @graph_width store . norm_data . each do | data_row | data_row . coordinates . each do | x_value , y_value | next if y_value . nil? || x_value . nil? new_x = get_x_coord ( x_value , @graph_width , @graph_left ) new_y = @graph_top + ( @graph_height - y_value * @graph_height ) stroke_width = @stroke_width || clip_value_if_greater_than ( @columns / ( store . norm_data . first [ 1 ] . size * 4 ) , 5.0 ) circle_radius = @circle_radius || clip_value_if_greater_than ( @columns / ( store . norm_data . first [ 1 ] . size * 2.5 ) , 5.0 ) Gruff :: Renderer :: Circle . new ( renderer , color : data_row . color , width : stroke_width ) . render ( new_x , new_y , new_x - circle_radius , new_y ) end end end
Maximum X Value.
Maximum X Value .
# Check to see if more than one datapoint was given. NaN can result otherwise. # Reset each time to avoid thin-line errors