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.
The YUI Charts Control offers customization through its style and series style objects. This example demonstrates one way to customize a Line 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.
Our data will include an array of objects, containing values for the date, expenses and revenue. We will create a function that calculates and adds a profits field to each of these items in the array, and will pass this to our datasource.
Our series definition will include a series for expenses, revenue and profits. Each series will have a style block in which we will style the line, border and fill.
Since we are dealing with negative values, we want to have the ability to highlight them. The Cartesian Charts include a style called zeroGridline
. If an axis contains positive and negative values, the zeroGridline
style can be used to highlight the gridline that corresponds to zero on the axis. These properties will only take affect if the zero appears beyond the origin of an axis.
Next, we'll add methods for formatting our axis labels and datatip.
Create axes and set their label functions.
Finally, we'll add our chart, setting its series definition, styles, axes and datatip function.
For full details about styles and series styles, read the Charts Control User's Guide.
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.
Copyright © 2013 Yahoo! Inc. All rights reserved.