<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<script src="https://canvasjs.com/assets/script/canvasjs.min.js">
</script>
</head>
<body>
<div id="chartID" style="height:400px; max-width:950px;
margin:0px auto;">
</div>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartID", {
title: {
text: "Household Monthly income and expenses"
},
axisY: {
prefix: "Rs.",
title: "In Indian Rupees"
},
data: [
{
indexLabelPlacement: "outside",
indexLabelOrientation: "vertical",
fillOpacity: 2,
// corner chiselled effect
bevelEnabled: true,
type: "waterfall",
risingColor: "lightblue",
fallingColor: "yellow",
dataPoints: [
{ label: "Salary", y: 85000 },
{
label: "Groceries",
y: -10000
},
{ label: "Vegetables", y: -3000 },
{
label: "Freelance Salary",
y: 20000
},
{ label: "fruits", y: -1700 },
{
label: "Fixed expenses",
isIntermediateSum: true,
color: "brown"
},
{
label: "Outsource Helpers",
y: -5000
},
{
label: "Weekend Overtime",
y: 8000
},
{
label: "Total income after outsource",
isIntermediateSum: true,
color: "gray"
},
{ label: "Maintenance", y: -700 },
{
label: "Party exepenses",
y: -2100
},
{
label: "Expense in May",
y: -600
},
{
label: "Art remunerations",
y: 1800
},
{
label: "Entertainment expenses",
y: -800
},
// automatically calculates
// the sum of the dataPoints
{
label: "Total Savings",
isCumulativeSum: true,
color: "green"
}
]// end dataPoints
}
]// end data
}); //end CanvasJS.Chart
chart.render();
}// end window onload
</script>
</body>
</html>