#

API Docs for:
Show: Inherited Protected Private Deprecated

# ChartBase Class

Defined in: `input/charts/ChartBase.js:1`
Module: charts

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

- Index
- Methods
- Properties
- Attributes
- Events

## Item Index

### Methods

- _addTooltip
- _dataProviderChangeHandler
- _getAxisClass
- _getGraph
- _getTooltip
- _itemRendered
- _markerEventDispatcher
- _planarLabelFunction
- _positionTooltip
- _setAriaElements
- _setDataValues
- _setOffscreen
- _setText
- _showTooltip
- _tooltipChangeHandler
- _tooltipLabelFunction
- _updateTooltip
- bindUI
- getAxisByKey
- getCategoryAxis
- getSeries
- hideTooltip
- initializer
- renderUI
- syncUI
- toggleTooltip

### Properties

- _axes
- _axisClass
- _dataProvider
- _direction
- _seriesCollection
- _setSeriesCollection

### Attributes

- ariaDescription
- ariaLabel
- axesCollection
- categoryKey
- categoryType
- dataProvider
- graph
- groupMarkers
- interactionType
- seriesKeys
- tooltip

### Events

- markerEvent:click
- markerEvent:mousedown
- markerEvent:mouseout
- markerEvent:mouseover
- markerEvent:mouseup

## Methods

### `_addTooltip`

() private

Defined in `input/charts/ChartBase.js:902`

Adds a tooltip to the dom.

### `_dataProviderChangeHandler`

(

- `e`

)
private

Defined in `input/charts/ChartBase.js:787`

Event handler for dataProviderChange.

#### Parameters:

- `e` Object

  Event object.

### `_getAxisClass`

(

- `t`

)
private

Defined in `input/charts/ChartBase.js:406`

Helper method that returns the axis class that a key references.

#### Parameters:

- `t` String

  The type of axis.

#### Returns:

Axis

### `_getGraph`

() private

Defined in `input/charts/ChartBase.js:251`

Default value function for the `Graph` attribute.

#### Returns:

Graph

### `_getTooltip`

() private

Defined in `input/charts/ChartBase.js:973`

Default getter for `tooltip` attribute.

#### Returns:

Object

### `_itemRendered`

(

- `e`

)
private

Defined in `input/charts/ChartBase.js:235`

Handler for itemRendered event.

#### Parameters:

- `e` Object

  Event object.

### `_markerEventDispatcher`

(

- `e`

)
private

Defined in `input/charts/ChartBase.js:646`

Event handler for marker events.

#### Parameters:

- `e` Object

  Event object.

### `_planarLabelFunction`

(

- `categoryAxis`
- `valueItems`
- `index`
- `seriesArray`
- `seriesIndex`

)
String | HTML private

Defined in `input/charts/ChartBase.js:1025`

Formats tooltip text when `interactionType` is `planar`.

#### Parameters:

- `categoryAxis` Axis

  Reference to the categoryAxis of the chart.

- `valueItems` Array

  Array of objects for each series that has a data point in the coordinate plane of the event. Each object contains the following data:

  axis
    The value axis of the series.
  key
    The key for the series.
  value
    The value for the series item.
  displayName
    The display name of the series. (defaults to key if not provided)
- `index` Number

  The index of the item within its series.

- `seriesArray` Array

  Array of series instances for each value item.

- `seriesIndex` Number

  The index of the series in the `seriesCollection`.

#### Returns:

String | HTML:

### `_positionTooltip`

(

- `e`

)
private

Defined in `input/charts/ChartBase.js:865`

Positions the tooltip

#### Parameters:

- `e` Object

  Event object.

### `_setAriaElements`

(

- `cb`

)
private

Defined in `input/charts/ChartBase.js:475`

Creates an aria `live-region`, `aria-label` and `aria-describedby` for the Chart.

#### Parameters:

- `cb` Node

  Reference to the Chart's `contentBox` attribute.

### `_setDataValues`

(

- `val`

)
private

Defined in `input/charts/ChartBase.js:353`

Setter method for `dataProvider` attribute.

#### Parameters:

- `val` Array

  Array to be set as `dataProvider`.

#### Returns:

Array

### `_setOffscreen`

