Top
You are looking at an outdated 7.3.1 version of this document. Switch to the 7.14.3 version to see the up to date information.

class anychart.scales.Ordinal Improve this Doc

Extends: anychart.scales.Base

Define Ordinal scale.
Note: To create instance use method anychart.scales.ordinal.

Methods Overview

Miscellaneous
extendDataRange()Extends the current input domain with the passed values (if such don't exist in the domain).
inverseTransform()Returns tick name by its ratio position.
names()Getter for scale ticks names.
ticks()Getter for set of scale ticks in terms of data values.
transform()Returns tick position ratio by its name.
values()Getter for scale input domain.

Methods Description

extendDataRange

Extends the current input domain with the passed values (if such don't exist in the domain). Note: Attention! anychart.scales.Base#finishAutoCalc drops all passed values.

Params:

Name Type Description
var_args * Values that are supposed to extend the input domain.

Returns:

anychart.scales.Ordinal - anychart.scales.Ordinal instance for method chaining.

inverseTransform

Returns tick name by its ratio position.
Note: returns correct values only after anychart.scales.Base#finishAutoCalc or chart.draw().

Params:

Name Type Description
ratio number Value to transform in input scope.

Returns:

* - Value transformed to output scope.

Try it:

names

Getter for scale ticks names.

Returns:

Array.<*> - Current scale ticks names.
Setter for scale ticks names.

Params:

Name Type Description
value Array.<*> | string Array of names or attribute name for data set.

Returns:

anychart.scales.Ordinal - An instance of anychart.scales.Ordinal class for method chaining.

ticks

Getter for set of scale ticks in terms of data values.

Returns:

anychart.scales.OrdinalTicks - An instance of anychart.scales.OrdinalTicks class for method chaining.
Setter for set of scale ticks in terms of data values.

Params:

Name Type Description
value Object | Array An array of indexes of ticks values.

Returns:

anychart.scales.Ordinal - An instance of anychart.scales.Ordinal class for method chaining.

Try it:

transform

Returns tick position ratio by its name.
Note: returns correct values only after anychart.scales.Base#finishAutoCalc or chart.draw().

Params:

Name Type Description
value * Value to transform in input scope.
subRangeRatio number Sub range ratio.

Returns:

number - Value transformed to output scope.

Try it:

values

Getter for scale input domain.

Returns:

Array.<(number|string)> - Current input domain.
Setter for scale input domain.

Params:

Name Type Description
values Array.<*> | * | null Array of values, or values, or null for autocalc.
var_args * Other values, that should be contained in input domain.

Returns:

anychart.scales.Ordinal - An instance of anychart.scales.Ordinal class for method chaining.

Try it: