Sha256: 43758169f8818872225970900bf212f3a5833a7bae735bd1445a0a22483106ea
Contents?: true
Size: 1.3 KB
Versions: 57
Compression:
Stored size: 1.3 KB
Contents
- resolution = 1 - data_id = "data-" << id - Open.write(@step.file(data_id), plot_data.to_json) - x_label = nil unless defined? x_label - y_label = nil unless defined? y_label - extra = "" unless defined? extra - url = @uri %svg(id=id) :ruby setup ||=<<-EOF var graph = nv.models.discreteBarChart() .x(function(d) { return d.label }) .y(function(d) { return d.value }) .staggerLabels(true) .showValues(true) graph.tooltip.enabled(true) EOF setup += "\ngraph.xAxis.axisLabel('#{x_label}')" if x_label setup += "\ngraph.yAxis.axisLabel('#{y_label}')" if y_label :javascript defer(function(){ var id = '#{id}'; var selector = "svg#" + id var uri = add_parameter(rbbt.url_add_script_name('#{url}'), '_file', '#{data_id}') var resolution = #{resolution} var svg = $(selector) var figure = svg.parent('.figure') var W = figure.innerWidth() var H = figure.innerHeight() nv.addGraph({ generate: function(){ #{setup} #{extra} $.get(uri, function(data){ var json = JSON.parse(data) console.log(json) d3.select(selector) .datum(json) .call(graph); }) nv.utils.windowResize(graph.update); return graph; }, }) })
Version data entries
57 entries across 57 versions & 1 rubygems