com.yahoo.astra.fl.charts.Chart
Keywords: Chart,com.yahoo.astra.fl.charts.Chart,dataProvider,dataTipFunction,defaultSeriesType,legend,legendLabelFunction,indexToSeries,refreshSeries,seriesToIndex

YUI AS Component Documentation | All Packages | All Classes | Index | Frames No Frames |
Class Chart

Package | com.yahoo.astra.fl.charts
Class | public class Chart
Inheritance | Chart fl.core.UIComponent
Subclasses | CartesianChart, PieChart

Functionality common to most charts. Generally, a `Chart` object shouldn't be instantiated directly. Instead, a subclass with a concrete implementation should be used. That subclass generally should implement the `IPlotArea` interface.

Public Properties

| Property | Defined by
--- | --- | ---
|  | dataProvider : Object The data to be displayed by the chart. | Chart
|  | dataTipFunction : Function If defined, the chart will call the input function to determine the text displayed in the chart's data tip. | Chart
|  | defaultSeriesType : Object When raw data (like an Array of Numbers) is encountered where an ISeries instance is expected, it will be converted to this default type. | Chart
|  | legend : ILegend The component that will display a human-readable legend for the chart. | Chart
|  | legendLabelFunction : Function If defined, the chart will call the input function to determine the text displayed in in the chart's legend. | Chart

Public Methods

| Method | Defined by
--- | --- | ---
|  | Chart() Constructor. | Chart
|  | indexToSeries(index:int):ISeries Returns the ISeries object at the specified index. | Chart
|  | seriesToIndex(series:ISeries):int Returns the index within this plot area of the input ISeries object. | Chart

Protected Methods

| Method | Defined by
--- | --- | ---
|  | refreshSeries():void Analyzes the input data and smartly converts it to the correct ISeries type required for drawing. | Chart

Styles

| Style | Description | Defined by
--- | --- | --- | ---
|  | animationEnabled | Type: Boolean Determines if data changes should be displayed with animation. The default value is `true`. | Chart
|  | backgroundSkin | Type: Class Name of the class to use as the skin for the background and border of the component. The default value is `ChartBackgroundSkin`. | Chart
|  | contentPadding | Type: Number The padding that separates the border of the component from its contents, in pixels. The default value is `10`. | Chart
|  | dataTipBackgroundSkin | Type: Class Name of the class to use as the skin for the background and border of the chart's data tip. The default value is `ChartDataTipBackground`. | Chart
|  | dataTipContentPadding | Type: Number If the datatip's content padding is customizable, it will use this value. The padding that separates the border of the component from its contents, in pixels. The default value is `6`. | Chart
|  | dataTipTextFormat | Type: TextFormat The TextFormat object to use to render data tips. The default value is `TextFormat("_sans", 11, 0x000000, false, false, false, '', '', TextFormatAlign.LEFT, 0, 0, 0, 0)`. | Chart
|  | embedFonts | Type: Boolean Indicates whether embedded font outlines are used to render the text field. If this value is true, Flash Player renders the text field by using embedded font outlines. If this value is false, Flash Player renders the text field by using device fonts. If you set the embedFonts property to true for a text field, you must specify a font for that text by using the font property of a TextFormat object that is applied to the text field. If the specified font is not embedded in the SWF file, the text is not displayed. The default value is `false`. | Chart
|  | seriesColors | Type: Array The default colors for each series. These colors are used for markers, in most cases, but they may apply to lines, fills, or other graphical items. An Array of values that correspond to series indices in the data provider. If the number of values in the Array is less than the number of series, then the next series will restart at index zero in the style Array. If the value of this style is an empty Array, then each individual series will use the default or modified value set on the series itself. Example: If the seriesColors style is equal to [0xffffff, 0x000000] and there are three series in the chart's data provider, then the series at index 0 will have a color of 0xffffff, index 1 will have a color of 0x000000, and index 2 will have a color of 0xffffff (starting over from the beginning). The default value is `[0x00b8bf, 0x8dd5e7, 0xedff9f, 0xffa928, 0xc0fff6, 0xd00050, 0xc6c6c6, 0xc3eafb, 0xfcffad, 0xcfff83, 0x444444, 0x4d95dd, 0xb8ebff, 0x60558f, 0x737d7e, 0xa64d9a, 0x8e9a9b, 0x803e77]`. | Chart
|  | seriesMarkerSizes | Type: Array The default size of the markers in pixels. The actual drawn size of the markers could end up being different in some cases. For example, bar charts and column charts display markers side-by-side, and a chart may need to make the bars or columns smaller to fit within the required region. An Array of values that correspond to series indices in the data provider. If the number of values in the Array is less than the number of series, then the next series will restart at index zero in the style Array. If the value of this style is an empty Array, then each individual series will use the default or modified value set on the series itself. Example: If the seriesMarkerSizes style is equal to [10, 15] and there are three series in the chart's data provider, then the series at index 0 will have a marker size of 10, index 1 will have a marker size of 15, and index 2 will have a marker size of 10 (starting over from the beginning). The default value is `[]`. | Chart
|  | seriesMarkerSkins | Type: Array An Array containing the default skin classes for each series. These classes are used to instantiate the marker skins. The values may be fully-qualified package and class strings or a reference to the classes themselves. An Array of values that correspond to series indices in the data provider. If the number of values in the Array is less than the number of series, then the next series will restart at index zero in the style Array. If the value of this style is an empty Array, then each individual series will use the default or modified value set on the series itself. Example: If the seriesMarkerSkins style is equal to [CircleSkin, DiamondSkin] and there are three series in the chart's data provider, then the series at index 0 will have a marker skin of CircleSkin, index 1 will have a marker skin of DiamondSkin, and index 2 will have a marker skin of CircleSkin (starting over from the beginning). The default value is `[]`. | Chart

