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
The initializing attributes are stored here until the SWF is ready.
The ID of the containing DIV.
Storage for the dataSource attribute.
Stores a reference to the dataTipFunction created by
YAHOO.widget.Chart.createProxyFunction()
Indicates whether the SWF has been initialized and is ready
to communicate with JavaScript
Stores a reference to the legendLabelFunction created by
YAHOO.widget.Chart.createProxyFunction()
The id returned from the DataSource's setInterval function.
The time, in ms, between requests for data.
_request
- private object
Storage for the request attribute.
Storage for the series attribute.
Stores references to series function values created by
YAHOO.widget.Chart.createProxyFunction()
_swf
- private object
A reference to the embedded SWF file.
The javascript wrapper for the swf object
_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"
The number of proxy functions that have been created.
Methods
private
void
_eventHandler
(
)
Handles swfReady event from SWF.
private
void
_getAltText
(
)
Getter for altText attribute.
private
void
_getCategoryNames
(
)
Getter for the categoryNames attribute.
private
void
_getDataSource
(
)
Getter for the dataSource attribute.
private
void
_getPolling
(
)
Getter for the polling attribute.
private
void
_getRequest
(
)
Getter for the request attribute.
private
void
_getSeriesDefs
(
)
Getter for the series attribute.
private
void
_getSWFURL
(
)
Getter for swfURL attribute.
private
void
_initAttributes
(
)
Initializes the attributes.
private
void
_loadDataHandler
(
)
Called when the DataSource receives new data. The series definitions are used
to build a data provider for the SWF chart.
private
void
_loadHandler
(
)
Called when the SWF is ready for communication. Sets the type, initializes
the styles, and sets the DataSource.
private
void
_setAltText
(
)
Setter for altText attribute.
private
void
_setCategoryNames
(
)
Setter for the categoryNames attribute.
private
void
_setDataSource
(
)
Setter for the dataSource attribute.
private
void
_setDataTipFunction
(
)
Setter for the dataTipFunction attribute.
private
void
_setLegendLabelFunction
(
)
Setter for the legendLabelFunction attribute.
private
void
_setPolling
(
)
Setter for the polling attribute.
private
void
_setRequest
(
)
Setter for the request attribute.
private
void
_setSeriesDefs
(
)
Setter for the series attribute.
void
refreshData
(
)
Sends (or resends) the request to the DataSource.
void
setSeriesStyles
(
styles
)
Sets the styles on all series in the Chart.
- Parameters:
-
styles
<Array>
Initializer for all Chart series styles.
- Returns:
void
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
void
setStyles
(
styles
)
Resets all styles on the Chart instance.
- Parameters:
-
styles
<Object>
Initializer for all Chart styles.
- Returns:
void
String
toString
(
)
Public accessor to the unique name of the Chart instance.
- Returns:
String
- Unique name of the Chart instance.
private
static
void
YAHOO.widget.Chart.createProxyFunction
(
)
Creates a globally accessible function that wraps a function reference.
Returns the proxy function's name as a string for use by the SWF through
ExternalInterface.
private
static
void
YAHOO.widget.Chart.getFunctionReference
(
)
Uses YAHOO.widget.Chart.createProxyFunction to return string
reference to a function.
private
static
void
YAHOO.widget.Chart.removeProxyFunction
(
)
Removes a function created with createProxyFunction()
configureAttribute,
fireBeforeChangeEvent,
fireChangeEvent,
get,
getAttributeConfig,
getAttributeKeys,
refresh,
register,
resetAttributeConfig,
resetValue,
set,
setAttributeConfig,
setAttributes
Events
altTextChange
(
event
)
Fires when the value for the configuration attribute 'altText' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
backgroundColorChange
(
event
)
Fires when the value for the configuration attribute 'backgroundColor' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
beforeAltTextChange
(
event
)
Fires before the value for the configuration attribute 'altText' 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.
beforeBackgroundColorChange
(
event
)
Fires before the value for the configuration attribute 'backgroundColor' 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.
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
(
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
(
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.
beforeExpressInstallChange
(
event
)
Fires before the value for the configuration attribute 'expressInstall' 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.
beforeLegendLabelFunctionChange
(
event
)
Fires before the value for the configuration attribute 'legendLabelFunction' 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
(
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
(
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
(
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.
beforeSwfURLChange
(
event
)
Fires before the value for the configuration attribute 'swfURL' 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.
beforeVersionChange
(
event
)
Fires before the value for the configuration attribute 'version' 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.
beforeWmodeChange
(
event
)
Fires before the value for the configuration attribute 'wmode' 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
(
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.
contentReady
(
)
Fires when the SWF is initialized and communication is possible.
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
(
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.
expressInstallChange
(
event
)
Fires when the value for the configuration attribute 'expressInstall' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
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
(
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
(
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
(
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
(
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
(
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
(
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.
legendLabelFunctionChange
(
event
)
Fires when the value for the configuration attribute 'legendLabelFunction' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
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
(
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
(
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.
swfURLChange
(
event
)
Fires when the value for the configuration attribute 'swfURL' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
versionChange
(
event
)
Fires when the value for the configuration attribute 'version' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
wmodeChange
(
event
)
Fires when the value for the configuration attribute 'wmode' changes.
- Parameters:
-
event
<{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
Configuration Attributes
The alternative text to provide for screen readers and other assistive technology.
The background color of the SWF. Only available in the constructor because it may not be
set after Flash Player has been embedded in the page.
Defines the names of the categories to be displayed in the Chart..
The DataSource instance to display in the Chart.
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.
URL pointing to a SWF file that handles Flash Player's express
install feature. Only available in the constructor because it may not be
set after Flash Player has been embedded in the page.
The string representation of a globally-accessible function
that may be called by the SWF to format the labels of a Chart's legend.
A numeric value indicating the number of milliseconds between
polling requests to the DataSource.
Request to be sent to the Chart's DataSource.
Defines the series to be displayed by the Chart.
Absolute or relative URL to the SWF displayed by the Chart. Only available in the constructor because it may not be
set after Flash Player has been embedded in the page.
Minimum required version for the SWF file. Only available in the constructor because it may not be
set after Flash Player has been embedded in the page.
Sets the window mode of the Flash Player control. May be
"window", "opaque", or "transparent". Only available in the constructor
because it may not be set after Flash Player has been embedded in the page.