Skip to content

Commit

Permalink
Add entry function for scatter plot
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Feb 11, 2018
1 parent 719383f commit 525bc13
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config/plugins/visualizations/nvd3_bar/config/nvd3_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a regular bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="static/nvd3.js" css="static/nvd3.css" func="nvd3_bar"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="static/nvd3.css" func="nvd3_bar"/>
<specs>
<expand macro="specs"/>
<zoomable>true</zoomable>
Expand Down
15 changes: 12 additions & 3 deletions config/plugins/visualizations/nvd3_bar/src/nvd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ var CommonWrapper = Backbone.View.extend({
d3chart.xAxis.showMaxMin(false);
d3chart.yAxis.showMaxMin(chart.definition.showmaxmin);
d3chart.tooltip.contentGenerator(function(context) {
return "<h3>" + (context.data.tooltip || context.data.key) + "</h3>";
//return "<h3>" + (context.data.tooltip || context.data.key) + "</h3>";
});
d3chart.duration(0);
//d3chart.duration(0);
if ($("#" + canvas_id).length > 0) {
var canvas = d3.select("#" + canvas_id);
canvas.datum(groups).call(d3chart);
Expand Down Expand Up @@ -93,6 +93,15 @@ var CommonWrapper = Backbone.View.extend({
_.extend(window.bundleEntries || {}, {
nvd3_bar: function(options) {
options.type = "multiBarChart";
new CommonWrapper(options);
return new CommonWrapper(options);
},
nvd3_scatter: function(options) {
options.type = 'scatterChart';
options.makeConfig = function( nvd3_model ) {
nvd3_model.showDistX( true )
.showDistY( true )
.color( d3.scale.category10().range() );
};
return new CommonWrapper(options);
}
});
10 changes: 5 additions & 5 deletions config/plugins/visualizations/nvd3_bar/static/nvd3.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
</macros>
<description>Renders a scatter plot using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="static/nvd3bar.js"></entry_point>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" func="nvd3_scatter"/>
<specs>
<expand macro="specs"/>
<zoomable>true</zoomable>
</specs>
<groups>
<expand macro="groups"/>
<x>
<input>
<name>x</name>
<label>Values for x-axis</label>
<type>data_column</type>
<is_numeric>true</is_numeric>
</x>
<y>
</input>
<input>
<name>y</name>
<label>Values for y-axis</label>
<type>data_column</type>
<is_numeric>true</is_numeric>
</y>
</input>
</groups>
<settings>
<expand macro="settings"/>
Expand Down

0 comments on commit 525bc13

Please sign in to comment.