# Yahoo! UI Library

### Charts Widget 2.6.0

Yahoo! UI Library > charts > YAHOO.widget.Chart

Show Private Show Protected Show Deprecated

## Class YAHOO.widget.Chart - uses YAHOO.widget.FlashAdapter

Chart class for the YUI Charts widget.

### Constructor

YAHOO.widget.Chart `( type , containerId , dataSource , attributes )`

Parameters:
  `type <String>` The char type. May be "line", "column", "bar", or "pie"
  `containerId <HTMLElement>` Container element for the Flash Player instance.
  `dataSource <YAHOO.util.DataSource>` DataSource instance.
  `attributes <object>` (optional) Object literal of configuration values.

### Properties

#### _dataSource `- private object`

Storage for the dataSource attribute.

#### _dataTipFunction `- private String`

Stores a reference to the dataTipFunction created by YAHOO.widget.FlashAdapter.createProxyFunction()

#### _pollingID `- private Number`

The id returned from the DataSource's setInterval function.

#### _pollingInterval `- private Number`

The time, in ms, between requests for data.

#### _request `- private object`

Storage for the request attribute.

#### _seriesDefs `- private object`

Storage for the series attribute.

#### _seriesLabelFunctions `- private Array`

Stores references to series labelFunction values created by YAHOO.widget.FlashAdapter.createProxyFunction()

#### _type `- private String`

The type of this chart instance.

#### Chart.SWFURL `- private static final object`

Storage for the dataTipFunction attribute.
Default Value: "assets/charts.swf"

#### Properties inherited from YAHOO.widget.FlashAdapter:

`_attributes, _containerID, _id, _initialized, _swf, _swfURL`

#### Properties inherited from YAHOO.util.AttributeProvider:

`_configs`

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### _getCategoryNames

`private void _getCategoryNames ( )`
Getter for the categoryNames attribute.

Returns: `void`

#### _getDataSource

`private void _getDataSource ( )`
Getter for the dataSource attribute.

Returns: `void`

#### _getPolling

`private void _getPolling ( )`
Getter for the polling attribute.

Returns: `void`

#### _getRequest

`private void _getRequest ( )`
Getter for the request attribute.

Returns: `void`

#### _getSeriesDefs

`private void _getSeriesDefs ( )`
Getter for the series attribute.

Returns: `void`

#### _initAttributes

`private void _initAttributes ( )`
Initializes the attributes.

Returns: `void`

#### _loadDataHandler

`private void _loadDataHandler ( )`
Called when the DataSource receives new data. The series definitions are used to build a data provider for the SWF chart.

Returns: `void`

#### _loadHandler

`private void _loadHandler ( )`
Called when the SWF is ready for communication. Sets the type, initializes the styles, and sets the DataSource.

Returns: `void`

#### _setCategoryNames

`private void _setCategoryNames ( )`
Setter for the categoryNames attribute.

Returns: `void`

#### _setDataSource

`private void _setDataSource ( )`
Setter for the dataSource attribute.

Returns: `void`

#### _setDataTipFunction

`private void _setDataTipFunction ( )`
Setter for the dataTipFunction attribute.

Returns: `void`

#### _setPolling

`private void _setPolling ( )`
Setter for the polling attribute.

Returns: `void`

#### _setRequest

`private void _setRequest ( )`
Setter for the request attribute.

Returns: `void`

#### _setSeriesDefs

`private void _setSeriesDefs ( )`
Setter for the series attribute.

Returns: `void`

#### refreshData

`void refreshData ( )`
Sends (or resends) the request to the DataSource.

Returns: `void`

#### setSeriesStyles

`void setSeriesStyles ( styles )`
Sets the styles on all series in the Chart.

Parameters:
  `styles <Array>` Initializer for all Chart series styles.

Returns: `void`

#### setStyle

`void setStyle ( name , value )`
Sets a single style value on the Chart instance.

Parameters:
  `name <String>` Name of the Chart style value to change.
  `value <Object>` New value to pass to the Chart style.

Returns: `void`

#### setStyles

`void setStyles ( styles )`
Resets all styles on the Chart instance.

Parameters:
  `styles <Object>` Initializer for all Chart styles.

Returns: `void`

#### toString

`String toString ( )`
Public accessor to the unique name of the Chart instance.

