lib/statsample/graph/svgscatterplot.rb in statsample-0.11.2 vs lib/statsample/graph/svgscatterplot.rb in statsample-0.12.0
- old
+ new
@@ -1,14 +1,23 @@
+require 'tempfile'
module Statsample
module Graph
class SvgScatterplot < SVG::Graph::Plot # :nodoc:
attr_accessor :draw_path
def initialize(ds,config={})
super(config)
@ds=ds
set_x(@ds.fields[0])
end
+ def report_building_html(g)
+ self.parse()
+ tf=Tempfile.new(['image','.svg'])
+ tf.write self.burn
+ tf.close
+ image=ReportBuilder::Image.new(tf.path)
+ g.parse_element(image)
+ end
def set_defaults
super
init_with(
:show_data_values => false,
:draw_path => false
@@ -25,10 +34,10 @@
data[y]+=[row[@x],row[y]] unless row[@x].nil? or row[y].nil?
}
}
data.each{|y,d|
add_data({
- :data=>d, :title=>@ds.vector_label(y)
+ :data=>d, :title=>@ds[y].name
})
}
end
def get_x_labels
values=super