# Yahoo! UI Library

### charts 3.3.0

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

## Class Axis - extends Renderer

Known Subclasses:
  AxisType

The Axis class. Generates axes for a chart.

### Constructor

Axis `( )`

### Properties

#### _calculateSizeByTickLength - `private object`

#### _labelCache - `private object`

#### _labels - `private object`

#### _layout - `private object`

#### Properties inherited from Renderer:

`_styles`

### Methods

#### _clearLabelCache

`private void _clearLabelCache ( )`

#### _createLabelCache

`private void _createLabelCache ( )`

#### _dataChangeHandler

`private void _dataChangeHandler ( )`

#### _drawAxis

`private void _drawAxis ( )`

#### _getDefaultStyles

`protected _getDefaultStyles ( )`
Gets the default value for the `styles` attribute. Overrides base implementation.

Returns: ``
  Object

#### _handleSizeChange

`private void _handleSizeChange ( )`

#### _positionChangeHandler

`private void _positionChangeHandler ( )`

#### _setCanvas

`private void _setCanvas ( )`

#### _updateHandler

`private void _updateHandler ( )`

#### drawLine

`private void drawLine ( )`

#### getFirstPoint

`private void getFirstPoint ( )`

#### getLabel

`private void getLabel ( )`

#### getLastPoint

`private void getLastPoint ( )`

#### getLayout

`private void getLayout ( )`

#### getLength

`private void getLength ( )`

#### getLineEnd

`private void getLineEnd ( )`

#### getNextPoint

`private void getNextPoint ( )`

#### getPosition

`private void getPosition ( )`

#### renderUI

`private void renderUI ( )`

#### syncUI

`private void syncUI ( )`

#### Methods inherited from Renderer:

`_getDefaultStyles, _mergeStyles, _setStyles`

### Events

#### bottomTickOffsetChange

`bottomTickOffsetChange ( event )`
Fires when the value for the configuration attribute 'bottomTickOffset' 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

#### edgeOffsetChange

`edgeOffsetChange ( event )`
Fires when the value for the configuration attribute 'edgeOffset' 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

#### graphicChange

`graphicChange ( event )`
Fires when the value for the configuration attribute 'graphic' 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

#### labelFunctionScopeChange

`labelFunctionScopeChange ( event )`
Fires when the value for the configuration attribute 'labelFunctionScope' 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

#### labelsChange

`labelsChange ( event )`
Fires when the value for the configuration attribute 'labels' 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

#### leftTickOffsetChange

`leftTickOffsetChange ( event )`
Fires when the value for the configuration attribute 'leftTickOffset' 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

#### nodeChange

`nodeChange ( event )`
Fires when the value for the configuration attribute 'node' 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

#### overlapGraphChange

`overlapGraphChange ( event )`
Fires when the value for the configuration attribute 'overlapGraph' 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

#### positionChange

`positionChange ( event )`
Fires when the value for the configuration attribute 'position' 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

#### rightTickOffsetChange

`rightTickOffsetChange ( event )`
Fires when the value for the configuration attribute 'rightTickOffset' 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

#### stylesChange

`stylesChange ( event )`
Fires when the value for the configuration attribute 'styles' 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

#### tickPointsChange

`tickPointsChange ( event )`
Fires when the value for the configuration attribute 'tickPoints' 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

#### topTickOffsetChange

`topTickOffsetChange ( event )`
Fires when the value for the configuration attribute 'topTickOffset' 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

#### Events inherited from Renderer:

`graphicChange, stylesChange`

### Configuration Attributes

#### bottomTickOffset `- Number`

Distance determined by the tick styles used to calculate the distance between the axis line in relation to the bottom of the axis.

#### edgeOffset `- protected Number`

Difference betweend the first/last tick and edge of axis.

#### graphic `- Graphic`

The graphic in which the axis line and ticks will be rendered.

#### labelFunctionScope `- Object`

Object which should have by the labelFunction

#### labels `- Array`

Collection of labels used to render the axis.

#### leftTickOffset `- Number`

Distance determined by the tick styles used to calculate the distance between the axis line in relation to the left of the axis.

#### node `- HTMLElement`

Contains the contents of the axis.

#### overlapGraph `- Boolean`

Indicates whether the axis overlaps the graph. If an axis is the inner most axis on a given position and the tick position is inside or cross, the axis will need to overlap the graph.

#### position `- String`

Direction of the axis.

#### rightTickOffset `- Number`

Distance determined by the tick styles used to calculate the distance between the axis line in relation to the right side of the axis.

#### styles `- Object`

Style properties used for drawing an axis. This attribute is inherited from `Renderer`. Below are the default values:

majorTicks
  Properties used for drawing ticks.
  display
    Position of the tick. Possible values are `inside`, `outside`, `cross` and `none`. The default value is `inside`.
  length
    The length (in pixels) of the tick. The default value is 4.
  color
    The color of the tick. The default value is `#dad8c9`
  weight
    Number indicating the width of the tick. The default value is 1.
  alpha
    Number from 0 to 1 indicating the opacity of the tick. The default value is 1.
line
  Properties used for drawing the axis line.
  weight
    Number indicating the width of the axis line. The default value is 1.
  color
    The color of the axis line. The default value is `#dad8c9`.
  alpha
    Number from 0 to 1 indicating the opacity of the tick. The default value is 1.
majorUnit
  Properties used to calculate the `majorUnit` for the axis.
  determinant
    The algorithm used for calculating distance between ticks. The possible options are `count` and `distance`. If the `determinant` is `count`, the axis ticks will spaced so that a specified number of ticks appear on the axis. If the `determinant` is `distance`, the axis ticks will spaced out according to the specified distance. The default value is `count`.
  count
    Number of ticks to appear on the axis when the `determinant` is `count`. The default value is 11.
  distance
    The distance (in pixels) between ticks when the `determinant` is `distance`. The default value is 75.
label
  Properties and styles applied to the axis labels.
  color
    The color of the labels. The default value is `#808080`.
  alpha
    Number between 0 and 1 indicating the opacity of the labels. The default value is 1.
  fontSize
    The font-size of the labels. The default value is 85%
  rotation
    The rotation, in degrees (between -90 and 90) of the labels. The default value is 0.
  margin
    The distance between the label and the axis/tick. Depending on the position of the `Axis`, only one of the properties used.
    top
      Pixel value used for an axis with a `position` of `bottom`. The default value is 4.
    right
      Pixel value used for an axis with a `position` of `left`. The default value is 4.
    bottom
      Pixel value used for an axis with a `position` of `top`. The default value is 4.
    left
      Pixel value used for an axis with a `position` of `right`. The default value is 4.

#### tickPoints `- Array`

Collection of points used for placement of labels and ticks along the axis.

#### topTickOffset `- Number`

Distance determined by the tick styles used to calculate the distance between the axis line in relation to the top of the axis.

#### Configuration attributes inherited from Renderer:

`graphic styles`

Copyright © 2011 Yahoo! Inc. All rights reserved.