A YUI Charts Control and a DataTable Control may share a DataSource to display the same data.
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 provider of data for the BarChart and the DataTable in this example is a standard JavaScript Array. Each Object in the Array contains multiple values that can be used for series in the BarChart or headers in the DataTable.
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.
Notice that the third series defines a type
property. By customizing this value, we're able to build a combination chart that combines bars and lines to display data.
The DataSource instance is passed as a required argument of the BarChart's constructor. The series definition is pass in an optional initialization attribute named series
.
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: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
Copyright © 2007 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings