Method: Statsample::Graph::Scatterplot#add_line_median

Defined in:
lib/statsample/graph/scatterplot.rb

#add_line_median(vis) ⇒ Object

Add a rule on median of X and Y axis


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/statsample/graph/scatterplot.rb', line 95

def add_line_median(vis) # :nodoc:
  that=self
  x=@x_scale
  y=@y_scale
  vis.execute {
    rule do
      data [that.v1.median]
      left x
      stroke_style Rubyvis.color("#933").alpha(0.5)
      label(:anchor=>"top") do
        text x.tick_format
      end
    end
    rule do
      data [that.v2.median]
      bottom y
      stroke_style Rubyvis.color("#933").alpha(0.5)
      label(:anchor=>"right") do
        text y.tick_format
      end
    end  
  }
  
end