class anychart.scales.DateTimeWithCalendar Improve this Doc
Extends: anychart.scales.ScatterBase
The DateTimeWithCalendar class contains methods for configuring calendar on the DateTime scale.
Methods Overview
Specific settings | |
calendar() | Calendar settings. |
count() | Count settings. |
dateToPix() | Transforms date to pixels. |
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. |
getTicks() | Returns ticks array. |
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. |
pixToDate() | Transforms pixels to date. |
skipHolidays() | Holidays 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 |
startDate() | Start date. |
transform() | Returns tick position ratio by its name. |
unit() | Unit settings. |
unitPixSize() | Unit size settings. |
Methods Description
calendar
count
Setter for the unit count.
Params:
Name | Type | Default | Description |
---|---|---|---|
count | number | 1 | Unit count to set. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it:
dateToPix
Transforms date to pixels.
Params:
Name | Type | Description |
---|---|---|
date | number | Date | Value to transform. |
Returns:
number - Pixel value.Try it:
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.
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.DateTimeWithCalendar - 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.getTicks
Returns ticks array (even indexes are left borders, odd indexes are right borders of the tick)
with a passed interval. Ticks fill space from the fromPix pixel to the toPix pixel (if available).
Params:
Name | Type | Description |
---|---|---|
fromPix | number | "From" pixel. |
toPix | number | "To" pixel. |
unit | anychart.enums.Interval | string | Unit interval. |
count | number | Unit count. |
Returns:
Array.<anychart.scales.DateTimeWithCalendar.Tick> - Returns ticks array.Try it:
getType
inverseTransform
Returns tick by its position ratio.
Note: returns correct values only after anychart.scales.Base#finishAutoCalc or chart.draw().
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
Getter for the scale inversion.
Returns:
boolean - The inversion state.Setter for scale inversion.
If the scale is inverted, axes and series go upside-down or right-to-left instead of bottom-to-top and left-to-right.
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.DateTimeWithCalendar - Self instance for method chaining.Try it:
maxTicksCount
Getter for the maximum ticks count.
Returns:
number - Maximum ticks count. See listing
var maxTicksCount = scale.maxTicksCount();
Setter for the maximum ticks count.
Detailed description
Use this method only if you set the ticks with the anychart.scales.ScatterTicks#interval method.
It is ignored if the number of ticks is set manually via the method anychart.scales.ScatterTicks#count.
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.
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.DateTimeWithCalendar - Self instance for method chaining.Try it:
maximum
Getter for the scale maximum.
Returns:
number - Scale maximum. See listing
var scale = chart.yScale(); var maximum = scale.maximum();
Setter for the scale maximum.
Params:
Name | Type | Default | Description |
---|---|---|---|
maximum | number | null | Maximum value to set. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it:
maximumGap
Getter for the scale maximum gap.
Returns:
number - The scale maximum gap. See listing
var scale = chart.xScale(); var maximumGap = scale.maximumGap();
Setter for the scale maximum gap.
Detailed description
Note: Gap works only if scale minimum is not set explicitly using anychart.scales.ScatterBase#maximum.
Params:
Name | Type | Default | Description |
---|---|---|---|
gap | number | 0.01 | Gap value from 0 to 1. |
Returns:
anychart.scales.DateTime - Self instance for method chaining.Try it:
minimum
Getter for the scale minimum.
Returns:
number - Scale minimum. See listing
var scale = chart.yScale(); var minimum = scale.minimum();
Setter for the scale minimum.
Params:
Name | Type | Default | Description |
---|---|---|---|
minimum | number | null | Scale minimum to set. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it:
minimumGap
Getter for the scale minimum gap.
Returns:
number - The scale minimum gap. See listing
var scale = chart.xScale(); var minimumGap = scale.minimumGap();
Setter for the scale minimum gap.
Detailed description
Note: Gap works only if scale minimum is not set explicitly using anychart.scales.ScatterBase#minimum.
Params:
Name | Type | Default | Description |
---|---|---|---|
gap | number | 0.01 | Gap value from 0 to 1. |
Returns:
anychart.scales.DateTime - Self instance for method chaining.Try it:
pixToDate
Transforms pixels to date.
Params:
Name | Type | Description |
---|---|---|
pix | number | Value to transform. |
Returns:
number - Date value.Try it:
skipHolidays
Getter for skipping of holidays.
Returns:
boolean - State flag. See listing
var flag = scale.skipHolidays();
Setter for skipping of holidays.
Params:
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean | false | Whether to skip holidays. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it:
softMaximum
Getter for the soft maximum.
Returns:
number - Soft maximum. See listing
var scale = chart.xScale(); var maximum = scale.softMaximum();
Setter for the soft maximum.
Detailed description
If data range maximum is less than the soft maximum, the soft maximum value becomes the scale maximum.
Params:
Name | Type | Description |
---|---|---|
maximum | number | Soft maximum value to set |
Returns:
anychart.scales.DateTime - Self instance for method chaining.Try it:
softMinimum
Getter for the soft minimum.
Returns:
number - Soft minimum. See listing
var scale = chart.xScale(); var minimum = scale.softMinimum();
Setter for the soft minimum.
Detailed description
If data range minimum is greater than the soft minimum, the soft minimum value becomes the scale minimum.
Params:
Name | Type | Description |
---|---|---|
minimum | number | Soft minimum value to set |
Returns:
anychart.scales.DateTime - 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.DateTimeWithCalendar - Self instance for method chaining.startDate
transform
Returns tick position ratio by its name.
Note: returns correct values only after anychart.scales.Base#finishAutoCalc or chart.draw().
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:
unit
Getter for the unit interval.
Returns:
anychart.enums.Interval - Unit interval. See listing
var unit = scale.unit();
Setter for the unit interval.
Params:
Name | Type | Default | Description |
---|---|---|---|
interval | anychart.enums.Interval | string | 'day' | Unit interval to set. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it:
unitPixSize
Getter for the unit size.
Returns:
number | string - Unit size. See listing
var size = scale.unitPixSize();
Setter for the unit size.
Params:
Name | Type | Default | Description |
---|---|---|---|
size | number | string | 100 | Unit size to set. |
Returns:
anychart.scales.DateTimeWithCalendar - Self instance for method chaining.Try it: