I would like to draw a horizontal average line on a dimple js scatterplot. I've tried to follow the solution from here .But I can only get a point instead of a line and assignColor doesn't work either. I can't figure out what the problems are. Any suggestions? Your help would be appreciated.
var svg = dimple.newSvg("#ChartContainer", 800, 600);
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 50, 600, 500)
myChart.addMeasureAxis("x", "ESCIndex");
myChart.addMeasureAxis("y", "Grade");
var s=myChart.addSeries(["OECD"], dimple.plot.bubble);
var myLegend=myChart.addLegend(10, 10, 400, 30, "right", s);
var s1 = myChart.addSeries("Average", dimple.plot.line);
s1.data = [
{ "Average" : "avg", "Grade" : 13.22, "ESCIndex" : -10.45 },
{ "Average" : "avg", "Grade" : 13.22, "ESCIndex" : 6.79 }
];
myChart.assignColor("Average", "green");
myChart.draw();
Based on the solution from here.
I changed my code to the following:
Then the problems are solved.
Note:
527.967 ≈ (600 - 500)/2 + 500 - (13.22 *500)/(50*6)