Legends in Pie Chart are shown for each data point instead of data series. This is because each slice in a pie graph are proportional to their contribution towards the total sum. You can also attach event to chart legends. Given example shows a Pie Chart with clickable Legends. It also contains source code that you can edit in-browser or save to run it locally.
window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { exportEnabled: true, animationEnabled: true, title:{ text: "State Operating Funds" }, legend:{ cursor: "pointer", itemclick: explodePie }, data: [{ type: "pie", showInLegend: true, toolTipContent: "{name}: <strong>{y}%</strong>", indexLabel: "{name} - {y}%", dataPoints: [ { y: 26, name: "School Aid", exploded: true }, { y: 20, name: "Medical Aid" }, { y: 5, name: "Debt/Capital" }, { y: 3, name: "Elected Officials" }, { y: 7, name: "University" }, { y: 17, name: "Executive" }, { y: 22, name: "Other Local Assistance"} ] }] }); chart.render(); } function explodePie (e) { if(typeof (e.dataSeries.dataPoints[e.dataPointIndex].exploded) === "undefined" || !e.dataSeries.dataPoints[e.dataPointIndex].exploded) { e.dataSeries.dataPoints[e.dataPointIndex].exploded = true; } else { e.dataSeries.dataPoints[e.dataPointIndex].exploded = false; } e.chart.render(); }
The placement of the legend items can be changed using horizontalAlign and verticalAlign property, which is available in the legend object. You can also attach click events to the legend items using item itemclick event handler. Other frequently used customization options are explodeOnClick, startAngle, indexLabel, etc.