2025-06-16 18:28:08 +05:00

52 lines
1.3 KiB
HTML
Executable File

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script>
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();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; max-width: 920px; margin: 0px auto;"></div>
<script src="../../canvasjs.min.js"></script>
</body>
</html>