# Yahoo! UI Library

### charts 3.3.0

Yahoo! UI Library > charts > ChartBase
Search:
Filters Show Private Show Protected Show Deprecated

## Class ChartBase

Known Subclasses:
  CartesianChart PieChart

The ChartBase class is an abstract class used to create charts.

### Constructor

ChartBase `( )`

### Properties

#### _axes - `private object`

#### _axisClass - `private object`

#### _dataProvider - `private object`

#### _direction - `private object`

#### _seriesCollection - `private object`

### Methods

#### _addTooltip

`private void _addTooltip ( )`

#### _dataProviderChangeHandler

`private void _dataProviderChangeHandler ( )`

#### _getAxisClass

`private void _getAxisClass ( )`

#### _getGraph

`private void _getGraph ( )`
Default value function for the `graph` attribute.

#### _getTooltip

`private void _getTooltip ( )`

#### _markerEventDispatcher

`private void _markerEventDispatcher ( )`

#### _planarLabelFunction

`private void _planarLabelFunction ( )`

#### _positionTooltip

`private void _positionTooltip ( )`

#### _setDataValues

`private void _setDataValues ( )`

#### _setSeriesCollection

`private void _setSeriesCollection ( )`

#### _showTooltip

`private void _showTooltip ( )`

#### _tooltipChangeHandler

`private void _tooltipChangeHandler ( )`

#### _tooltipLabelFunction

`private void _tooltipLabelFunction ( )`

#### _updateTooltip

`private void _updateTooltip ( )`

#### bindUI

`private void bindUI ( )`

#### getAxisByKey

`getAxisByKey ( val )`
Returns an `Axis` instance by key reference. If the axis was explicitly set through the `axes` attribute, the key will be the same as the key used in the `axes` object. For default axes, the key for the category axis is the value of the `categoryKey` (`category`). For the value axis, the default key is `values`.

Parameters:
  `val <String>` Key reference used to look up the axis.

Returns: ``
  Axis

#### getCategoryAxis

`getCategoryAxis ( )`
Returns the category axis for the chart.

Returns: ``
  Axis

#### getSeries

`getSeries ( val )`
Returns a series instance by index or key value.

Parameters:
  `val <object>`

Returns: ``
  CartesianSeries

#### hideTooltip

`void hideTooltip ( )`
Hides the default tooltip

#### renderUI

`private void renderUI ( )`

#### toggleTooltip

`void toggleTooltip ( )`
Event listener for toggling the tooltip. If a tooltip is visible, hide it. If not, it will create and show a tooltip based on the event object.

### Events

#### axesCollectionChange

`axesCollectionChange ( event )`
Fires when the value for the configuration attribute 'axesCollection' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### categoryKeyChange

`categoryKeyChange ( event )`
Fires when the value for the configuration attribute 'categoryKey' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### categoryTypeChange

`categoryTypeChange ( event )`
Fires when the value for the configuration attribute 'categoryType' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### dataProviderChange

`dataProviderChange ( event )`
Fires when the value for the configuration attribute 'dataProvider' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### graphChange

`graphChange ( event )`
Fires when the value for the configuration attribute 'graph' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### interactionTypeChange

`interactionTypeChange ( event )`
Fires when the value for the configuration attribute 'interactionType' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### markerEvent:click

`markerEvent:click ( e )`
Broadcasts when `interactionType` is set to `marker` and a series marker has received a click event.

Parameters:
  `e <EventFacade>` Event facade with the following additional properties:
  categoryItem
    Hash containing information about the category `Axis`.
  valueItem
    Hash containing information about the value `Axis`.
  node
    The dom node of the marker.
  x
    The x-coordinate of the mouse in relation to the Chart.
  y
    The y-coordinate of the mouse in relation to the Chart.
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.

Preventable: This event is preventable by method e.preventDefault(). The default function executed by this event is false.

#### markerEvent:mousedown

`markerEvent:mousedown ( e )`
Broadcasts when `interactionType` is set to `marker` and a series marker has received a mousedown event.

Parameters:
  `e <EventFacade>` Event facade with the following additional properties:
  categoryItem
    Hash containing information about the category `Axis`.
  valueItem
    Hash containing information about the value `Axis`.
  node
    The dom node of the marker.
  x
    The x-coordinate of the mouse in relation to the Chart.
  y
    The y-coordinate of the mouse in relation to the Chart.
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.

Preventable: This event is preventable by method e.preventDefault(). The default function executed by this event is false.

#### markerEvent:mouseout

`markerEvent:mouseout ( e )`
Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseout event.

Parameters:
  `e <EventFacade>` Event facade with the following additional properties:
  categoryItem
    Hash containing information about the category `Axis`.
  valueItem
    Hash containing information about the value `Axis`.
  node
    The dom node of the marker.
  x
    The x-coordinate of the mouse in relation to the Chart.
  y
    The y-coordinate of the mouse in relation to the Chart.
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.

Preventable: This event is preventable by method e.preventDefault(). The default function executed by this event is false.

#### markerEvent:mouseover

`markerEvent:mouseover ( e )`
Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseover event.

Parameters:
  `e <EventFacade>` Event facade with the following additional properties:
  categoryItem
    Hash containing information about the category `Axis`.
  valueItem
    Hash containing information about the value `Axis`.
  node
    The dom node of the marker.
  x
    The x-coordinate of the mouse in relation to the Chart.
  y
    The y-coordinate of the mouse in relation to the Chart.
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.

Preventable: This event is preventable by method e.preventDefault(). The default function executed by this event is false.

#### markerEvent:mouseup

`markerEvent:mouseup ( e )`
Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseup event.

Parameters:
  `e <EventFacade>` Event facade with the following additional properties:
  categoryItem
    Hash containing information about the category `Axis`.
  valueItem
    Hash containing information about the value `Axis`.
  node
    The dom node of the marker.
  x
    The x-coordinate of the mouse in relation to the Chart.
  y
    The y-coordinate of the mouse in relation to the Chart.
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.

Preventable: This event is preventable by method e.preventDefault(). The default function executed by this event is false.

#### seriesKeysChange

`seriesKeysChange ( event )`
Fires when the value for the configuration attribute 'seriesKeys' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### tooltipChange

`tooltipChange ( event )`
Fires when the value for the configuration attribute 'tooltip' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

### Configuration Attributes

#### axesCollection `- Array`

Reference to all the axes in the chart.

#### categoryKey `- String`

The key value used for the chart's category axis.
Default Value: category

#### categoryType `- String`

Indicates the type of axis to use for the category axis.

category
  Specifies a `CategoryAxis`.
time
  Specifies a `TimeAxis`

Default Value: category

#### dataProvider `- Array`

Data used to generate the chart.

#### graph `- Graph`

Reference to graph instance.

#### interactionType `- String`

Indicates the the type of interactions that will fire events.

marker
  Events will be broadcasted when the mouse interacts with individual markers.
planar
  Events will be broadcasted when the mouse intersects the plane of any markers on the chart.
none
  No events will be broadcasted.

Default Value: marker

#### seriesKeys `- Array`

A collection of keys that map to the series axes. If no keys are set, they will be generated automatically depending on the data structure passed into the chart.

#### tooltip `- Object`

Reference to the default tooltip available for the chart.

Contains the following properties:

node
  Reference to the actual dom node
showEvent
  Event that should trigger the tooltip
hideEvent
  Event that should trigger the removal of a tooltip (can be an event or an array of events)
styles
  A hash of style properties that will be applied to the tooltip node
show
  Indicates whether or not to show the tooltip
markerEventHandler
  Displays and hides tooltip based on marker events
planarEventHandler
  Displays and hides tooltip based on planar events
markerLabelFunction
  Reference to the function used to format a marker event triggered tooltip's text
planarLabelFunction
  Reference to the function used to format a planar event triggered tooltip's text

Copyright © 2011 Yahoo! Inc. All rights reserved.