class anychart.scales.Linear Improve this Doc
Extends: anychart.scales.ScatterBase
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 | |
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. |
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. |
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. |
Events | |
listen() | Adds an event listener. |
listenOnce() | Adds a single time event listener. |
removeAllListeners() | Removes all listeners. |
unlisten() | Removes the listener. |
unlistenByKey() | Removes the listener by the key. |
Miscellaneous | |
stackMode() | Getter for stacked mode. |
Methods Description
compareWith
Returns:
anychart.enums.ScaleCompareWithMode | number - Data for the changes zero of the series.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | anychart.enums.ScaleCompareWithMode | number | Date | "firstVisible" | Value to set |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
comparisonMode
Returns:
anychart.enums.ScaleComparisonMode - The scale changes mode.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | string | anychart.enums.ScaleComparisonMode | "none" | Value 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 - Current inversion state.Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | false | Value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
listen
Note Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. Function that looks like function(event){
// event.actualTarget - actual event target
// event.currentTarget - current event target
// event.iterator - event iterator
// event.originalEvent - original event
// event.point - event point
// event.pointIndex - event point index
} . | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
listenOnce
If the event handler being added already exists, listenOnce will do nothing.
Note In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
Object - Unique key for the listener.Try it:
maximum
Returns:
number - Current scale maximum.Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | null | Value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
maximumGap
Returns:
number - The current scale maximum gap.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0.1 | Value from 0 to 1. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minimum
Returns:
number - Current scale minimum.Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | null | Value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minimumGap
Returns:
number - The current scale minimum gap.Try it:
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | 0.1 | Value from 0 to 1. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
minorTicks
Returns:
anychart.scales.ScatterTicks - Current ticks.Try it:
Params:
Name | Type | Description |
---|---|---|
value | Object | Array | An array of ticks to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
removeAllListeners
Params:
Name | Type | Description |
---|---|---|
type | string | Type of event to remove, default is to remove all types. |
Returns:
number - Number of listeners removed.Try it:
softMaximum
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | null | Value to set |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
softMinimum
Params:
Name | Type | Default | Description |
---|---|---|---|
value | number | null | Value to set |
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 - Chaining.stickToZero
Params:
Name | Type | Default | Description |
---|---|---|---|
value | boolean | true | Value to set. |
Returns:
anychart.scales.Linear - Self instance for method chaining.Try it:
ticks
Returns:
anychart.scales.ScatterTicks - Current ticks.Try it:
Params:
Name | Type | Description |
---|---|---|
value | Object | Array | An array 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:
unlisten
Params:
Name | Type | Default | Description |
---|---|---|---|
type | string | The event type id. | |
listener | function | Callback method. | |
useCapture | boolean | false | Whether to fire in capture phase. Learn more about capturing https://javascript.info/bubbling-and-capturing |
listenerScope | Object | Object in whose scope to call the listener. |
Returns:
boolean - Whether any listener was removed.Try it:
unlistenByKey
Params:
Name | Type | Description |
---|---|---|
key | Object | The key returned by listen() or listenOnce(). |
Returns:
boolean - Whether any listener was removed.Try it: