class anychart.scales.Linear Improve this Doc
Extends: anychart.scales.ScatterBase
The Linear class contains methods for configuring Linear scale.
Represents simple linear scale that transforms values from domain [a, b] to domain [0, 1].
Note that a can be greater than b. The only condition for the scale is that a != b.
Note: To create instance use anychart.scales#linear method.
Methods Overview
Specific settings | |
alignMaximum() | Align maximum settings. |
alignMinimum() | Align minimum settings. |
compareWith() | Changes zero for series. |
comparisonMode() | Scale changes mode. |
extendDataRange() | Extends the current input domain with the passed values (if such don't exist in the domain). |
finishAutoCalc() | Informs the scale that an auto-range calculation started for the chart in past was ended. |
getType() | Returns scale type. |
inverseTransform() | Returns tick by its position ratio. |
inverted() | Inversion state. |
maxTicksCount() | Maximum ticks count. |
maximum() | Scale maximum. |
maximumGap() | Maximum gap settings. |
minimum() | Scale minimum. |
minimumGap() | Minimum gap settings. |
minorTicks() | Minor ticks settings. |
softMaximum() | Soft maximum settings. |
softMinimum() | Soft minimum settings. |
stackDirection() | The stacking direction. |
startAutoCalc() | Informs scale that an auto-range calculation started for the chart, so it should reset its data range on the first |
stickToZero() | Stick to zero. |
ticks() | Ticks settings. |
transform() | Returns tick position ratio by its name. |
Miscellaneous | |
stackMode() | Getter for the stacked mode. |
Methods Description
alignMaximum
Returns:
boolean - Whether to enable maximum alignment by interval.var scale = chart.yScale(); var alignMaximum = scale.alignMaximum();
If set to false, the scale bounds don't align.
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Whether to enable maximum alignment by interval. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
alignMinimum
Returns:
boolean - Whether to enable minimum alignment by interval.var scale = chart.yScale(); var alignMinimum = scale.alignMinimum();
If set to false, the scale bounds don't align.
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Whether to enable minimum alignment by interval. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
compareWith
Returns:
anychart.enums.ScaleCompareWithMode | string | number - Data for the changes zero of the series.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.ScaleCompareWithMode | string | number | Date | 'firstVisible' | Mode to set |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
comparisonMode
Returns:
anychart.enums.ScaleComparisonMode | string - The scale changes mode.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
mode | anychart.enums.ScaleComparisonMode | string | 'none' | Comparison mode to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
extendDataRange
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.Linear - Self instance for method chaining.Try it:
finishAutoCalc
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.getType
inverseTransform
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
Returns:
boolean - The inversion state.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 | Inverted state to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
maxTicksCount
Returns:
number - Maximum ticks count.var maxTicksCount = scale.maxTicksCount();
The method does not summarize both major and minor ticks, considering each separately, but the whole range from minimum to maximum.
If the number of ticks is greater than the passed value, the auto-calculation drops the interval from 4 to 6 ticks.
Params:
Name | Type | Default | Description |
---|---|---|---|
count | number | 1000 | Maximum ticks count to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
maximum
Returns:
number - Scale maximum.var scale = chart.yScale(); var maximum = scale.maximum();
Params:
Name | Type | Default | Description |
---|---|---|---|
maximum | number | null | Maximum value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
maximumGap
Params:
Name | Type | Default | Description |
---|---|---|---|
gap | number | 0.1 | Gap value from 0 to 1. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minimum
Returns:
number - Scale minimum.var scale = chart.yScale(); var minimum = scale.minimum();
Params:
Name | Type | Default | Description |
---|---|---|---|
minimum | number | null | Scale minimum to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minimumGap
Params:
Name | Type | Default | Description |
---|---|---|---|
gap | number | 0.1 | Gap value from 0 to 1. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minorTicks
Returns:
anychart.scales.ScatterTicks - Minor ticks.Try it:
Params:
Name | Type | Description |
---|---|---|
settings | Object | Array | An array or object of ticks to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
softMaximum
Params:
Name | Type | Default | Description |
---|---|---|---|
maximum | number | null | Soft maximum to set |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
softMinimum
Params:
Name | Type | Default | Description |
---|---|---|---|
minimum | number | null | Soft minimum value to set |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
stackDirection
Returns:
anychart.enums.ScaleStackDirection | string - The stacking direction.var stackDirection = scale.stackDirection();
Params:
Name | Type | Default | Description |
---|---|---|---|
direction | anychart.enums.ScaleStackDirection | string | 'direct' | The stacking direction. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
stackMode
Params:
Name | Type | Default | Description |
---|---|---|---|
value | anychart.enums.ScaleStackMode | string | 'none' | Value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.startAutoCalc
Returns:
anychart.scales.Linear - Self instance for method chaining.stickToZero
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Whether to stick to zero. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
ticks
Returns:
anychart.scales.ScatterTicks - Ticks.Try it:
Params:
Name | Type | Description |
---|---|---|
settings | Object | Array | An array or object of ticks to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
transform
Note: returns correct values only after anychart.scales.Base#finishAutoCalc or chart.draw().
Params:
Name | Type | Description |
---|---|---|
value | * | Value to transform in input scope. |
Returns:
number - Value transformed to scope [0, 1].Try it: