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.
The Array is passed to a new DataSource instance, and fields are defined to specify which items will be used from the original source.
A series definition allows the chart to display more than one series, and one can use it customize the appearance and behavior of each series individually.
In the series definition above, each series uses the
xField property to select a different key from the DataSource. The
displayName property will provide a visual reference to the name of each series in the mouse-over data tip, and it will be displayed in the legend, if present.
Notice that the third series defines a
type property. By customizing this value, we're able to build a combination chart that uses both bars and lines to display its data.
The DataSource instance is passed as a required argument of the BarChart's constructor. The series definition is passed to the chart through an optional initialization attribute named
series. We also specify the default
yField to be used for categories and pass in a custom axis that formats its labels as currency.
Similar to the Chart control's series definition, the DataTable control defines column headers. A
formatter is set for each column that will display currency.
Both the column headers and the DataSource instance are passed to the DataTable's constructor.
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.