Stacked area charts are multi series area charts that display the trend of the contribution of each value over time or categories.
As stacked charts should show contribution of different components to the total, we will demonstrate them on an imaginable ACME FastFood, Corp. sales. Let's assume that it sells Ice Cream, Chocolate Bar and Coke all through the year.
So, we have three series of data - one series for each product, and we give proper names to each series:
var dataSet = anychart.data.set([ ["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 in as stacked area:
And set "Area" as a default series type:
chart = anychart.areaChart();
Just change default series type to "SplineArea" and get your data displayed in more appealing way:
Here is a sample spline stacked area chart:
Just change default series type to "stepArea" and get your data displayed in more comparable way:
Here is a sample step stacked area chart: