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 draw_ldata_line(attrs,x1,y1,x2,y2,px,py)
    color = attrs[:color]
    @d = @d.stroke color
    @d = @d.fill color
    @d = @d.stroke_opacity 1.0
    line_width = attrs[:line_width].to_f
    if line_width > 0
      line_dash = []
      if attrs[:style]
	line_dash = style_to_dasharray(attrs[:style],line_width)
      end
      @d = @d.stroke_dasharray(*line_dash)
      max_line_width = @columns / (@norm_ldata_max_size * 4)
      lwidth = clip_value_if_greater_than(max_line_width, line_width)
      @d = @d.stroke_width lwidth
      @d = @d.line(x1,y1,x2,y2)
    end
    dot_width = attrs[:dot_width].to_f
    if dot_width > 0
      @d = @d.stroke_dasharray()
      max_dot_width = @columns / (@norm_ldata_max_size * 2.5)
      circle_radius = 
	clip_value_if_greater_than(max_dot_width, dot_width)
      @d = @d.circle(px, py, px - circle_radius, py)
    end
    @d = @d.stroke_opacity 0.0
  end
def draw_ldata_line ( attrs , x1 , y1 , x2 , y2 , px , py ) color = attrs [ :color ] @d = @d . stroke color @d = @d . fill color @d = @d . stroke_opacity 1.0 line_width = attrs [ :line_width ] . to_f if line_width > 0 line_dash = [ ] if attrs [ :style ] line_dash = style_to_dasharray ( attrs [ :style ] , line_width ) end @d = @d . stroke_dasharray ( * line_dash ) max_line_width = @columns / ( @norm_ldata_max_size * 4 ) lwidth = clip_value_if_greater_than ( max_line_width , line_width ) @d = @d . stroke_width lwidth @d = @d . line ( x1 , y1 , x2 , y2 ) end dot_width = attrs [ :dot_width ] . to_f if dot_width > 0 @d = @d . stroke_dasharray ( ) max_dot_width = @columns / ( @norm_ldata_max_size * 2.5 ) circle_radius = clip_value_if_greater_than ( max_dot_width , dot_width ) @d = @d . circle ( px , py , px - circle_radius , py ) end @d = @d . stroke_opacity 0.0 end
Same as data, but you can defined groups of lines.
Same as data but you can defined groups of lines .
# ---------------------------------------- # First the line # ---------------------------------------- # Second the point / circle # Reset so the circle doesn't look broken # Reset opacity that the line stuff might have tweaked
attrs
<not_specific>
x1
<not_specific>
y1
<not_specific>
x2
<not_specific>
y2
<not_specific>
px
<not_specific>
py
<not_specific>