() private

Defined in `input/charts/ChartBase.js:505`

Sets a node offscreen for use as aria-description or aria-live-regin.

#### Returns:

Node

### `_setText`

(

- `label`
- `val`

)
private

Defined in `input/charts/ChartBase.js:1156`

Updates the content of text field. This method writes a value into a text field using `appendChild`. If the value is a `String`, it is converted to a `TextNode` first.

#### Parameters:

- `label` HTMLElement

  label to be updated

- `val` String

  value with which to update the label

### `_showTooltip`

(

- `msg`
- `x`
- `y`

)
private

Defined in `input/charts/ChartBase.js:842`

Shows a tooltip

#### Parameters:

- `msg` String

  Message to dispaly in the tooltip.

- `x` Number

  x-coordinate

- `y` Number

  y-coordinate

### `_tooltipChangeHandler`

(

- `e`

)
private

Defined in `input/charts/ChartBase.js:1131`

Event handler for the tooltipChange.

#### Parameters:

- `e` Object

  Event object.

### `_tooltipLabelFunction`

(

- `categoryItem`
- `valueItem`
- `itemIndex`
- `series`
- `seriesIndex`

)
String | HTML private

Defined in `input/charts/ChartBase.js:1084`

Formats tooltip text when `interactionType` is `marker`.

#### Parameters:

- `categoryItem` Object

  An object containing the following:

  axis
    The axis to which the category is bound.
  displayName
    The display name set to the category (defaults to key if not provided)
  key
    The key of the category.
  value
    The value of the category
- `valueItem` Object

  An object containing the following:

  axis
    The axis to which the item's series is bound.
  displayName
    The display name of the series. (defaults to key if not provided)
  key
    The key for the series.
  value
    The value for the series item.
- `itemIndex` Number

  The index of the item within the series.

- `series` CartesianSeries

  The `CartesianSeries` instance of the item.

- `seriesIndex` Number

  The index of the series in the `seriesCollection`.

#### Returns:

String | HTML:

### `_updateTooltip`

(

- `val`

)
private

Defined in `input/charts/ChartBase.js:923`

Updates the tooltip attribute.

#### Parameters:

- `val` Object

  Object containing properties for the tooltip.

#### Returns:

Object

### `bindUI`

() private

Defined in `input/charts/ChartBase.js:534`

### `getAxisByKey`

(

- `val`

)

