class anychart.scales.OrdinalColor Improve this Doc
Extends: anychart.scales.Base
The OrdinalColor class contains methods for configuring Ordinal color scale.
Note: To create instance use anychart.scales#ordinalColor method.
Methods Overview
Specific settings | |
colorToValue() | Returns value for passed color. Value is a middle of its range. |
finishAutoCalc() | Informs the scale that an auto-range calculation started for the chart in past was ended. |
getIndexByValue() | Returns range index relative passed value. |
getProcessedRanges() | Returns processed ranges. |
getRangeByValue() | Returns range for passed value. |
getType() | Returns scale type. |
inverseTransform() | Returns tick value by its ratio position. |
inverted() | Scale inversion. |
names() | Scale names settings. |
ranges() | Scale ranges |
startAutoCalc() | Informs scale that an auto-range calculation started for the chart, so it should reset its data range on the first |
ticks() | Ticks settings. |
transform() | Returns tick position ratio by its value. |
valueToColor() | Converts value to color. Returns color relative to passed value. |
Coloring | |
colors() | Linear gradient settings. |
Methods Description
colorToValue
Returns value for passed color. Value is a middle of its range.
Params:
Name | Type | Description |
---|---|---|
color | string | Color to search value. |
Returns:
number - Middle of searched range.Try it:
colors
Getter for the linear gradient for linear color scale.
Returns:
Array.<string> - The linear gradient.Setter for the linear gradient for linear color scale.
Detailed description
Can be set as single color or gradient as well as array or set of colors or gradients.
Set ranges anychart.scales.OrdinalColor#ranges to see colors.
Params:
Name | Type | Description |
---|---|---|
colors | Array.<string> | Colors set. |
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.Try it:
finishAutoCalc
Informs the scale that an auto-range calculation started for the chart in past was ended.
Params:
Name | Type | Description |
---|---|---|
silently | boolean | If this flag is set, do not dispatch an event if reapplication needed. |
Returns:
boolean - If the calculation changed the scale and it needs to be reapplied.getIndexByValue
Returns range index relative passed value.
Params:
Name | Type | Description |
---|---|---|
value | number | Value to search index. |
Returns:
number - Range index.Try it:
getProcessedRanges
getRangeByValue
Returns range for passed value.
Params:
Name | Type | Description |
---|---|---|
value | number | Value to search its range. |
Returns:
Object - Searched range or null.Try it:
getType
inverseTransform
Returns tick value by its ratio position.
Detailed description
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:
inverted
Setter for the scale inversion.
Detailed description
If the scale is inverted, axes and series go upside-down or right-to-left instead of bottom-to-top and left-to-right.
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Whether to invert the scale. |
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.Try it:
names
Setter for scale names for data set.
Params:
Name | Type | Description |
---|---|---|
names | Array.<*> | string | Array of names or attribute name for data set. |
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.Try it:
ranges
Getter for the scale ranges.
Returns:
Array.<Object> - Scale ranges.Setter for the scale ranges.
Detailed description
Use 'from' and 'to' to set ranges.
Params:
Name | Type | Description |
---|---|---|
ranges | Array.<Object> | An array of the ranges. |
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.Try it:
startAutoCalc
Informs scale that an auto-range calculation started for the chart, so it should reset its data range on the first
call of this method if needed.
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.ticks
Getter for the set of scale ticks in terms of data values.
Returns:
anychart.scales.OrdinalTicks - Ordinal ticks instance.Try it:
Setter for the set of scale ticks in terms of data values.
Params:
Name | Type | Description |
---|---|---|
ticks | Object | Array | An array or object of ticks to set. |
Returns:
anychart.scales.OrdinalColor - Self instance for method chaining.Try it:
transform
Returns tick position ratio by its value.
Detailed description
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 [0, 1] scope.Try it:
valueToColor
Converts value to color. Returns color relative to passed value.
Params:
Name | Type | Description |
---|---|---|
value | number | Value to convert. |
Returns:
string - Returns color in hex representation relative passed value.Try it: