This example demonstrates how to use YUI Charts Control to create a Stacked Bar Chart.
Please note: The YUI Charts Control requires Flash Player 9.0.45 or higher. The latest version of Flash Player is available at the Adobe Flash Player Download Center.
When creating Bar and Column charts with multiple series, you have the ability to stack your series on top of one-another. In this example, we'll create stacked BarChart, which lets you show the absolute values of data points through their segments, as well as the total values of each series.
First, we'll create the DataSource to populate the chart. This DataSource contains four values, a year and three sets of sales figures.
We will have three series in our example, corresponding to the Internet sales, print sales, and TV sales.
NumericAxis and set its
stackingEnabled property to
true. Assign a
labelFunction to format the axis.
StackedBarChart and set its
xAxis to the
NumericAxis you created.
The series bars will stack from left to right rather than aligning vertically.
Note: Logging and debugging is currently turned off for this example.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.