YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
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.
Create a NumericAxis
and set its stackingEnabled
property to true
. Assign a labelFunction
to format the axis.
Instantiate a StackedBarChart
and set its xAxis
to the NumericAxis
you created.
The series bars will stack from left to right rather than aligning vertically.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
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.
Copyright © 2013 Yahoo! Inc. All rights reserved.