Q:

kendoui aggregate function for pie chart

I'm trying to make pie chart with aggregate function. It should display category name and products count in that category. I don't know how to find product count for categories.
How to find them? Thanks.

var dataSource = new kendo.data.DataSource({

  type: "odata",
  transport: {
    read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"
  },

});


$("#chart").kendoChart({
  dataSource: dataSource,
 
  legend: {
    visible: true
  },
  seriesDefaults: {
    type: "pie"
  },

  series: [{
  
    field: "CategoryID",  //it should be product count by category
    categoryField: "CategoryName",
    explodeField: "explode",
    labels: {
      visible: true,
    }
  }],


});
<div id="chart"></div>

A:

Try it this way, 
    var dataSource = new kendo.data.DataSource({
        type: "odata",
        transport: {
            read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Categories?$expand=Products"
        },
    });

   $("#chart").kendoChart({
        dataSource: dataSource,
        legend: {
            visible: true
        },
        series: [{
            type: "pie",
            field: "Products.results.length",
            categoryField: "CategoryName",
            explodeField: "explode",
            labels: {
                visible: true,
            }
        }]
    });

Read up on odata expand and getting count of scalar navigation properties for further finesse

