UNPKG

34.9 kBTypeScriptView Raw
1/**
2 * DateAxis module
3 */
4/**
5 * ============================================================================
6 * IMPORTS
7 * ============================================================================
8 * @hidden
9 */
10import { ValueAxis, ValueAxisDataItem, IValueAxisProperties, IValueAxisDataFields, IValueAxisAdapters, IValueAxisEvents } from "./ValueAxis";
11import { AxisItemLocation } from "./Axis";
12import { AxisRenderer } from "./AxisRenderer";
13import { List } from "../../core/utils/List";
14import { Dictionary } from "../../core/utils/Dictionary";
15import { IPoint, IOrientationPoint } from "../../core/defs/IPoint";
16import { XYSeries, XYSeriesDataItem } from "../series/XYSeries";
17import { LineSeriesDataItem } from "../series/LineSeries";
18import { TimeUnit } from "../../core/defs/TimeUnit";
19import { ITimeInterval } from "../../core/defs/ITimeInterval";
20import { IMinMaxStep } from "./ValueAxis";
21import { DateAxisBreak } from "./DateAxisBreak";
22import { IRange } from "../../core/defs/IRange";
23import { DateFormatter } from "../../core/formatters/DateFormatter";
24import { Animation } from "../../core/utils/Animation";
25/**
26 * ============================================================================
27 * DATA ITEM
28 * ============================================================================
29 * @hidden
30 */
31/**
32 * Defines data item for [[DateAxis]].
33 *
34 * @see {@link DataItem}
35 */
36export declare class DateAxisDataItem extends ValueAxisDataItem {
37 /**
38 * Defines a type of [[Component]] this data item is used for.
39 */
40 _component: DateAxis;
41 /**
42 * Constructor
43 */
44 constructor();
45 /**
46 * Date position of the data item.
47 *
48 * @param date Date
49 */
50 /**
51 * @return Date
52 */
53 date: Date;
54 /**
55 * End date for data item.
56 *
57 * @param date End date
58 */
59 /**
60 * @return End date
61 */
62 endDate: Date;
63}
64/**
65 * ============================================================================
66 * REQUISITES
67 * ============================================================================
68 * @hidden
69 */
70/**
71 * Defines data fields for [[DateAxis]].
72 */
73export interface IDateAxisDataFields extends IValueAxisDataFields {
74 /**
75 * Date.
76 */
77 date?: string;
78}
79/**
80 * Defines properties for [[DateAxis]].
81 */
82export interface IDateAxisProperties extends IValueAxisProperties {
83 /**
84 * If enabled, axis will automatically collapse empty (without data points)
85 * periods of time, i.e. weekends.
86 *
87 * @default false
88 */
89 skipEmptyPeriods?: boolean;
90 /**
91 * Use `periodChangeDateFormats` to apply different formats to the first
92 * label in bigger time unit.
93 *
94 * @default true
95 * @param value Use different format for period beginning?
96 */
97 markUnitChange?: boolean;
98 /**
99 * Should the nearest tooltip be shown if no data item is found on the
100 * current cursor position.
101 *
102 * @default true
103 */
104 snapTooltip?: boolean;
105 /**
106 * A special date format to apply axis tooltips.
107 *
108 * Will use same format as for labels, if not set.
109 */
110 tooltipDateFormat?: string | Intl.DateTimeFormatOptions;
111 /**
112 * Indicates if data should be aggregated to composide data items if there
113 * are more data items in selected range than `groupCount`.
114 *
115 * @default false
116 * @since 4.7.0
117 */
118 groupData?: boolean;
119 /**
120 * Indicates threshold of data items in selected range at which to start
121 * aggregating data items if `groupData = true`.
122 *
123 * @default 200
124 * @since 4.7.0
125 */
126 groupCount?: number;
127 /**
128 * Disables automatic selection of data grouping intervals and always uses
129 * `groupInterval` if set. Works only if `groupData = true`.
130 *
131 * @since 4.9.24
132 */
133 groupInterval?: ITimeInterval;
134 /**
135 * If set will recalculate all timestamps in data by applying specific offset
136 * in minutes.
137 *
138 * IMPORTANT: do not set `timezoneOffset` on both `DateAxis` and `dateFormatter`. It
139 * will skew your results by applying offset twice.
140 *
141 * @since 4.8.5
142 */
143 timezoneOffset?: number;
144 /**
145 * If set will recalculate all timestamps in data to specific named timezone,
146 * e.g. `"America/Vancouver"`, `"Australia/Sydney"`, `"UTC"`, etc.
147 *
148 * IMPORTANT: do not set `timezone` on both `DateAxis` and `dateFormatter`. It
149 * will skew your results by applying timezone twice.
150 *
151 * @since 4.10.1
152 */
153 timezone?: string;
154}
155/**
156 * Defines events for [[DateAxis]].
157 */
158export interface IDateAxisEvents extends IValueAxisEvents {
159 /**
160 * Invoked when data grouping is on and grouping period is changed. You can find our the period via dateAxis.currentDataSetId property.
161 */
162 groupperiodchanged: IDateAxisEvents;
163}
164/**
165 * Defines adapters for [[DateAxis]].
166 *
167 * @see {@link Adapter}
168 */
169export interface IDateAxisAdapters extends IValueAxisAdapters, IDateAxisProperties {
170}
171/**
172 * ============================================================================
173 * MAIN CLASS
174 * ============================================================================
175 * @hidden
176 */
177/**
178 * Used to create a date/time-based axis for the chart.
179 *
180 * ```TypeScript
181 * // Create the axis
182 * let xAxis = chart.xAxes.push(new am4charts.DateAxis());
183 *
184 * // Set settings
185 * xAxis.title.text = "Time";
186 * ```
187 * ```JavaScript
188 * // Create the axis
189 * var valueAxis = chart.xAxes.push(new am4charts.DateAxis());
190 *
191 * // Set settings
192 * valueAxis.title.text = "Time";
193 * ```
194 * ```JSON
195 * "xAxes": [{
196 * "type": "DateAxis",
197 * "title": {
198 * "text": "Time"
199 * }
200 * }]
201 * ```
202 *
203 * @see {@link IDateAxisEvents} for a list of available Events
204 * @see {@link IDateAxisAdapters} for a list of available Adapters
205 * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/} got `DateAxis` documention
206 * @important
207 */
208export declare class DateAxis<T extends AxisRenderer = AxisRenderer> extends ValueAxis<T> {
209 /**
210 * Defines data fields.
211 */
212 _dataFields: IDateAxisDataFields;
213 /**
214 * Defines available properties.
215 */
216 _properties: IDateAxisProperties;
217 /**
218 * Defines available adapters.
219 */
220 _adapter: IDateAxisAdapters;
221 /**
222 * Defines available events.
223 */
224 _events: IDateAxisEvents;
225 /**
226 * Defines the type of the Date Items.
227 */
228 _dataItem: DateAxisDataItem;
229 /**
230 * Defines the type of the axis breaks.
231 */
232 _axisBreak: DateAxisBreak;
233 protected _gapBreaks: boolean;
234 /**
235 * A list of date/time intervals for Date axis.
236 *
237 * This define various granularities available for the axis. For example
238 * if you have an axis spanning an hour, and space for 6 grid lines / labels
239 * the axis will choose the granularity of 10 minutes, displaying a label
240 * every 10 minutes.
241 *
242 * Default intervals:
243 *
244 * ```JSON
245 * [
246 * { timeUnit: "millisecond", count: 1 },
247 * { timeUnit: "millisecond", count: 5 },
248 * { timeUnit: "millisecond", count: 10 },
249 * { timeUnit: "millisecond", count: 50 },
250 * { timeUnit: "millisecond", count: 100 },
251 * { timeUnit: "millisecond", count: 500 },
252 * { timeUnit: "second", count: 1 },
253 * { timeUnit: "second", count: 5 },
254 * { timeUnit: "second", count: 10 },
255 * { timeUnit: "second", count: 30 },
256 * { timeUnit: "minute", count: 1 },
257 * { timeUnit: "minute", count: 5 },
258 * { timeUnit: "minute", count: 10 },
259 * { timeUnit: "minute", count: 30 },
260 * { timeUnit: "hour", count: 1 },
261 * { timeUnit: "hour", count: 3 },
262 * { timeUnit: "hour", count: 6 },
263 * { timeUnit: "hour", count: 12 },
264 * { timeUnit: "day", count: 1 },
265 * { timeUnit: "day", count: 2 },
266 * { timeUnit: "day", count: 3 },
267 * { timeUnit: "day", count: 4 },
268 * { timeUnit: "day", count: 5 },
269 * { timeUnit: "week", count: 1 },
270 * { timeUnit: "month", count: 1 },
271 * { timeUnit: "month", count: 2 },
272 * { timeUnit: "month", count: 3 },
273 * { timeUnit: "month", count: 6 },
274 * { timeUnit: "year", count: 1 },
275 * { timeUnit: "year", count: 2 },
276 * { timeUnit: "year", count: 5 },
277 * { timeUnit: "year", count: 10 },
278 * { timeUnit: "year", count: 50 },
279 * { timeUnit: "year", count: 100 }
280 * ]
281 * ```
282 */
283 gridIntervals: List<ITimeInterval>;
284 /**
285 * If data aggregation is enabled by setting Axis' `groupData = true`, the
286 * chart will try to aggregate data items into grouped data items.
287 *
288 * If there are more data items in selected period than `groupCount`, it will
289 * group data items into bigger period.
290 *
291 * For example seconds might be grouped into 10-second aggregate data items.
292 *
293 * This setting indicates what group intervals can the chart group to.
294 *
295 * Default intervals:
296 *
297 * ```JSON
298 * [
299 * { timeUnit: "millisecond", count: 1},
300 * { timeUnit: "millisecond", count: 10 },
301 * { timeUnit: "millisecond", count: 100 },
302 * { timeUnit: "second", count: 1 },
303 * { timeUnit: "second", count: 10 },
304 * { timeUnit: "minute", count: 1 },
305 * { timeUnit: "minute", count: 10 },
306 * { timeUnit: "hour", count: 1 },
307 * { timeUnit: "day", count: 1 },
308 * { timeUnit: "week", count: 1 },
309 * { timeUnit: "month", count: 1 },
310 * { timeUnit: "year", count: 1 }
311 * ]
312 * ```
313 * `groupData = true` does not work in combination with `skipEmptyPeriods = true`.
314 *
315 * @since 4.7.0
316 * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping} for more information about dynamic data item grouping.
317 */
318 groupIntervals: List<ITimeInterval>;
319 /**
320 * A collection of date formats to use when formatting different time units
321 * on Date/time axis.
322 *
323 * Actual defaults will depend on the language locale set for the chart.
324 *
325 * To override format for a specific time unit, say days, you need to set
326 * the appropriate key to a format string. E.g.:
327 *
328 * ```TypeScript
329 * axis.dateFormats.setKey("day", "MMMM d, yyyy");
330 * ```
331 * ```JavaScript
332 * axis.dateFormats.setKey("day", "MMMM d, yyyy");
333 * ```
334 * ```JSON
335 * "xAxes": [{
336 * "type": "DateAxis",
337 * "dateFormats": {
338 * "day": "MMMM d, yyyy"
339 * }
340 * }]
341 * ```
342 *
343 * @see {@link DateFormatter}
344 */
345 dateFormats: Dictionary<TimeUnit, string | Intl.DateTimeFormatOptions>;
346 /**
347 * These formats are applied to labels that are first in a larger unit.
348 *
349 * For example, if we have a DateAxis with days on it, the first day of month
350 * indicates a break in month - a start of the bigger period.
351 *
352 * For those labels, `periodChangeDateFormats` are applied instead of
353 * `dateFormats`.
354 *
355 * This allows us implement convenient structures, like instead of:
356 *
357 * `Jan 1 - Jan 2 - Jan 3 - ...`
358 *
359 * We can have:
360 *
361 * `Jan - 1 - 2 - 3 - ...`
362 *
363 * This can be disabled by setting `markUnitChange = false`.
364 */
365 periodChangeDateFormats: Dictionary<TimeUnit, string | Intl.DateTimeFormatOptions>;
366 /**
367 * At which intervals grid elements are displayed.
368 */
369 protected _gridInterval: ITimeInterval;
370 /**
371 * [_intervalDuration description]
372 *
373 * @todo Description
374 */
375 protected _intervalDuration: number;
376 /**
377 * [_gridDate description]
378 *
379 * @todo Description
380 */
381 protected _gridDate: Date;
382 /**
383 * [_nextGridUnit description]
384 *
385 * @todo Description
386 */
387 protected _nextGridUnit: TimeUnit;
388 /**
389 * User-defined granularity of data.
390 */
391 protected _baseInterval: ITimeInterval;
392 /**
393 * This is base interval of the main data set.
394 */
395 protected _mainBaseInterval: ITimeInterval;
396 /**
397 * This is base interval of the currently selected data set.
398 */
399 protected _groupInterval: ITimeInterval;
400 /**
401 * Actual interval (granularity) derived from the actual data.
402 */
403 protected _baseIntervalReal: ITimeInterval;
404 /**
405 */
406 protected _prevSeriesTime: {
407 [index: string]: number;
408 };
409 /**
410 * [_minDifference description]
411 *
412 * @todo Description
413 */
414 protected _minDifference: {
415 [index: string]: number;
416 };
417 /**
418 * A function which applies fills to axis cells.
419 *
420 * Default function fills every second fill. You can set this to a function
421 * that follows some other logic.
422 *
423 * Function should accept a [[DateAxisDataItem]] and modify its `axisFill`
424 * property accordingly.
425 */
426 fillRule(dataItem: this["_dataItem"]): void;
427 /**
428 * @ignore
429 */
430 protected _firstWeekDay: number;
431 /**
432 * @ignore
433 */
434 protected _df: DateFormatter;
435 /**
436 * A collection of start timestamps to use as axis' min timestamp for
437 * particular data item item periods.
438 *
439 * @since 4.7.0
440 * @readonly
441 */
442 groupMin: {
443 [index: string]: number;
444 };
445 /**
446 * A collection of start timestamps to use as axis' max timestamp for
447 * particular data item item periods.
448 *
449 * @since 4.7.0
450 * @readonly
451 */
452 groupMax: {
453 [index: string]: number;
454 };
455 /**
456 * Date of the last shown axis tooltip.
457 *
458 * @since 4.9.7
459 * @readonly
460 */
461 tooltipDate: Date;
462 /**
463 * Constructor
464 */
465 constructor();
466 /**
467 * Sets defaults that instantiate some objects that rely on parent, so they
468 * cannot be set in constructor.
469 */
470 protected applyInternalDefaults(): void;
471 /**
472 * Returns a new/empty [[DataItem]] of the type appropriate for this object.
473 *
474 * @see {@link DataItem}
475 * @return Data Item
476 */
477 protected createDataItem(): this["_dataItem"];
478 /**
479 * Returns a new/empty [[AxisBreak]] of the appropriate type.
480 *
481 * @return Axis break
482 */
483 protected createAxisBreak(): this["_axisBreak"];
484 /**
485 * Validates Axis' data items.
486 *
487 * @ignore Exclude from docs
488 */
489 validateDataItems(): void;
490 /**
491 * Handles process after zoom.
492 *
493 * @ignore Exclude from docs
494 * @todo Does nothing?
495 */
496 handleSelectionExtremesChange(): void;
497 /**
498 * Calculates all positions, related to axis as per current zoom.
499 *
500 * @ignore Exclude from docs
501 */
502 calculateZoom(): void;
503 protected findFirst(dataItem: XYSeriesDataItem, time: number, key: string): XYSeriesDataItem;
504 /**
505 * (Re)validates data.
506 *
507 * @ignore Exclude from docs
508 */
509 validateData(): void;
510 /**
511 * @ignore
512 */
513 readonly minDifference: number;
514 /**
515 * [dataChangeUpdate description]
516 *
517 *
518 * @ignore Exclude from docs
519 * @todo Description
520 */
521 seriesDataChangeUpdate(series: XYSeries): void;
522 /**
523 * [postProcessSeriesDataItems description]
524 *
525 * @ignore Exclude from docs
526 * @todo Description
527 */
528 postProcessSeriesDataItems(series?: XYSeries): void;
529 protected seriesGroupUpdate(series: XYSeries): void;
530 /**
531 * Calculates series group data.
532 *
533 * @param series Series
534 * @ignore
535 */
536 groupSeriesData(series: XYSeries): void;
537 /**
538 * @ignore
539 */
540 protected getDFFormatter(): void;
541 /**
542 * [postProcessSeriesDataItem description]
543 *
544 * @ignore Exclude from docs
545 * @todo Description
546 * @param dataItem Data item
547 */
548 postProcessSeriesDataItem(dataItem: XYSeriesDataItem, interval?: ITimeInterval): void;
549 /**
550 * Collapses empty stretches of date/time scale by creating [[AxisBreak]]
551 * elements for them.
552 *
553 * Can be used to automatically remove strethes without data, like weekends.
554 *
555 * No, need to call this manually. It will automatically be done if
556 * `skipEmptyPeriods = true`.
557 *
558 * @ignore Exclude from docs
559 */
560 protected addEmptyUnitsBreaks(): void;
561 /**
562 * Updates positioning of Axis breaks after something changes.
563 *
564 * @ignore Exclude from docs
565 */
566 fixAxisBreaks(): void;
567 /**
568 * @ignore
569 */
570 protected getFirstWeekDay(): number;
571 /**
572 * [getGridDate description]
573 *
574 * @ignore Exclude from docs
575 * @todo Description
576 * @param date [description]
577 * @param intervalCount [description]
578 * @return [description]
579 */
580 getGridDate(date: Date, intervalCount: number): Date;
581 /**
582 * [getBreaklessDate description]
583 *
584 * @ignore Exclude from docs
585 * @todo Description
586 * @param axisBreak [description]
587 * @param timeUnit [description]
588 * @param count [description]
589 * @return [description]
590 */
591 getBreaklessDate(axisBreak: DateAxisBreak, timeUnit: TimeUnit, count: number): Date;
592 /**
593 * (Re)validates all Axis elements.
594 *
595 * @ignore Exclude from docs
596 * @todo Description (review)
597 */
598 validateAxisElements(): void;
599 /**
600 * Validates Axis data item.
601 *
602 * @ignore Exclude from docs
603 * @param dataItem Data item
604 */
605 validateDataElement(dataItem: this["_dataItem"]): void;
606 /**
607 * A duration in milliseconds of the `baseInterval`.
608 *
609 * @return Duration (ms)
610 */
611 readonly baseDuration: number;
612 /**
613 * Adjusts min/max values.
614 *
615 * @ignore Exclude from docs.
616 * @todo Description (review)
617 * @param min Min timestamp
618 * @param max Max timestamp
619 * @return Adjusted min/max step
620 */
621 adjustMinMax(min: number, max: number): IMinMaxStep;
622 /**
623 * Adjusts the minimum timestamp as per cell start location.
624 *
625 * @param value Value
626 * @return Adjusted value
627 */
628 protected fixMin(value: number): number;
629 /**
630 * Adjusts the maximum timestamp as per cell start location.
631 *
632 * @param value Value
633 * @return Adjusted value
634 */
635 protected fixMax(value: number): number;
636 /**
637 * [chooseInterval description]
638 *
639 * @ignore Exclude from docs.
640 * @todo Description
641 * @param index [description]
642 * @param duration [description]
643 * @param gridCount [description]
644 * @return [description]
645 */
646 chooseInterval(index: number, duration: number, gridCount: number, intervals?: List<ITimeInterval>): ITimeInterval;
647 /**
648 * Formats the value according to axis' own [[DateFormatter]].
649 *
650 * @param value Source value
651 * @return Formatted value
652 */
653 formatLabel(value: number): string;
654 /**
655 * Converts a Date to an asbolute pixel position within Axis.
656 *
657 * @param date Date
658 * @return Position (px)
659 */
660 dateToPosition(date: Date): number;
661 /**
662 * Converts a numeric timestamp or a `Date` to a relative position on axis.
663 *
664 * @param date Date or a timestamp
665 * @return Relative position
666 */
667 anyToPosition(date: Date | number): number;
668 /**
669 * Converts date to orientation point (x, y, angle) on axis
670 *
671 * @param date Date
672 * @return IOrientationPoint
673 */
674 dateToPoint(date: Date): IOrientationPoint;
675 /**
676 * Converts a numeric value to orientation (x, y, angle) point on axis
677 *
678 * @param value Value
679 * @return Orientation point
680 */
681 anyToPoint(date: Date | number): IOrientationPoint;
682 /**
683 * Converts pixel position within Axis to a corresponding Date.
684 *
685 * @param position Position (px)
686 * @return Date
687 */
688 positionToDate(position: number): Date;
689 /**
690 * Returns the relative position on axis for series' data item's value.
691 *
692 * @since 4.5.14
693 * @param dataItem Data item
694 * @param key Data field to get value from
695 * @param location Location (0-1)
696 * @return Relative position
697 */
698 getPositionX(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
699 /**
700 * Returns relative position on axis for series' data item's value.
701 *
702 * @since 4.5.14
703 * @param dataItem Data item
704 * @param key Data field to get value from
705 * @param location Location (0-1)
706 * @return Relative position
707 */
708 getPositionY(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
709 /**
710 * Returns an angle for series data item.
711 *
712 * @ignore Exclude from docs
713 * @todo Description (review)
714 * @param dataItem Data item
715 * @param key Data field to get value from
716 * @param location Location (0-1)
717 * @param stackKey Stack ID
718 * @param range Range to fit in
719 * @return Angle
720 */
721 getAngle(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
722 /**
723 * [getTimeByLocation description]
724 *
725 * @ignore Exclude from docs
726 * @todo Description
727 * @param dataItem [description]
728 * @param key [description]
729 * @param location [description]
730 * @return [description]
731 */
732 protected getTimeByLocation(dataItem: XYSeriesDataItem, key: string, location: number): number;
733 /**
734 * Processes a related series' data item.
735 *
736 * @ignore Exclude from docs
737 * @todo Description
738 * @param dataItem Data item
739 */
740 processSeriesDataItem(dataItem: XYSeriesDataItem, axisLetter?: string): void;
741 /**
742 * [updateAxisBySeries description]
743 *
744 * @ignore Exclude from docs
745 * @todo Description
746 */
747 updateAxisBySeries(): void;
748 /**
749 * A base interval (granularity) of data.
750 *
751 * Used to indicate what are the base units of your data.
752 *
753 * For example, if you have a data set that has a data point every 5 minutes,
754 * you may want to set this to `{ timeUnit: "minute", count: 5 }`.
755 *
756 * If not set, the Axis will try to determine the setting by its own, looking
757 * at actual data.
758 *
759 * For best results, try to follow these values for `count`:
760 *
761 * When unit is "month", use 12 / count = round number
762 * When unit is "hour", use 24 / count = round number
763 * When unit is "second" and "minute", use 60 / count = round number
764 *
765 * @param timeInterval base interval
766 */
767 /**
768 * @return Base interval
769 */
770 baseInterval: ITimeInterval;
771 /**
772 * Indicates granularity of the data of source (unaggregated) data.
773 *
774 * @since 4.7.0
775 * @return Granularity of the main data set
776 */
777 readonly mainBaseInterval: ITimeInterval;
778 /**
779 * If enabled, axis will automatically collapse empty (without data points)
780 * periods of time, i.e. weekends.
781 *
782 * An "empty" period is considered a stretch of time in the length of current
783 * `baseInterval` without a single data point in it.
784 *
785 * For each such empty period, axis will automatically create an
786 * [[AxisBreak]]. By default they will be invisible. You can still configure
787 * them by accessing `axis.breaks.template`.
788 *
789 * [More info about breaks](https://www.amcharts.com/docs/v4/concepts/axes/#Breaks).
790 *
791 * Important notes:
792 * * If you set this property to `true`, you can not add your custom axis breaks to this axis anymore.
793 * * Using this feature affects performance. Use only if you need it.
794 * * Setting this to `true` will reset appearance of breaks. If you want to modify appearance, do it *after* you set `skipEmptyPeriods`.
795 * * Some axis label overlapping might happen.
796 * * This setting is not compatible with `groupData = true`.
797 *
798 * @default false
799 * @param value Remove empty stretches of time?
800 */
801 /**
802 * @return Remove empty stretches of time?
803 */
804 skipEmptyPeriods: boolean;
805 /**
806 * A special date format to apply axis tooltips.
807 *
808 * Will use same format as for labels, if not set.
809 *
810 * @param value Date format
811 */
812 /**
813 * @return Date format
814 */
815 tooltipDateFormat: string | Intl.DateTimeFormatOptions;
816 /**
817 * Use `periodChangeDateFormats` to apply different formats to the first
818 * label in bigger time unit.
819 *
820 * @default true
821 * @param value Use different format for period beginning?
822 */
823 /**
824 * @return Use different format for period beginning?
825 */
826 markUnitChange: boolean;
827 /**
828 * Returns text to show in a tooltip, based on specific relative position
829 * within axis.
830 *
831 * The label will be formatted as per [[DateFormatter]] set for the whole
832 * chart, or explicitly for this Axis.
833 *
834 * @ignore Exclude from docs
835 * @param position Position
836 * @return Label (formatted date)
837 */
838 getTooltipText(position: number): string;
839 /**
840 * Takes an absolute position within axis and adjust it to a specific position within base interval. (cell)
841 *
842 * @ignore Exclude from docs
843 * @param position Source position
844 * @param location Location in the cell
845 * @return Adjusted position
846 */
847 roundPosition(position: number, location?: AxisItemLocation, axisLocation?: number): number;
848 /**
849 * Returns an relative position of the start of the cell (period), that specific position value falls into.
850 *
851 * @ignore Exclude from docs
852 * @todo Description (review)
853 * @param position Relative position
854 * @return Cell start relative position
855 */
856 getCellStartPosition(position: number): number;
857 /**
858 * Returns an relative position of the end of the cell (period), that specific position value falls into.
859 *
860 * @ignore Exclude from docs
861 * @todo Description (review)
862 * @param position Relative position
863 * @return Cell end relative position
864 */
865 getCellEndPosition(position: number): number;
866 /**
867 * Returns a Series data item that corresponds to the specific pixel position
868 * of the Axis.
869 *
870 * If `findNearest` (third parameter) is set to `true`, the method will try
871 * to locate nearest available data item if none is found directly under
872 * `position`.
873 *
874 * @param series Series
875 * @param position Position (px)
876 * @param findNearest Should axis try to find nearest tooltip if there is no data item at exact position
877 * @return Data item
878 */
879 getSeriesDataItem(series: XYSeries, position: number, findNearest?: boolean): XYSeriesDataItem;
880 /**
881 * Returns a formatted date based on position in axis scale.
882 *
883 * Please note that `position` represents position within axis which may be
884 * zoomed and not correspond to Cursor's `position`.
885 *
886 * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.
887 *
888 * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.
889 * @param position Relative position on axis (0-1)
890 * @return Position label
891 */
892 getPositionLabel(position: number): string;
893 /**
894 * Returns label date format based on currently used time units
895 *
896 * @return Format
897 */
898 protected getCurrentLabelFormat(): string | Intl.DateTimeFormatOptions;
899 /**
900 * Initializes an Axis renderer.
901 *
902 * @ignore Exclude from docs
903 */
904 initRenderer(): void;
905 /**
906 * Coordinates of the actual axis start.
907 *
908 * @ignore Exclude from docs
909 * @return Base point
910 */
911 readonly basePoint: IPoint;
912 /**
913 * @ignore
914 */
915 protected animateMinMax(min: number, max: number): Animation;
916 /**
917 * Invalidates axis data items when series extremes change
918 */
919 protected handleExtremesChange(): void;
920 /**
921 * Zooms axis to specific Dates.
922 *
923 * @param startDate Start date
924 * @param endValue End date
925 * @param skipRangeEvent Do not invoke events
926 * @param instantly Do not play zoom animations
927 */
928 zoomToDates(startDate: Date, endDate: Date, skipRangeEvent?: boolean, instantly?: boolean, adjust?: boolean): void;
929 /**
930 * Zooms axis to specific values.
931 *
932 * @param startValue Start value
933 * @param endValue End value
934 * @param skipRangeEvent Do not invoke events
935 * @param instantly Do not play zoom animations
936 */
937 zoomToValues(startValue: number, endValue: number, skipRangeEvent?: boolean, instantly?: boolean, adjust?: boolean): void;
938 /**
939 * Adds `baseInterval` to "as is" fields.
940 *
941 * @param field Field name
942 * @return Assign as is?
943 */
944 protected asIs(field: string): boolean;
945 /**
946 * Copies all properties and related data from a different instance of Axis.
947 *
948 * @param source Source Axis
949 */
950 copyFrom(source: this): void;
951 /**
952 * Shows Axis tooltip at specific relative position within Axis. (0-1)
953 *
954 * @param position Position (0-1)
955 * @param local or global position
956 */
957 showTooltipAtPosition(position: number, local?: boolean): void;
958 /**
959 * Should the nearest tooltip be shown if no data item is found on the
960 * current cursor position.
961 *
962 * @default true
963 * @param value Should snap?
964 */
965 /**
966 * @return Should snap?
967 */
968 snapTooltip: boolean;
969 /**
970 * Indicates if data should be aggregated to composide data items if there
971 * are more data items in selected range than `groupCount`.
972 *
973 * Grouping will occur automatically, based on current selection range, and
974 * will change dynamically when user zooms in/out the chart.
975 *
976 * NOTE: This works only if [[DateAxis]] is base axis of an [[XYSeries]].
977 *
978 * The related [[XYSeries]] also needs to be set up to take advantage of, by
979 * setting its [`groupFields`](https://www.amcharts.com/docs/v4/reference/xyseries/#groupFields_property).
980 *
981 * The group intervals to aggregate data to is defined by `groupIntervals`
982 * property.
983 *
984 * ```TypeScript
985 * let dateAxis = chart.xAxes.push(new am4charts.DateAxis());
986 * dateAxis.groupData = true;
987 *
988 * let valueAxis = chart.xAxes.push(new am4charts.valueAxis());
989 *
990 * let series = chart.series.push(new am4charts.LineSeries());
991 * series.dataFields.dateX = "date";
992 * series.dataFields.valueY = "value";
993 * series.groupFields.valueY = "average";
994 * ```
995 * ```JavaScript
996 * var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
997 * dateAxis.groupData = true;
998 *
999 * var valueAxis = chart.xAxes.push(new am4charts.valueAxis());
1000 *
1001 * var series = chart.series.push(new am4charts.LineSeries());
1002 * series.dataFields.dateX = "date";
1003 * series.dataFields.valueY = "value";
1004 * series.groupFields.valueY = "average";
1005 * ```
1006 * ```JSON
1007 * {
1008 * // ...
1009 * "xAxes": [{
1010 * "type": "DateAxis",
1011 * "groupData": true
1012 * }],
1013 * "yAxes": [{
1014 * "type": "ValueAxis"
1015 * }],
1016 * "series": [{
1017 * "type": "LineSeries",
1018 * "dataFields": {
1019 * "dateX": "date",
1020 * "valueY": "value"
1021 * },
1022 * "groupFields": {
1023 * "valueY": "average"
1024 * }
1025 * }]
1026 * }
1027 * ```
1028 *
1029 * @default false
1030 * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/date-axis/#Dynamic_data_item_grouping} for more information about dynamic data item grouping.
1031 * @since 4.7.0
1032 * @param value Group data points?
1033 */
1034 /**
1035 * @return Group data points?
1036 */
1037 groupData: boolean;
1038 /**
1039 * Disables automatic selection of data grouping intervals and always uses
1040 * `groupInterval` if set. Works only if `groupData = true`.
1041 *
1042 * @since 4.9.24
1043 * @param value Interval
1044 */
1045 /**
1046 * @return Interval
1047 */
1048 groupInterval: ITimeInterval;
1049 /**
1050 * Indicates threshold of data items in selected range at which to start
1051 * aggregating data items if `groupData = true`.
1052 *
1053 * @default 200
1054 * @since 4.7.0
1055 * @param value Number of data items
1056 */
1057 /**
1058 * @return Number of data items
1059 */
1060 groupCount: number;
1061 /**
1062 * If set will recalculate all timestamps in data by applying specific offset
1063 * in minutes.
1064 *
1065 * IMPORTANT: do not set `timezoneOffset` on both `DateAxis` and `dateFormatter`. It
1066 * will skew your results by applying offset twice.
1067 *
1068 * @since 4.8.5
1069 * @param value Time zone offset in minutes
1070 */
1071 /**
1072 * @todo Timezone offset in minutes
1073 */
1074 timezoneOffset: number;
1075 /**
1076 * If set will recalculate all timestamps in data to specific named timezone,
1077 * e.g. `"America/Vancouver"`, `"Australia/Sydney"`, `"UTC"`, etc.
1078 *
1079 * IMPORTANT: it is no longer recommended to use this setting. Please
1080 * set`timezone` on `dateFormatter`.
1081 *
1082 * @deprecated
1083 * @since 4.10.1
1084 * @param value Time zone
1085 */
1086 /**
1087 * @return Timezone
1088 */
1089 timezone: string;
1090 /**
1091 * Current grid interval.
1092 *
1093 * @return Grid interval
1094 */
1095 readonly gridInterval: ITimeInterval;
1096 /**
1097 * @ignore
1098 */
1099 makeGap(dataItem: LineSeriesDataItem, previous: LineSeriesDataItem): boolean;
1100 /**
1101 * @return base value
1102 */
1103 readonly baseValue: number;
1104}
1105
\No newline at end of file