var = new CanvasJS.Chart("", { animationEnabled: true, exportEnabled: true, theme: "light2", //"light1", "dark1", "dark2" title:{ text: "Opportunity Funnel", fontFamily: "'Calibri',sans-serif", fontColor: "black", fontWeight: "bold", fontSize: 14 }, toolTip: { borderColor: 'gray', backgroundColor: "#eee", cornerRadius: 2, borderThickness: 2 }, data: [{ type: "funnel", indexLabelPlacement: "inside", indexLabelFontColor: "white", toolTipContent: "{label}: ${y} ({percentage}%)
({count} ops)", indexLabel: "{label}", dataPoints: [ //{ y: 1400, label: "Qualify" }, //{ y: 1212, label: "Develop" }, //{ y: 1080, label: "Propose" }, //{ y: 665, label: "Close" } ] }] }); calculatePercentage(); .render(); function calculatePercentage(chart) { var dataPoint = chart.options.data[0].dataPoints; var total = dataPoint[0].y; for(var i = 0; i < dataPoint.length; i++) { if(i == 0) { chart.options.data[0].dataPoints[i].percentage = 100; } else { chart.options.data[0].dataPoints[i].percentage = ((dataPoint[i].y / total) * 100).toFixed(2); } } }