Property detail

dataProvider | property

`dataProvider:Object` [read-write]

The data to be displayed by the chart. Accepted data types include all of the following:

- An ISeries instance with its own data provider.
- An Array containing ISeries instances
- An Array containing Numbers.
- An Array containing complex objects.
- An XMLList
- An Array containing Arrays of Numbers or complex objects.

Note: When complex objects or XML is used in the data provider, developers must define "fields" used to access data used by the chart. For instance, CartesianChart exposes `horizontalField` and `verticalField` properties. PieChart exposes `dataField` and `categoryField` properties.

The chart will automatically convert the input data to an Array of ISeries objects. Don't access `dataProvider` if you intend to retreive the data in its original form. Implementation
`public function get dataProvider():Object`
`public function set dataProvider(value:Object):void`

dataTipFunction | property |

`dataTipFunction:Function` [read-write]

If defined, the chart will call the input function to determine the text displayed in the chart's data tip. The function uses the following signature:

`function dataTipFunction(item:Object, index:int, series:ISeries):String`

Implementation
`public function get dataTipFunction():Function`
`public function set dataTipFunction(value:Function):void`

defaultSeriesType | property |

`defaultSeriesType:Object` [read-write]

When raw data (like an Array of Numbers) is encountered where an ISeries instance is expected, it will be converted to this default type. Accepts either a Class instance or a String referencing a fully-qualified class name.

Implementation
`public function get defaultSeriesType():Object`
`public function set defaultSeriesType(value:Object):void`

legend | property |

`legend:ILegend` [read-write]

The component that will display a human-readable legend for the chart.

Implementation
`public function get legend():ILegend`
`public function set legend(value:ILegend):void`

legendLabelFunction | property |

`legendLabelFunction:Function` [read-write]

If defined, the chart will call the input function to determine the text displayed in in the chart's legend.

Implementation
`public function get legendLabelFunction():Function`
`public function set legendLabelFunction(value:Function):void`
Constructor detail

Chart | () | constructor

`public function Chart()`

Constructor.

Method detail

indexToSeries | () | method

`public function indexToSeries(index:int):ISeries`

Returns the ISeries object at the specified index.

Parameters

| `index:int` — the index of the series to return

Returns

| `ISeries` — the series that appears at the input index or null if out of bounds

refreshSeries | () | method |

`protected function refreshSeries():void`

Analyzes the input data and smartly converts it to the correct ISeries type required for drawing. Adds new ISeries objects to the display list and removes unused series objects that no longer need to be drawn.

seriesToIndex | () | method |

`public function seriesToIndex(series:ISeries):int`

Returns the index within this plot area of the input ISeries object.

Parameters

| `series:ISeries` — a series that is displayed in this plot area.

Returns

| `int` — the index of the input series