سؤال

I'm building the next chart:

var myChart = new dimple.chart(svg, data);
//chart.setBounds(100, 100, "70%", "80%");

var x = myChart.addCategoryAxis("x", ["time","channel"]);//["time", "channel"]);
var y1 = myChart.addMeasureAxis("y", "Produccion");
//var y2 = chart.addMeasureAxis("y", "Produccion");

myChart.addSeries("Energy", dimple.plot.bar);//, [x,y1]);
myChart.addLegend(65, 10, 510, 20, "right");
myChart.draw(5000);

but I can't put in a different colour the bar that represent the value of each element of the group.

هل كانت مفيدة؟

المحلول

The series dimension determines the colouring of the bars. In your example you have used "Energy" which is not in your data meaning every bar gets labelled Energy and therefore coloured the same. If you want to colour them differently you need to add the dimension you intend to colour by in the series:

myChart.addSeries("channel", dimple.plot.bar);

Here's the corrected fiddle:

http://jsfiddle.net/B7xk8/

using assignColor will now allow you to specify certain colours for each value.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top