Wednesday, 15 August 2012

d3.js - Change categoryAxis to measureAxis with dimple -



d3.js - Change categoryAxis to measureAxis with dimple -

for x-axis of bubble chart, i'm trying alter default categoryaxis measureaxis, output sums info points , displays 1 bubble.

var svg = dimple.newsvg("#chartcontainer", 600, 400), chart = null, s = null, x = null, y = null; chart = new dimple.chart(svg); x = chart.addmeasureaxis("x", "length"); y = chart.addmeasureaxis("y", "value"); s = chart.addseries(null, dimple.plot.bubble, [x, y]); s.data = [ { "value" : 100000, "length" : 3}, { "value" : 400000, "length" : 1}, { "value" : 120000, "length" : 4} ]; chart.draw();

here's fiddle: http://jsfiddle.net/gonnastop/mvf4b/.

thank you!

the first parameter of addseries method takes dimension(s) split info points. here go:

var svg = dimple.newsvg("#chartcontainer", 600, 400), chart = null, s = null, x = null, y = null; chart = new dimple.chart(svg); x = chart.addmeasureaxis("x", "length"); y = chart.addmeasureaxis("y", "value"); s = chart.addseries(["length", "value"], dimple.plot.bubble, [x, y]); s.data = [ { "value" : 100000, "length" : 3}, { "value" : 400000, "length" : 1}, { "value" : 120000, "length" : 4} ]; chart.draw();

http://jsfiddle.net/mvf4b/5/

d3.js dimple.js

No comments:

Post a Comment