87 lines
1.8 KiB
HTML
Executable File
87 lines
1.8 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: "Car Parts Sold in Different States"
|
|
},
|
|
subtitles: [{
|
|
text: "Click Legend to Hide or Unhide Data Series"
|
|
}],
|
|
axisX: {
|
|
title: "States"
|
|
},
|
|
axisY: {
|
|
title: "Oil Filter - Units",
|
|
titleFontColor: "#4F81BC",
|
|
lineColor: "#4F81BC",
|
|
labelFontColor: "#4F81BC",
|
|
tickColor: "#4F81BC"
|
|
},
|
|
axisY2: {
|
|
title: "Clutch - Units",
|
|
titleFontColor: "#C0504E",
|
|
lineColor: "#C0504E",
|
|
labelFontColor: "#C0504E",
|
|
tickColor: "#C0504E"
|
|
},
|
|
toolTip: {
|
|
shared: true
|
|
},
|
|
legend: {
|
|
cursor: "pointer",
|
|
itemclick: toggleDataSeries
|
|
},
|
|
data: [{
|
|
type: "column",
|
|
name: "Oil Filter",
|
|
showInLegend: true,
|
|
yValueFormatString: "#,##0.# Units",
|
|
dataPoints: [
|
|
{ label: "New Jersey", y: 19034.5 },
|
|
{ label: "Texas", y: 20015 },
|
|
{ label: "Oregon", y: 25342 },
|
|
{ label: "Montana", y: 20088 },
|
|
{ label: "Massachusetts", y: 28234 }
|
|
]
|
|
},
|
|
{
|
|
type: "column",
|
|
name: "Clutch",
|
|
axisYType: "secondary",
|
|
showInLegend: true,
|
|
yValueFormatString: "#,##0.# Units",
|
|
dataPoints: [
|
|
{ label: "New Jersey", y: 210.5 },
|
|
{ label: "Texas", y: 135 },
|
|
{ label: "Oregon", y: 425 },
|
|
{ label: "Montana", y: 130 },
|
|
{ label: "Massachusetts", y: 528 }
|
|
]
|
|
}]
|
|
});
|
|
chart.render();
|
|
|
|
function toggleDataSeries(e) {
|
|
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
|
|
e.dataSeries.visible = false;
|
|
} else {
|
|
e.dataSeries.visible = true;
|
|
}
|
|
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> |