score:0

Dimple's documentation on pie charts isn't very good. From what I can puzzle out from there examples, pie charts are treated somewhat differently.

  1. The require a measured axis of position "p".
  2. They require a categoryField when adding the series.

So fixing your example code, it becomes:

var svg = dimple.newSvg("#chartContainer", 590, 400);
var array1 = [10, 20, 30, 40, 50];
var array2 = [600, 300, 400, 200, 100];
var data = new Array();
for (var i = 0; i < array1.length; ++i) {
  data.push({
    x: array2[i],
    y: array1[i]
  });
}
var myChart = new dimple.chart(svg, data);
myChart.setBounds(60, 30, 510, 305)
//var x = myChart.addCategoryAxis("x", "x");
//myChart.addMeasureAxis("y", "y");
myChart.addMeasureAxis("p", "x");
myChart.addSeries("y", dimple.plot.pie);
myChart.draw();

Example here.


Related Query