Stacked Bar/Column Charts


Data that is arranged in columns or rows on a worksheet can be plotted in a bar chart. Bar charts illustrate comparisons among individual items.


As stacked charts should show contribution of different components to the total, we will demonstrate them on sales of an imaginable ACME FastFood, Corp. Let's assume that it sells Ice Creams, Chocolate Bars and Coke all through the year. So, we have three series of data - one series for each product, and seasons of a year will be shown as categories:

    var dataSet =[
        ["Winter", 12000, 12000, 10000],
        ["Spring", 13000, 12000, 17000],
        ["Summer", 25000, 15000, 19000],
        ["Autumn", 16000, 16000, 16000]

Now we have to tell Y-Axis to display these series as stacked columns:


Everything is ready! Here is a sample of a stacked column chart:


Stacked Bar

Just change "column" to "bar" and get your data displayed as a bar chart:

  chart = anychart.column();
  series = chart.column(seriesData_1);
  series = chart.column(seriesData_2);
  series = chart.column(seriesData_3);
  series = chart.column(seriesData_4);

Also, tooltips can be enabled/disabled by adjusting .tooltip() method:

    series = chart.column(seriesData_1);

Here is a sample of a stacked bar chart:


3D Stacked Column Chart

One more quick feature demo - enabling 3D mode makes column chart three-dimensional:

XML Syntax XML Code Plain code 01 plotsettings enable3dmode="True" /> The sample of 3D Column chart at a glance: –>

You are looking at an outdated 7.6.0 version of this document. Switch to the 8.4.0 version to see the up to date information.