#

API Docs for:
Show: Inherited Protected Private Deprecated

# Graph Class

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

Graph manages and contains series instances for a `CartesianChart` instance.

- Index
- Methods
- Properties
- Attributes

## Item Index

### Methods

- _addSeries
- _drawingCompleteHandler
- _drawSeries
- _getDefaultStyles
- _getSeries
- _markerEventHandler
- _parseSeriesCollection
- _sizeChangeHandler
- _updateStyles
- addDispatcher
- bindUI
- createSeries
- destructor
- getSeriesByIndex
- getSeriesByKey
- syncUI

### Properties

- _dispatchers
- _seriesCollection
- _seriesDictionary
- _seriesMap
- seriesTypes

### Attributes

- background
- chart
- graphic
- gridlines
- groupMarkers
- horizontalGridlines
- seriesCollection
- seriesDictionary
- showBackground
- styles
- verticalGridlines
- x
- y

## Methods

### `_addSeries`

(

- `series`

)
private

Defined in `input/charts/Graph.js:199`

Adds a series to the graph.

#### Parameters:

- `series` CartesianSeries

  Series to add to the graph.

### `_drawingCompleteHandler`

(

- `e`

)
private

Defined in `input/charts/Graph.js:469`

Event handler for series drawingComplete event.

#### Parameters:

- `e` Object

  Event object.

### `_drawSeries`

() private

Defined in `input/charts/Graph.js:430`

Draws each series.

### `_getDefaultStyles`

() protected

Defined in `input/charts/Graph.js:496`

Gets the default value for the `styles` attribute. Overrides base implementation.

#### Returns:

Object

### `_getSeries`

(

- `type`

)
private

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

Returns a specific `CartesianSeries` class based on key value from a look up table of a direct reference to a class. When specifying a key value, the following options are available:

Key Value | Class
--- | ---
line | Y.LineSeries
column | Y.ColumnSeries
bar | Y.BarSeries
area | Y.AreaSeries
stackedarea | Y.StackedAreaSeries
stackedline | Y.StackedLineSeries
stackedcolumn | Y.StackedColumnSeries
stackedbar | Y.StackedBarSeries
markerseries | Y.MarkerSeries
spline | Y.SplineSeries
areaspline | Y.AreaSplineSeries
stackedspline | Y.StackedSplineSeries
stackedareaspline | Y.StackedAreaSplineSeries
stackedmarkerseries | Y.StackedMarkerSeries
pie | Y.PieSeries
combo | Y.ComboSeries
stackedcombo | Y.StackedComboSeries
combospline | Y.ComboSplineSeries
stackedcombospline | Y.StackedComboSplineSeries

When referencing a class directly, you can specify any of the above classes or any custom class that extends `CartesianSeries` or `PieSeries`.

#### Parameters:

- `type` String | Object

  Series type.

#### Returns:

CartesianSeries

### `_markerEventHandler`

(

- `e`

)
private

Defined in `input/charts/Graph.js:343`

Event handler for marker events.

#### Parameters:

- `e` Object

  Event object.

### `_parseSeriesCollection`

(

- `Collection`

)
private

Defined in `input/charts/Graph.js:151`

Parses series instances to be displayed in the graph.

#### Parameters:

- `Collection` Array

  of `CartesianSeries` instances or objects container `CartesianSeries` attributes values.

### `_sizeChangeHandler`

(

- `e`

)
private

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

Event handler for size changes.

#### Parameters:

- `e` Object

  Event object.

### `_updateStyles`

() private

Defined in `input/charts/Graph.js:369`

Updates the `Graph` styles.

### `addDispatcher`

(

- `val`

)
protected

Defined in `input/charts/Graph.js:116`

Adds dispatcher to a `_dispatcher` used to to ensure all series have redrawn before for firing event.

#### Parameters:

- `val` CartesianSeries

  series instance to add

### `bindUI`

() private

Defined in `input/charts/Graph.js:12`

