While answering this question, I came across what seems like some strange behavior in dimple.js line charts. I was trying to come up with a way to exploit colorAxis objects to control series color. For bubble charts, creating multiple colorAxis objects and assigning different ones to different series works just fine for coloring the series differently:
Code:
var svg = dimple.newSvg("body", 800, 400);
var data = [
{"Month":"01/2013", "Revenue":2000, "Profit":2000, "Units":4},
{"Month":"02/2013", "Revenue":3201, "Profit":2000, "Units":3},
{"Month":"03/2013", "Revenue":1940, "Profit":14000, "Units":5},
{"Month":"04/2013", "Revenue":2500, "Profit":3200, "Units":1},
{"Month":"05/2013", "Revenue":800, "Profit":1200, "Units":4}
]
var chart = new dimple.chart(svg, data);
chart.setBounds(60,20,680,330);
var x = chart.addCategoryAxis("x", "Month");
var prof = chart.addColorAxis("Profit", ["green", "green"])
var rev = chart.addColorAxis("Revenue", ["black", "black"])
var y2 = chart.addMeasureAxis("y", "Units");
chart.addSeries("null", dimple.plot.bar, [x,y2]);
var y1 = chart.addMeasureAxis("y", "Revenue");
chart.addSeries("null", dimple.plot.bubble, [x,y1, rev]);
var y3 = chart.addMeasureAxis("y", "Profit");
chart.addSeries("null", dimple.plot.bubble, [x,y3, prof]);
x.dateParseFormat = "%m/%Y";
x.addOrderRule("Date");
chart.draw();
However, if I change the series to be lines:
var y1 = chart.addMeasureAxis("y", "Revenue");
chart.addSeries("null", dimple.plot.line, [x,y1, rev]);
var y3 = chart.addMeasureAxis("y", "Profit");
chart.addSeries("null", dimple.plot.line, [x,y3, prof]);
Both lines are colored according to the most recent colorAxis assigned:
(jsFiddle)
Why is this? Is it the expected behavior?