Sha256: 810f29cefa34595009500f3fa653d9589102b9b2e2fab45561890df6eb98975d
Contents?: true
Size: 976 Bytes
Versions: 16
Compression:
Stored size: 976 Bytes
Contents
- title ||= nil - id ||= title || ("scatter-" << (1000 * rand).to_i.to_s) - title ||= "Scatter Plot" - size ||= "size" - x ||= "x" - y ||= "y" - data_values = [] - data.each do |key,values| - label = key.respond_to?(:name)? key.name || key : key - data_values << {:label => label, :x => values[x], :y => values[y], :size => values[size]} - plot_data = [{:key => "Group", :values => data_values}] :ruby setup =<<-EOF var graph = nv.models.scatterChart() .showDistX(true) .showDistY(true) .useVoronoi(true) .color(d3.scale.category10().range()) graph.xAxis.tickFormat(d3.format('.02f')) graph.yAxis.tickFormat(d3.format('.02f')) graph.tooltip.enabled(true) graph.tooltip.contentGenerator(function(obj) { return '<h2>' + obj.point.label + '</h2>'; }); EOF = partial_render('tools/nvd3/chart', locals.merge(:plot_data => plot_data, :id => id, :resolution => resolution, :setup => setup))
Version data entries
16 entries across 16 versions & 1 rubygems