Defined in `input/charts/ChartBase.js:295`

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`

()

Defined in `input/charts/ChartBase.js:316`

Returns the category axis for the chart.

#### Returns:

Axis

### `getSeries`

(

- `val`

)

Defined in `input/charts/ChartBase.js:270`

Returns a series instance by index or key value.

#### Parameters:

- `val` Object

#### Returns:

CartesianSeries

### `hideTooltip`

()

Defined in `input/charts/ChartBase.js:886`

Hides the default tooltip

### `initializer`

() private

Defined in `input/charts/ChartBase.js:442`

### `renderUI`

() private

Defined in `input/charts/ChartBase.js:454`

### `syncUI`

() private

Defined in `input/charts/ChartBase.js:525`

### `toggleTooltip`

(

- `e`

)

Defined in `input/charts/ChartBase.js:822`

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.

#### Parameters:

- `e` Object

  Event object.

## Properties

### `_axes`

Array private

Defined in `input/charts/ChartBase.js:433`

Collection of axes.

### `_axisClass`

Object private

Defined in `input/charts/ChartBase.js:419`

Key value pairs of axis types.

### `_dataProvider`

Array private

Defined in `input/charts/ChartBase.js:344`

Storage for the `dataProvider` attribute.

### `_direction`

String private

Defined in `input/charts/ChartBase.js:334`

Default direction of the chart.

Default: horizontal

### `_seriesCollection`

Array private

Defined in `input/charts/ChartBase.js:386`

Storage for `seriesCollection` attribute.

### `_setSeriesCollection`

Unknown private

Defined in `input/charts/ChartBase.js:395`

Setter method for `seriesCollection` attribute.

#### Sub-properties:

- `val` Array

  Array of either `CartesianSeries` instances or objects containing series attribute key value pairs.

## Attributes

### `ariaDescription`

String

Defined in `input/charts/ChartBase.js:31`

Sets the aria description for the chart.

### `ariaLabel`

String

Defined in `input/charts/ChartBase.js:11`

Sets the `aria-label` for the chart.

### `axesCollection`

Array

Defined in `input/charts/ChartBase.js:196`

Reference to all the axes in the chart.

### `categoryKey`

String

Defined in `input/charts/ChartBase.js:129`

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

Default: category

### `categoryType`

String

Defined in `input/charts/ChartBase.js:140`

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

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

Default: category

### `dataProvider`

Array

Defined in `input/charts/ChartBase.js:173`

Data used to generate the chart.

### `graph`

Graph

Defined in `input/charts/ChartBase.js:204`

Reference to graph instance.

### `groupMarkers`

Boolean

Defined in `input/charts/ChartBase.js:214`

Indicates whether or not markers for a series will be grouped and rendered in a single complex shape instance.

### `interactionType`

String

Defined in `input/charts/ChartBase.js:156`

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: marker

### `seriesKeys`

Array

Defined in `input/charts/ChartBase.js:186`

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

Defined in `input/charts/ChartBase.js:51`

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. The method contains the following arguments:
  categoryItem
    An object containing the following:
    axis
      The axis to which the category is bound.
    displayName
      The display name set to the category (defaults to key if not provided).
    key
      The key of the category.
    value
      The value of the category.
  valueItem
    An object containing the following:
    axis
      The axis to which the item's series is bound.
    displayName
      The display name of the series. (defaults to key if not provided)
    key
      The key for the series.
    value
      The value for the series item.
  itemIndex
    The index of the item within the series.
  series
    The `CartesianSeries` instance of the item.
  seriesIndex
    The index of the series in the `seriesCollection`.
  The method returns an `HTMLElement` which is written into the DOM using `appendChild`. If you override this method and choose to return an html string, you will also need to override the tooltip's `setTextFunction` method to accept an html string.
planarLabelFunction
  Reference to the function used to format a planar event triggered tooltip's text
  categoryAxis
    `CategoryAxis` Reference to the categoryAxis of the chart.
  valueItems
    Array of objects for each series that has a data point in the coordinate plane of the event. Each object contains the following data:
    axis
      The value axis of the series.
    key
      The key for the series.
    value
      The value for the series item.
    displayName
      The display name of the series. (defaults to key if not provided)
  index
    The index of the item within its series.
  seriesArray
    Array of series instances for each value item.
  seriesIndex
    The index of the series in the `seriesCollection`.

The method returns an `HTMLElement` which is written into the DOM using `appendChild`. If you override this method and choose to return an html string, you will also need to override the tooltip's `setTextFunction` method to accept an html string.
setTextFunction
  Method that writes content returned from `planarLabelFunction` or `markerLabelFunction` into the the tooltip node. has the following signature:
  label
    The `HTMLElement` that the content is to be added.
  val
    The content to be rendered into tooltip. This can be a `String` or `HTMLElement`. If an HTML string is used, it will be rendered as a string.

## Events

### `markerEvent:click`

Defined in `input/charts/ChartBase.js:751`

Broadcasts when `interactionType` is set to `marker` and a series marker has received a click event.

#### Event Payload:

- `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.
  pageX
    The x location of the event on the page (including scroll)
  pageY
    The y location of the event on the page (including scroll)
  series
    Reference to the series of the marker.
  index
    Index of the marker in the series.
  seriesIndex
    The `order` of the marker's series.
  originEvent
    Underlying dom event.

### `markerEvent:mousedown`

Defined in `input/charts/ChartBase.js:715`

Broadcasts when `interactionType` is set to `marker` and a series marker has received a mousedown event.

#### Event Payload:

- `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.

### `markerEvent:mouseout`

Defined in `input/charts/ChartBase.js:697`

Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseout event.

#### Event Payload:

- `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.

### `markerEvent:mouseover`

Defined in `input/charts/ChartBase.js:678`

Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseover event.

#### Event Payload:

- `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.

### `markerEvent:mouseup`

Defined in `input/charts/ChartBase.js:733`

Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseup event.

#### Event Payload:

- `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.