Returns: `String`
  Unique name of the Chart instance.

#### Methods inherited from YAHOO.widget.FlashAdapter:

`_embedSWF, _eventHandler, _getAltText, _getSWFURL, _initAttributes, _loadHandler, _setAltText, destroy, toString`

#### Methods inherited from YAHOO.util.AttributeProvider:

`configureAttribute, fireBeforeChangeEvent, fireChangeEvent, get, getAttributeConfig, getAttributeKeys, refresh, register, resetAttributeConfig, resetValue, set, setAttributeConfig, setAttributes`

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

### Events

#### beforeCategoryNamesChange

`beforeCategoryNamesChange ( event )`
Fires before the value for the configuration attribute 'categoryNames' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeDataSourceChange

`beforeDataSourceChange ( event )`
Fires before the value for the configuration attribute 'dataSource' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeDataTipFunctionChange

`beforeDataTipFunctionChange ( event )`
Fires before the value for the configuration attribute 'dataTipFunction' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforePollingChange

`beforePollingChange ( event )`
Fires before the value for the configuration attribute 'polling' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeRequestChange

`beforeRequestChange ( event )`
Fires before the value for the configuration attribute 'request' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeSeriesChange

`beforeSeriesChange ( event )`
Fires before the value for the configuration attribute 'series' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### categoryNamesChange

`categoryNamesChange ( event )`
Fires when the value for the configuration attribute 'categoryNames' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### dataSourceChange

`dataSourceChange ( event )`
Fires when the value for the configuration attribute 'dataSource' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### dataTipFunctionChange

`dataTipFunctionChange ( event )`
Fires when the value for the configuration attribute 'dataTipFunction' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### itemClickEvent

`itemClickEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user clicks an item renderer in the chart with the mouse.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemDoubleClickEvent

`itemDoubleClickEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user double-clicks an item renderer in the chart with the mouse.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemDragEndEvent

`itemDragEndEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user releases the mouse during a drag action.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemDragEvent

`itemDragEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user moves the mouse during a drag action.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemDragStartEvent

`itemDragStartEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user presses the mouse down on an item to initiate a drag action.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemMouseOutEvent

`itemMouseOutEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user moves the mouse out of the bounds of an item renderer in the chart.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### itemMouseOverEvent

`itemMouseOverEvent ( event.type , event.item , event.index , event.seriesIndex , event.x , event.y )`
Fires when the user moves the mouse over the bounds of an item renderer in the chart.

Parameters:
  `event.type <String>` The event type
  `event.item <Object>` The data displayed by the renderer
  `event.index <Number>` The position within the series that the item appears.
  `event.seriesIndex <Number>` The position within the series definition that the series appears.
  `event.x <Number>` The horizontal position of the mouse, relative to the SWF.
  `event.y <Number>` The vertical position of the mouse, relative to the SWF.

#### pollingChange

`pollingChange ( event )`
Fires when the value for the configuration attribute 'polling' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### requestChange

`requestChange ( event )`
Fires when the value for the configuration attribute 'request' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### seriesChange

`seriesChange ( event )`
Fires when the value for the configuration attribute 'series' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### Events inherited from YAHOO.widget.FlashAdapter:

`altTextChange, backgroundColorChange, beforeAltTextChange, beforeBackgroundColorChange, beforeExpressInstallChange beforeSwfURLChange beforeVersionChange beforeWmodeChange contentReady expressInstallChange swfURLChange versionChange wmodeChange`

### Configuration Attributes

#### categoryNames `- Array`

Defines the names of the categories to be displayed in the Chart..

#### dataSource `- DataSource`

The DataSource instance to display in the Chart.

#### dataTipFunction `- String`

The string representation of a globally-accessible function that may be called by the SWF to generate the datatip text for a Chart's item.

#### polling `- Number`

A numeric value indicating the number of milliseconds between polling requests to the DataSource.

#### request `- String`

Request to be sent to the Chart's DataSource.

#### series `- Array`

Defines the series to be displayed by the Chart.

#### Configuration attributes inherited from YAHOO.widget.FlashAdapter:

`altText, backgroundColor, expressInstall, swfURL, version wmode`

Copyright © 2008 Yahoo! Inc. All rights reserved.