Articles in this section
Category / Section

How to create stacked waterfall chart using bar chart in JavaScript ?

2 mins read

This article explains how to create stacked waterfall chart using bar chart in JavaScript Chart component.

 

You can achieve a stacked waterfall chart using stacked bar series chart by adding one additional invisible series that will push the other two series to give the look of stacked water fall chart. Create a simple stacked bar chart with additional invisible series that will push the other two series to give the look of stacked water fall chart.

 

Index.js (View sample in GitHub for Angular, React and Vue platforms)

 
var chartData = [
    { baseline: 0, x: 'Total', y1: 190, y2: 12 },
    { baseline: 180, x: 'Otros', y1: 11, y2: 10 },
    { baseline: 180, x: 'Expert Monitoring', y1: 31, y2: 0 },
    { baseline: 195, x: 'Liquidacion Nacional', y1: 16, y2: 0 },
    { baseline: 178, x: 'Autorizacion Nacional', y1: 17, y2: 0 },
    { baseline: 155, x: 'Cuentas & Tarjetas', y1: 23, y2: 0 },
    { baseline: 116, x: 'Decision Intelligence', y1: 39, y2: 0 },
    { baseline: 0, x: 'Ventas', y1: 100, y2: 16 },
];
 
var chart = new ej.charts.Chart({
  primaryXAxis: {
    valueType: 'Category',
    majorGridLines: { width: 0 },
    lineStyle: { width: 0 },
    majorTickLines: { width: 0 },
  },
  primaryYAxis: {
    majorGridLines: { width: 0 },
    lineStyle: { width: 0 },
    majorTickLines: { width: 0 },
  },
series: [
    { type: 'StackingBar',dataSource: chartData,xName: 'x',yName: 'baseline',fill: '#FFFFFF'},
    { type: 'StackingBar',dataSource: chartData,xName: 'x',yName: 'y1',fill: '#fa4a00' },
    { type: 'StackingBar',dataSource: chartData,xName: 'x',yName: 'y2',fill: '#000095', },
  ],
  title: 'Variacion Absoluta',
});

 

 

The following screenshot illustrates the result of stacked waterfall chart achieved by using stacked bar chart.

Chart, waterfall chartDescription automatically generated

 

Checkout sample codes for Angular, Vue and React Frameworks in the below GitHub repository.

View sample in GitHub

Conclusion 

I hope you enjoyed learning about how to add the JavaScript Chart Value Change handler an additional parameter.

You can refer to our JavaScript Chart featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Chart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied