# Class: ColorAxis

## Highcharts. ColorAxis

#### new ColorAxis(chart, userOptions)

  The ColorAxis object for inclusion in gradient legends.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `chart` | Highcharts.Chart | The related chart of the color axis.
  `userOptions` | Highcharts.ColorAxisOptions | The color axis options for initialization.

### Extends

- Highcharts.Axis

### Members

#### <readonly> categories :Array.<string>

  If categories are present for the axis, names are used instead of numbers for that axis.

  Since Highcharts 3.0, categories can also be extracted by giving each point a name and setting axis type to `category`. However, if you have multiple series, best practice remains defining the `categories` array.

  ##### Type:

  - Array.<string>
  Inherited From:
    - Highcharts.Axis#categories
  See also:

    - xAxis.categories

#### chart :Highcharts.Chart

  The Chart that the axis belongs to.

  ##### Type:

  - Highcharts.Chart
  Inherited From:
    - Highcharts.Axis#chart

#### coll :string

  The collection where the axis belongs, for example `xAxis`, `yAxis` or `colorAxis`. Corresponds to properties on Chart, for example Highcharts.Chart.xAxis.

  ##### Type:

  - string
  Inherited From:
    - Highcharts.Axis#coll

#### crosshair :boolean|Highcharts.AxisCrosshairOptions

  The processed crosshair options.

  ##### Type:

  - boolean | Highcharts.AxisCrosshairOptions
  Inherited From:
    - Highcharts.Axis#crosshair

#### horiz :boolean|undefined

  Whether the axis is horizontal.

  ##### Type:

  - boolean | undefined
  Inherited From:
    - Highcharts.Axis#horiz

#### isXAxis :boolean|undefined

  Whether the axis is the x-axis.

  ##### Type:

  - boolean | undefined
  Inherited From:
    - Highcharts.Axis#isXAxis

#### len :number

  The length of the axis in terms of pixels.

  ##### Type:

  - number
  Inherited From:
    - Highcharts.Axis#len

#### max :number|undefined

  The maximum value of the axis. In a logarithmic axis, this is the logarithm of the real value, and the real value can be obtained from Highcharts.Axis#getExtremes.

  ##### Type:

  - number | undefined
  Inherited From:
    - Highcharts.Axis#max

#### min :number|undefined

  The minimum value of the axis. In a logarithmic axis, this is the logarithm of the real value, and the real value can be obtained from Highcharts.Axis#getExtremes.

  ##### Type:

  - number | undefined
  Inherited From:
    - Highcharts.Axis#min

#### minorTicks :Highcharts.Dictionary.<Highcharts.Tick>

  List of minor ticks mapped by position on the axis.

  ##### Type:

  - Highcharts.Dictionary.<Highcharts.Tick>
  Inherited From:
    - Highcharts.Axis#minorTicks
  See also:
    - Highcharts.Tick

#### options :Highcharts.AxisOptions

  Current options for the axis after merge of defaults and user's options.

  ##### Type:

  - Highcharts.AxisOptions
  Inherited From:
    - Highcharts.Axis#options

#### pos :number

  The position of the axis in terms of pixels, compared to the chart edge. In a horizontal axis it is the same as `chart.plotLeft` unless the axis is explicitly positioned, and in a default vertical axis it is the same as `chart.plotTop`.

  ##### Type:

  - number
  Inherited From:
    - Highcharts.Axis#pos

#### reversed :boolean

  Whether the axis is reversed. Based on the `axis.reversed`, option, but inverted charts have reversed xAxis by default.

  ##### Type:

  - boolean
  Inherited From:
    - Highcharts.Axis#reversed

#### series :Array.<Highcharts.Series>

  All series associated to the axis.

  ##### Type:

  - Array.<Highcharts.Series>
  Inherited From:
    - Highcharts.Axis#series

#### side :number

  The side on which the axis is rendered. 0 is top, 1 is right, 2 is bottom and 3 is left.

  ##### Type:

  - number
  Inherited From:
    - Highcharts.Axis#side

#### tickPositions :Highcharts.AxisTickPositionsArray|undefined

  Contains the current positions that are laid out on the axis. The positions are numbers in terms of axis values. In a category axis they are integers, in a datetime axis they are also integers, but designating milliseconds.

  This property is read only - for modifying the tick positions, use the `tickPositioner` callback or [axis.tickPositions( https://api.highcharts.com/highcharts/xAxis.tickPositions) option instead.

  ##### Type:

  - Highcharts.AxisTickPositionsArray | undefined
  Inherited From:
    - Highcharts.Axis#tickPositions

#### ticks :Highcharts.Dictionary.<Highcharts.Tick>

  List of major ticks mapped by position on axis.

  ##### Type:

  - Highcharts.Dictionary.<Highcharts.Tick>
  Inherited From:
    - Highcharts.Axis#ticks
  See also:
    - Highcharts.Tick

#### userOptions :Highcharts.AxisOptions

  User's options for this axis without defaults.

  ##### Type:

  - Highcharts.AxisOptions
  Inherited From:
    - Highcharts.Axis#userOptions

### Methods

#### addPlotBand(options)

  Add a plot band after render time.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Highcharts.AxisPlotBandsOptions | A configuration object for the plot band, as defined in xAxis.plotBands.

  Inherited From:
    - Highcharts.Axis#addPlotBand

  ##### Returns:

  Highcharts.PlotLineOrBand | undefined .

  The added plot band, or `undefined` if the options are not valid.

  ##### Try it

  - Toggle the plot band from a button.

#### addPlotLine(options)

  Add a plot line after render time.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Highcharts.AxisPlotLinesOptions | A configuration object for the plot line, as defined in xAxis.plotLines.

  Inherited From:
    - Highcharts.Axis#addPlotLine

  ##### Returns:

  Highcharts.PlotLineOrBand | undefined .

  The added plot line, or `undefined` if the options are not valid.

  ##### Try it

  - Toggle the plot line from a button.

#### addTitle( [display])

  Adds the title defined in axis.options.title.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `display` | boolean | <optional> | Whether or not to display the title.

  Inherited From:
    - Highcharts.Axis#addTitle

#### defaultLabelFormatter(this)

  The default label formatter. The context is a special config object for the label. In apps, use the labels.formatter instead, except when a modification is needed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `this` | Highcharts.AxisLabelsFormatterContextObject | Formatter context of axis label.

  Inherited From:
    - Highcharts.Axis#defaultLabelFormatter

  ##### Returns:

  string .

  The formatted label content.

#### drawCrosshair( [e] [, point])

  Internal function to draw a crosshair.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `e` | Highcharts.PointerEventObject | <optional> | The event arguments from the modified pointer event, extended with `chartX` and `chartY`
  `point` | Highcharts.Point | <optional> | The Point object if the crosshair snaps to points.

  Overrides:
    - Highcharts.Axis#drawCrosshair

  ##### Fires:

  - Highcharts.ColorAxis#event:afterDrawCrosshair
  - Highcharts.ColorAxis#event:drawCrosshair

#### drilldownCategory(x [, originalEvent])

  Drill down to a given category. This is the same as clicking on an axis label. If multiple series with drilldown are present, all will drill down to the given category.

  See also `Point.doDrilldown` for drilling down on a single point instance.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `x` | number |  | The index of the category
  `originalEvent` | global.MouseEvent | <optional> | The original event, used internally.

  Inherited From:
    - Highcharts.Axis#drilldownCategory

  ##### Requires:

  - module:modules/drilldown

  ##### Try it

  - Programmatic drilldown.

#### getExtremes()

  Get the current extremes for the axis.

  Inherited From:
    - Highcharts.Axis#getExtremes

  ##### Returns:

  Highcharts.ExtremesObject .

  An object containing extremes information.

  ##### Try it

  - Report extremes by click on a button.

#### getLinePath(lineWidth)

  Internal function to get the path for the axis line. Extended for polar charts.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `lineWidth` | number | The line width in pixels.

  Inherited From:
    - Highcharts.Axis#getLinePath

  ##### Returns:

  Highcharts.SVGPathArray .

  The SVG path definition in array form.

#### getLinearTickPositions(tickInterval, min, max)

  Internal function to get the tick positions of a linear axis to round values like whole tens or every five.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tickInterval` | number | The normalized tick interval.
  `min` | number | Axis minimum.
  `max` | number | Axis maximum.

  Inherited From:
    - Highcharts.Axis#getLinearTickPositions

  ##### Returns:

  Array.<number> .

  An array of axis values where ticks should be placed.

#### getMinorTickInterval()

  Resolve the new minorTicks/minorTickInterval options into the legacy loosely typed minorTickInterval option.

  Inherited From:
    - Highcharts.Axis#getMinorTickInterval

  ##### Returns:

  number | "auto" | null .

  Legacy option

#### getMinorTickPositions()

  Internal function to return the minor tick positions. For logarithmic axes, the same logic as for major ticks is reused.

  Inherited From:
    - Highcharts.Axis#getMinorTickPositions

  ##### Returns:

  Array.<number> .

  An array of axis values where ticks should be placed.

#### getPlotBandPath(from, to, options)

  Internal function to create the SVG path definition for a plot band.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `from` | number | The axis value to start from.
  `to` | number | The axis value to end on.
  `options` | Highcharts.AxisPlotBandsOptions | Highcharts.AxisPlotLinesOptions | The plotBand or plotLine configuration object.

  Inherited From:
    - Highcharts.Axis#getPlotBandPath

  ##### Returns:

  Highcharts.SVGPathArray .

  The SVG path definition in array form.

#### getPlotLinePath(options)

  Create the path for a plot line that goes from the given value on this axis, across the plot to the opposite side. Also used internally for grid lines and crosshairs.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Highcharts.AxisPlotLinePathOptionsObject | Options for the path.

  Inherited From:
    - Highcharts.Axis#getPlotLinePath

  ##### Returns:

  Highcharts.SVGPathArray | null .

  The SVG path definition for the plot line.

#### getThreshold(threshold)

  Get the zero plane either based on zero or on the min or max value. Used in bar and area plots.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `threshold` | number | The threshold in axis values.

  Inherited From:
    - Highcharts.Axis#getThreshold

  ##### Returns:

  number .

  The translated threshold position in terms of pixels, and corrected to stay within the axis bounds.

#### hasData()

  Returns true if the series has points at all.

  Overrides:
    - Highcharts.Axis#hasData

  ##### Returns:

  boolean .

  True, if the series has points, otherwise false.

#### hideCrosshair()

  Hide the crosshair if visible.

  Inherited From:
    - Highcharts.Axis#hideCrosshair

#### init(chart, userOptions)

  Initializes the color axis.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `chart` | Highcharts.Chart | The related chart of the color axis.
  `userOptions` | Highcharts.ColorAxisOptions | The color axis options for initialization.

  Overrides:
    - Highcharts.Axis#init

#### remove( [redraw])

  Removes the color axis and the related legend item.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `redraw` | boolean | <optional> | true | Whether to redraw the chart following the remove.

  Overrides:
    - Highcharts.Axis#remove

#### removePlotBand(id)

  Remove a plot band by its id.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` | string | The plot band's `id` as given in the original configuration object or in the `addPlotBand` option.

  Inherited From:
    - Highcharts.Axis#removePlotBand

  ##### Try it

  - Remove plot band by id.
  - Toggle the plot band from a button.

#### removePlotLine(id)

  Remove a plot line by its id.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` | string | The plot line's `id` as given in the original configuration object or in the `addPlotLine` option.

  Inherited From:
    - Highcharts.Axis#removePlotLine

  ##### Try it

  - Remove plot line by id.
  - Toggle the plot line from a button.

#### renderLine()

  Render the axis line. Called internally when rendering and redrawing the axis.

  Inherited From:
    - Highcharts.Axis#renderLine

#### renderMinorTick(pos, slideIn)

  Render a minor tick into the given position. If a minor tick already exists in this position, move it.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number | The position in axis values.
  `slideIn` | boolean | Whether the tick should animate in from last computed position

  Inherited From:
    - Highcharts.Axis#renderMinorTick

#### renderTick(pos, i, slideIn)

  Render a major tick into the given position. If a tick already exists in this position, move it.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pos` | number | The position in axis values.
  `i` | number | The tick index.
  `slideIn` | boolean | Whether the tick should animate in from last computed position

  Inherited From:
    - Highcharts.Axis#renderTick

#### setCategories(categories [, redraw])

  Set new axis categories and optionally redraw.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `categories` | Array.<string> |  |  | The new categories.
  `redraw` | boolean | <optional> | true | Whether to redraw the chart.

  Inherited From:
    - Highcharts.Axis#setCategories

  ##### Try it

  - Set categories by click on a button.

#### setExtremes( [min] [, max] [, redraw] [, animation] [, eventArguments])

  Set the minimum and maximum of the axes after render time. If the `startOnTick` and `endOnTick` options are true, the minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to false before calling setExtremes. Also, setExtremes will not allow a range lower than the `minRange` option, which by default is the range of five points.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `min` | number | string | <optional> |  | The new minimum value. For datetime axes, date strings are accepted.
  `max` | number | string | <optional> |  | The new maximum value. For datetime axes, date strings are accepted.
  `redraw` | boolean | <optional> | true | Whether to redraw the chart or wait for an explicit call to Highcharts.Chart#redraw
  `animation` | boolean | Partial.<Highcharts.AnimationOptionsObject> | <optional> | true | Enable or modify animations.
  `eventArguments` | * | <optional> |  | Arguments to be accessed in event handler.

  Inherited From:
    - Highcharts.Axis#setExtremes

  ##### Fires:

  - Highcharts.Axis#event:setExtremes

  ##### Try it

  - Set extremes from a button.
  - Set extremes on a datetime axis.
  - Set extremes off ticks.
  - Set extremes in Highcharts Stock.

#### setTitle(titleOptions [, redraw])

  Update the axis title by options after render time.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `titleOptions` | Highcharts.AxisTitleOptions |  |  | The additional title options.
  `redraw` | boolean | <optional> | true | Whether to redraw the chart after setting the title.

  Inherited From:
    - Highcharts.Axis#setTitle

  ##### Try it

  - Set a new Y axis title.

#### toPixels(value [, paneCoordinates])

  Translate a value in terms of axis units into pixels within the chart.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `value` | number | string |  |  | A value in terms of axis units. For datetime axes, a timestamp or date/time string is accepted.
  `paneCoordinates` | boolean | <optional> | false | Whether to return the pixel coordinate relative to the chart or just the axis/pane itself.

  Inherited From:
    - Highcharts.Axis#toPixels

  ##### Returns:

  number .

  Pixel position of the value on the chart or axis.

#### toValue(pixel [, paneCoordinates])

  Translate a pixel position along the axis to a value in terms of axis units.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `pixel` | number |  |  | The pixel value coordinate.
  `paneCoordinates` | boolean | <optional> | false | Whether the input pixel is relative to the chart or just the axis/pane itself.

  Inherited From:
    - Highcharts.Axis#toValue

  ##### Returns:

  number .

  The axis value.

#### update(newOptions [, redraw])

  Updates a color axis instance with a new set of options. The options are merged with the existing options, so only new or altered options need to be specified.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `newOptions` | Highcharts.ColorAxisOptions |  | The new options that will be merged in with existing options on the color axis.
  `redraw` | boolean | <optional> | Whether to redraw the chart after the color axis is altered. If doing more operations on the chart, it is a good idea to set redraw to `false` and call Highcharts.Chart#redraw after.

  Overrides:
    - Highcharts.Axis#update