### `createSeries`

(

- `seriesData`

)
private

Defined in `input/charts/Graph.js:231`

Creates a `CartesianSeries` instance from an object containing attribute key value pairs. The key value pairs include attributes for the specific series and a type value which defines the type of series to be used.

#### Parameters:

- `seriesData` Object

  Series attribute key value pairs.

### `destructor`

() protected

Defined in `input/charts/Graph.js:521`

Destructor implementation Graph class. Removes all Graphic instances from the widget.

### `getSeriesByIndex`

(

- `val`

)

Defined in `input/charts/Graph.js:80`

Returns a series instance based on an index.

#### Parameters:

- `val` Number

  index of the series

#### Returns:

CartesianSeries

### `getSeriesByKey`

(

- `val`

)

Defined in `input/charts/Graph.js:98`

Returns a series instance based on a key value.

#### Parameters:

- `val` String

  key value of the series

#### Returns:

CartesianSeries

### `syncUI`

() private

Defined in `input/charts/Graph.js:25`

## Properties

### `_dispatchers`

Array private

Defined in `input/charts/Graph.js:360`

Collection of `CartesianSeries` instances to be redrawn.

### `_seriesCollection`

Array private

Defined in `input/charts/Graph.js:133`

Collection of series to be displayed in the graph.

### `_seriesDictionary`

Object private

Defined in `input/charts/Graph.js:142`

Object containing key value pairs of `CartesianSeries` instances.

### `_seriesMap`

Object private

Defined in `input/charts/Graph.js:264`

String reference for pre-defined `Series` classes.

### `seriesTypes`

Object private

Defined in `input/charts/Graph.js:71`

Object of arrays containing series mapped to a series type.

## Attributes

### `background`

Graphic

Defined in `input/charts/Graph.js:692`

Reference to graphic instance used for the background.

### `chart`

ChartBase

Defined in `input/charts/Graph.js:574`

Reference to the chart instance using the graph.

### `graphic`

Graphic

Defined in `input/charts/Graph.js:734`

Reference to graphic instance used for series.

### `gridlines`

Graphic

Defined in `input/charts/Graph.js:712`

Reference to graphic instance used for gridlines.

### `groupMarkers`

Boolean

Defined in `input/charts/Graph.js:756`

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

### `horizontalGridlines`

Gridlines

Defined in `input/charts/Graph.js:630`

Reference to the horizontal `Gridlines` instance.

Default: null

### `seriesCollection`

CartesianSeries

Defined in `input/charts/Graph.js:583`

Collection of series. When setting the `seriesCollection` the array can contain a combination of either `CartesianSeries` instances or object literals with properties that will define a series.

### `seriesDictionary`

Object

Defined in `input/charts/Graph.js:614`

Read-only hash lookup for all series on in the `Graph`.

### `showBackground`

Boolean

Defined in `input/charts/Graph.js:603`

Indicates whether the `Graph` has a background.

Default: true

### `styles`

Object

Defined in `input/charts/Graph.js:766`

Style properties used for drawing a background. Below are the default values:

background
  An object containing the following values:
  fill
    Defines the style properties for the fill. Contains the following values:
    color
      Color of the fill. The default value is #faf9f2.
    alpha
      Number from 0 to 1 indicating the opacity of the background fill. The default value is 1.
  border
    Defines the style properties for the border. Contains the following values:
    color
      Color of the border. The default value is #dad8c9.
    alpha
      Number from 0 to 1 indicating the opacity of the background border. The default value is 1.
    weight
      Number indicating the width of the border. The default value is 1.

### `verticalGridlines`

Gridlines

Defined in `input/charts/Graph.js:661`

Reference to the vertical `Gridlines` instance.

Default: null

### `x`

Number protected

Defined in `input/charts/Graph.js:544`

The x-coordinate for the graph.

### `y`

Number protected

Defined in `input/charts/Graph.js:559`

The y-coordinate for the graph.