Waterfall - multiple intermediate sum
Time series data
by amrutaJgtp
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
</figure>
CSS
.highcharts-figure,
.highcharts-data-table table {
min-width: 320px;
max-width: 700px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
JavaScript
Highcharts.chart('container', {
"chart": {
"zoomType": "xy"
},
"plotOptions": {
"series": {
"cursor": "pointer",
"allowPointSelect": true,
"showInLegend": true
}
},
"legend": {
"enabled": true
},
"series": [{
"eQFormat": "#,###,###,##0",
"type": "waterfall",
"data": [{
"eQCategoryValue": "0",
"x": 0,
"y": 0
},
{
"eQCategoryValue": "1",
"x": 1,
"y": 4
},
{
"eQCategoryValue": "2",
"x": 2,
"y": null
},
{
"eQCategoryValue": "M1",
"x": 3,
"isSum": true,
"color": "green"
},
{
"eQCategoryValue": "3",
"x": 4,
"y": null
},
{
"eQCategoryValue": "L1",
"x": 5,
"isSum": true,
"color": "red"
},
{
"eQCategoryValue": "4",
"x": 6,
"y": 7
},
{
"eQCategoryValue": "5",
"x": 7,
"y": null
},
{
"eQCategoryValue": "6",
"x": 8,
"y": 18
}
],
"showInLegend": false,
},
{
"name": "Increase",
"type": "area",
"color": "rgba(0,41,170,1)"
},
{
"name": "Decrease",
"type": "area",
"color": "rgba(65,146,217,1)"
}
],
"xAxis": {
"title": {
"text": "Categories"
},
"tickWidth": 1,
"tickInterval": 1,
"tickmarkPlacement": "on",
"type": "linear",
"scrollbar": {
"enabled": true
},
"categories": [
"0",
"1",
"2",
"M1",
"3",
"L1",
"4",
"5",
"6"
],
"plotLines": [{
"value": 7,
"zIndex": 5,
"dashStyle": "Solid",
"width": 1,
"color": "#000000",
"label": {
"x": 0,
"y": 0,
"text": "L2",
...