1 | /**
|
2 | * Value Axis module
|
3 | */
|
4 | /**
|
5 | * ============================================================================
|
6 | * IMPORTS
|
7 | * ============================================================================
|
8 | * @hidden
|
9 | */
|
10 | import { Axis, AxisDataItem, IAxisProperties, IAxisDataFields, IAxisAdapters, IAxisEvents } from "./Axis";
|
11 | import { AxisRenderer } from "./AxisRenderer";
|
12 | import { List } from "../../core/utils/List";
|
13 | import { IPoint, IOrientationPoint } from "../../core/defs/IPoint";
|
14 | import { IDisposer } from "../../core/utils/Disposer";
|
15 | import { XYChart } from "../types/XYChart";
|
16 | import { XYSeries, XYSeriesDataItem } from "../series/XYSeries";
|
17 | import { ValueAxisBreak } from "./ValueAxisBreak";
|
18 | import { Animation } from "../../core/utils/Animation";
|
19 | import { IRange } from "../../core/defs/IRange";
|
20 | /**
|
21 | * ============================================================================
|
22 | * DATA ITEM
|
23 | * ============================================================================
|
24 | * @hidden
|
25 | */
|
26 | /**
|
27 | * Defines a [[DataItem]] for [[ValueAxis]].
|
28 | *
|
29 | * @see {@link DataItem}
|
30 | */
|
31 | export declare class ValueAxisDataItem extends AxisDataItem {
|
32 | /**
|
33 | * Defines a type of [[Component]] this data item is used for.
|
34 | */
|
35 | _component: ValueAxis;
|
36 | /**
|
37 | * Constructor
|
38 | */
|
39 | constructor();
|
40 | /**
|
41 | * A data point's numeric value.
|
42 | *
|
43 | * @param value Value
|
44 | */
|
45 | /**
|
46 | * @return Value
|
47 | */
|
48 | value: number;
|
49 | /**
|
50 | * Data point's numeric end value.
|
51 | *
|
52 | * @param value End value
|
53 | */
|
54 | /**
|
55 | * @return Value
|
56 | */
|
57 | endValue: number;
|
58 | }
|
59 | /**
|
60 | * ============================================================================
|
61 | * REQUISITES
|
62 | * ============================================================================
|
63 | * @hidden
|
64 | */
|
65 | /**
|
66 | */
|
67 | export interface IMinMaxStep {
|
68 | min: number;
|
69 | max: number;
|
70 | step: number;
|
71 | }
|
72 | /**
|
73 | * Defines data fields for [[ValueAxis]].
|
74 | */
|
75 | export interface IValueAxisDataFields extends IAxisDataFields {
|
76 | }
|
77 | /**
|
78 | * Defines properties for [[ValueAxis]].
|
79 | */
|
80 | export interface IValueAxisProperties extends IAxisProperties {
|
81 | strictMinMax?: boolean;
|
82 | logarithmic?: boolean;
|
83 | maxPrecision?: number;
|
84 | adjustLabelPrecision?: boolean;
|
85 | extraTooltipPrecision?: number;
|
86 | extraMin?: number;
|
87 | extraMax?: number;
|
88 | keepSelection?: boolean;
|
89 | includeRangesInMinMax?: boolean;
|
90 | syncWithAxis?: ValueAxis;
|
91 | treatZeroAs?: number;
|
92 | }
|
93 | /**
|
94 | * Defines events for [[ValueAxis]].
|
95 | */
|
96 | export interface IValueAxisEvents extends IAxisEvents {
|
97 | /**
|
98 | * Invoked when selection/zoom on axis occurs and start/end coordinates
|
99 | * change.
|
100 | */
|
101 | selectionextremeschanged: {};
|
102 | /**
|
103 | * Invoked when start/end coordinates of the axis change.
|
104 | */
|
105 | extremeschanged: {};
|
106 | }
|
107 | /**
|
108 | * Defines adapters for [[ValueAxis]].
|
109 | *
|
110 | * @see {@link Adapter}
|
111 | */
|
112 | export interface IValueAxisAdapters extends IAxisAdapters, IValueAxisProperties {
|
113 | /**
|
114 | * Applied to the base value of the axis
|
115 | */
|
116 | baseValue: number;
|
117 | /**
|
118 | * Applied to the min value of the axis
|
119 | */
|
120 | min: number;
|
121 | /**
|
122 | * Applied to the max value of the axis
|
123 | */
|
124 | max: number;
|
125 | }
|
126 | /**
|
127 | * ============================================================================
|
128 | * MAIN CLASS
|
129 | * ============================================================================
|
130 | * @hidden
|
131 | */
|
132 | /**
|
133 | * Used to create a value axis for the chart.
|
134 | *
|
135 | * ```TypeScript
|
136 | * // Create the axis
|
137 | * let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
|
138 | *
|
139 | * // Set settings
|
140 | * valueAxis.title.text = "Monthly Sales";
|
141 | * ```
|
142 | * ```JavaScript
|
143 | * // Create the axis
|
144 | * var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
|
145 | *
|
146 | * // Set settings
|
147 | * valueAxis.title.text = "Monthly Sales";
|
148 | * ```
|
149 | * ```JSON
|
150 | * "yAxes": [{
|
151 | * "type": "ValueAxis",
|
152 | * "title": {
|
153 | * "text": "Monthly Sales"
|
154 | * }
|
155 | * }]
|
156 | * ```
|
157 | *
|
158 | * @see {@link IValueAxisEvents} for a list of available Events
|
159 | * @see {@link IValueAxisAdapters} for a list of available Adapters
|
160 | * @important
|
161 | */
|
162 | export declare class ValueAxis<T extends AxisRenderer = AxisRenderer> extends Axis<T> {
|
163 | /**
|
164 | * Defines data fields.
|
165 | */
|
166 | _dataFields: IValueAxisDataFields;
|
167 | /**
|
168 | * Defines available properties.
|
169 | */
|
170 | _properties: IValueAxisProperties;
|
171 | /**
|
172 | * Defines available adapters.
|
173 | */
|
174 | _adapter: IValueAxisAdapters;
|
175 | /**
|
176 | * Defines the type of the Date Items.
|
177 | */
|
178 | _dataItem: ValueAxisDataItem;
|
179 | /**
|
180 | * Defines the type of the axis breaks.
|
181 | */
|
182 | _axisBreak: ValueAxisBreak;
|
183 | /**
|
184 | * Defines available events.
|
185 | */
|
186 | _events: IValueAxisEvents;
|
187 | /**
|
188 | * A reference to chart the axis is for.
|
189 | */
|
190 | chart: XYChart;
|
191 | /**
|
192 | * A list of Series that are using this Axis.
|
193 | */
|
194 | series: List<XYSeries>;
|
195 | /**
|
196 | * Minimum value for the axis scale.
|
197 | */
|
198 | protected _min: number;
|
199 | /**
|
200 | * Maximum value for the axis scale.
|
201 | */
|
202 | protected _max: number;
|
203 | /**
|
204 | * User-defined min value for axis.
|
205 | */
|
206 | protected _minDefined: number;
|
207 | /**
|
208 | * User-defined max value for axis.
|
209 | */
|
210 | protected _maxDefined: number;
|
211 | /**
|
212 | * [_minAdjusted description]
|
213 | *
|
214 | * @todo Description
|
215 | */
|
216 | protected _minAdjusted: number;
|
217 | /**
|
218 | * [_maxAdjusted description]
|
219 | *
|
220 | * @todo Description
|
221 | */
|
222 | protected _maxAdjusted: number;
|
223 | /**
|
224 | * Min real value. (lowest value of all data points)
|
225 | */
|
226 | protected _minReal: number;
|
227 | /**
|
228 | * Max real value. (highest value of all data points)
|
229 | */
|
230 | protected _maxReal: number;
|
231 | /**
|
232 | * Min value within current zoom.
|
233 | */
|
234 | protected _minZoomed: number;
|
235 | /**
|
236 | * Max value within current zoom.
|
237 | */
|
238 | protected _maxZoomed: number;
|
239 | /**
|
240 | * [_step description]
|
241 | *
|
242 | * @todo Description
|
243 | */
|
244 | protected _step: number;
|
245 | /**
|
246 | * [_stepDecimalPlaces description]
|
247 | *
|
248 | * @todo Description
|
249 | */
|
250 | protected _stepDecimalPlaces: number;
|
251 | protected _prevStepDecimalPlaces: number;
|
252 | protected _adjustLabelPrecision: boolean;
|
253 | /**
|
254 | * [_difference description]
|
255 | *
|
256 | * @todo Description
|
257 | */
|
258 | protected _difference: number;
|
259 | /**
|
260 | * Base value for the axis.
|
261 | */
|
262 | protected _baseValue: number;
|
263 | /**
|
264 | * [_previousValue description]
|
265 | *
|
266 | * @todo Description
|
267 | */
|
268 | protected _previousValue: number;
|
269 | /**
|
270 | * [_previousPoint description]
|
271 | *
|
272 | * @todo Description
|
273 | */
|
274 | protected _previousPoint: IPoint;
|
275 | /**
|
276 | * Adjusted start in case we have breaks.
|
277 | *
|
278 | * @todo Description
|
279 | */
|
280 | protected _adjustedStart: number;
|
281 | /**
|
282 | * Adjusted end in case we have breaks.
|
283 | *
|
284 | * @todo Description
|
285 | */
|
286 | protected _adjustedEnd: number;
|
287 | protected _finalMin: number;
|
288 | protected _finalMax: number;
|
289 | protected _extremesChanged: boolean;
|
290 | protected _deltaMinMax: number;
|
291 | protected _dsc: boolean;
|
292 | /**
|
293 | * Holds reference to a function that accepts a DataItem as parameter.
|
294 | *
|
295 | * It can either return a fill opacity for a fill, or manipulate data item
|
296 | * directly, to create various highlighting scenarios.
|
297 | */
|
298 | fillRule(dataItem: this["_dataItem"]): void;
|
299 | /**
|
300 | * As calculating totals is expensive operation and not often needed, we
|
301 | * don't do it by default.
|
302 | *
|
303 | * In case you use `totalPercent` or `total` in your charts, this must be set
|
304 | * to `true`.
|
305 | *
|
306 | * @default false
|
307 | * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/#100_stacks} For using `calculateTotals` for 100% stacked series.
|
308 | * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-strings/#Placeholders_for_numeric_values} For using `calculateTotals` in labels.
|
309 | */
|
310 | calculateTotals: boolean;
|
311 | protected _minMaxAnimation: Animation;
|
312 | /**
|
313 | * Constructor
|
314 | */
|
315 | constructor();
|
316 | /**
|
317 | * Returns a new/empty [[DataItem]] of the type appropriate for this object.
|
318 | *
|
319 | * @see { DataItem}
|
320 | * Data Item
|
321 | */
|
322 | protected createDataItem(): this["_dataItem"];
|
323 | /**
|
324 | * Returns a new/empty [[AxisBreak]] of the appropriate type.
|
325 | *
|
326 | * @return Axis break
|
327 | */
|
328 | protected createAxisBreak(): this["_axisBreak"];
|
329 | /**
|
330 | * [dataChangeUpdate description]
|
331 | *
|
332 | * This is a placeholder to override for extending classes.
|
333 | *
|
334 | * @ignore Exclude from docs
|
335 | * @todo Description
|
336 | */
|
337 | dataChangeUpdate(): void;
|
338 | /**
|
339 | * Processes data items of the related Series.
|
340 | *
|
341 | * @ignore Exclude from docs
|
342 | */
|
343 | processSeriesDataItems(): void;
|
344 | /**
|
345 | * Validates the whole axis. Causes it to redraw.
|
346 | *
|
347 | * @ignore Exclude from docs
|
348 | * @todo Description (review)
|
349 | */
|
350 | validate(): void;
|
351 | /**
|
352 | * Calculates all positions, related to axis as per current zoom.
|
353 | *
|
354 | * @ignore Exclude from docs
|
355 | */
|
356 | calculateZoom(): void;
|
357 | protected fixSmallStep(step: number): number;
|
358 | /**
|
359 | * Validates Axis elements.
|
360 | *
|
361 | * @ignore Exclude from docs
|
362 | * @todo Description
|
363 | */
|
364 | validateAxisElements(): void;
|
365 | /**
|
366 | * Validates axis data item.
|
367 | *
|
368 | * @ignore Exclude from docs
|
369 | * @todo Description
|
370 | * @param dataItem Data item
|
371 | */
|
372 | validateDataElement(dataItem: this["_dataItem"]): void;
|
373 | /**
|
374 | * Formats the value according to axis' own [[NumberFormatter]].
|
375 | *
|
376 | * @param value Source value
|
377 | * @return Formatted value
|
378 | */
|
379 | formatLabel(value: number): string;
|
380 | /**
|
381 | * Coordinates of the actual axis start.
|
382 | *
|
383 | * @ignore Exclude from docs
|
384 | * @return Base point
|
385 | */
|
386 | readonly basePoint: IPoint;
|
387 | /**
|
388 | * A base value.
|
389 | *
|
390 | * This is a threshold value that will divide "positive" and "negative"
|
391 | * value ranges.
|
392 | *
|
393 | * Other scale-related functionality also depend on base value. E.g. stacks,
|
394 | * value-dependent coloring, etc.
|
395 | *
|
396 | * @param value Base value
|
397 | */
|
398 | /**
|
399 | * @return base value
|
400 | */
|
401 | baseValue: number;
|
402 | /**
|
403 | * Converts a numeric value to relative position on axis
|
404 | *
|
405 | * An alias to `valueToPosition()`.
|
406 | *
|
407 | * @param value Value
|
408 | * @return Position
|
409 | */
|
410 | anyToPosition(value: number): number;
|
411 | /**
|
412 | * Converts a numeric value to orientation point (x, y, angle) on axis
|
413 | *
|
414 | * @param value Value
|
415 | * @return Orientation point
|
416 | */
|
417 | valueToPoint(value: number): IOrientationPoint;
|
418 | /**
|
419 | * Converts a numeric value to orientation (x, y, angle) point on axis
|
420 | *
|
421 | * @param value Value
|
422 | * @return Orientation point
|
423 | */
|
424 | anyToPoint(value: number): IOrientationPoint;
|
425 | /**
|
426 | * Converts a numeric value to relative position on axis.
|
427 | *
|
428 | * @param value Value
|
429 | * @return relative position
|
430 | */
|
431 | valueToPosition(value: number): number;
|
432 | /**
|
433 | * When fontSize of fontFamily changes we need to hard-invalidate all Labels of this container to position them properly.
|
434 | */
|
435 | invalidateLabels(): void;
|
436 | /**
|
437 | * Converts an relative position to a corresponding value within
|
438 | * axis' scale.
|
439 | *
|
440 | * @param position Position (px)
|
441 | * @return Value
|
442 | */
|
443 | positionToValue(position: number): number;
|
444 | /**
|
445 | * Converts an X coordinate to a relative value in axis' scale.
|
446 | *
|
447 | * @param x X (px)
|
448 | * @return Value
|
449 | */
|
450 | xToValue(x: number): number;
|
451 | /**
|
452 | * Converts an Y coordinate to a relative value in axis' scale.
|
453 | *
|
454 | * @param y Y (px)
|
455 | * @return Value
|
456 | */
|
457 | yToValue(y: number): number;
|
458 | /**
|
459 | * Converts pixel coordinates to a relative position. (0-1)
|
460 | *
|
461 | * @param point Coorinates (px)
|
462 | * @return Position (0-1)
|
463 | */
|
464 | pointToPosition(point: IPoint): number;
|
465 | /**
|
466 | * @ignore
|
467 | */
|
468 | protected animateMinMax(min: number, max: number): Animation;
|
469 | /**
|
470 | * Calculates smallest and biggest value for the axis scale.
|
471 | * @ignore
|
472 | * @todo Description (review)
|
473 | */
|
474 | getMinMax(): void;
|
475 | /**
|
476 | * Adjusts the minimum value.
|
477 | *
|
478 | * This is a placeholder method for extending classes to override.
|
479 | *
|
480 | * For numeric values this does nothing, however for more complex types, like
|
481 | * dates, it may be necessary to adjust.
|
482 | *
|
483 | * @param value Value
|
484 | * @return Adjusted value
|
485 | */
|
486 | protected fixMin(value: number): number;
|
487 | /**
|
488 | * Adjusts the maximum value.
|
489 | *
|
490 | * This is a placeholder method for extending classes to override.
|
491 | *
|
492 | * For numeric values this does nothing, however for more complex types, like
|
493 | * dates, it may be necessary to adjust.
|
494 | *
|
495 | * @param value Value
|
496 | * @return Adjusted value
|
497 | */
|
498 | protected fixMax(value: number): number;
|
499 | /**
|
500 | * Adjusts actual min and max scale values so that the axis starts and ends
|
501 | * at "nice" values, unless `strictMinMax` is set.
|
502 | *
|
503 | * The `difference` can be something else than `max - min`, because of the
|
504 | * axis breaks.
|
505 | *
|
506 | * @ignore Exclude from docs
|
507 | * @todo Description
|
508 | * @param min [description]
|
509 | * @param max [description]
|
510 | * @param difference [description]
|
511 | * @param gridCount [description]
|
512 | * @param strictMode [description]
|
513 | * @return [description]
|
514 | */
|
515 | adjustMinMax(min: number, max: number, difference: number, gridCount: number, strictMode?: boolean): IMinMaxStep;
|
516 | /**
|
517 | * A minimum value for the axis scale.
|
518 | *
|
519 | * This value might be auto-adjusted by the Axis in order to accomodate the
|
520 | * grid nicely, i.e. plot area is divided by grid in nice equal cells.
|
521 | *
|
522 | * The above might be overridden by `strictMinMax` which will force exact
|
523 | * user-defined min and max values to be used for scale.
|
524 | *
|
525 | * @param value Min value
|
526 | */
|
527 | /**
|
528 | * @return Min value
|
529 | */
|
530 | min: number | undefined;
|
531 | /**
|
532 | * Min value as defined by user's code, not auto-calculated.
|
533 | *
|
534 | * @readonly
|
535 | * @return Min value
|
536 | */
|
537 | readonly minDefined: number;
|
538 | /**
|
539 | * Max value as defined by user's code, not auto-calculated.
|
540 | *
|
541 | * @readonly
|
542 | * @return Man value
|
543 | */
|
544 | readonly maxDefined: number;
|
545 | /**
|
546 | * Allows relatively adjusting minimum value of the axis' scale.
|
547 | *
|
548 | * The value is relative to the actual range of values currently displayed
|
549 | * on the axis.
|
550 | *
|
551 | * E.g.: 0.5 will mean half of the current range. If we have axis displaying
|
552 | * from 100 to 200, we will now have axis displaying from 50 to 200 because
|
553 | * we asked to expand minimum value by 50% (0.5).
|
554 | *
|
555 | * NOTE: this setting is not compatible with `strictMinMax`.
|
556 | *
|
557 | * @param {number}
|
558 | */
|
559 | /**
|
560 | * @return {number}
|
561 | */
|
562 | extraMin: number;
|
563 | /**
|
564 | * Allows relatively adjusting maximum value of the axis' scale.
|
565 | *
|
566 | * The value is relative to the actual range of values currently displayed
|
567 | * on the axis.
|
568 | *
|
569 | * E.g.: 0.5 will mean half of the current range. If we have axis displaying
|
570 | * from 100 to 200, we will now have axis displaying from 100 to 250 because
|
571 | * we asked to expand maximum value by 50% (0.5).
|
572 | *
|
573 | * NOTE: this setting is not compatible with `strictMinMax`.
|
574 | *
|
575 | * @param {number}
|
576 | */
|
577 | /**
|
578 | * @return Min multiplier
|
579 | */
|
580 | extraMax: number;
|
581 | /**
|
582 | * Current calculated delta in values between two adjacent grid lines (step).
|
583 | *
|
584 | * This is a read-only value and cannot be used to set actual step.
|
585 | *
|
586 | * @readonly
|
587 | * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/#Setting_the_density_of_the_the_grid_labels} For more information about modifying density of labels
|
588 | * @return [description]
|
589 | */
|
590 | readonly step: number;
|
591 | /**
|
592 | * A maximum value for the axis scale.
|
593 | *
|
594 | * This value might be auto-adjusted by the Axis in order to accomodate the
|
595 | * grid nicely, i.e. plot area is divided by grid in nice equal cells.
|
596 | *
|
597 | * The above might be overridden by `strictMinMax` which will force exact
|
598 | * user-defined min and max values to be used for scale.
|
599 | *
|
600 | * @param value Max value
|
601 | */
|
602 | /**
|
603 | * @return Max value
|
604 | */
|
605 | max: number | undefined;
|
606 | /**
|
607 | * By default the axis will adjust precision of all numbers to match number
|
608 | * of decimals in all its labels, e.g.: `1.0`, `1.5`, `2.0`.
|
609 | *
|
610 | * To disable set `adjustLabelPrecision` to `false`, to use whatever other
|
611 | * precision or number format settings are set.
|
612 | *
|
613 | * IMPORTANT: This setting will be ignored if your number format uses
|
614 | * modifiers, e.g. `"#a"`.
|
615 | *
|
616 | * @default true
|
617 | * @since 4.9.14
|
618 | * @param value Adjust precision
|
619 | */
|
620 | /**
|
621 | * @return Adjust precision
|
622 | */
|
623 | adjustLabelPrecision: boolean;
|
624 | /**
|
625 | * Used for the Series to register itself as the user of this Axis.
|
626 | *
|
627 | * This will also decorate both the Series and Axis with event handlers, used
|
628 | * to redraw on Axis position/zoom change.
|
629 | *
|
630 | * A disposer for those events is returned, so that they can be disposed
|
631 | * together with Series.
|
632 | *
|
633 | * @ignore Exclude from docs
|
634 | * @param series Series
|
635 | * @return Disposer for events
|
636 | */
|
637 | registerSeries(series: XYSeries): IDisposer;
|
638 | /**
|
639 | * Perform tasks after Axis zoom.
|
640 | */
|
641 | protected handleSelectionExtremesChange(): void;
|
642 | /**
|
643 | * Indicates whether to blindly use exact `min` and `max` values set by user
|
644 | * when generating Axis scale.
|
645 | *
|
646 | * If not set, the Axis might slightly adjust those values to accomodate a
|
647 | * better looking grid.
|
648 | *
|
649 | * NOTE: if `min` and `max` are not set, setting `strictMinMax` to `true`
|
650 | * will result in fixing the scale of the axis to actual lowest and highest
|
651 | * values in the series within currently selected scope.
|
652 | *
|
653 | * @default false
|
654 | * @param value Use exact values?
|
655 | */
|
656 | /**
|
657 | * @return Use exact values?
|
658 | */
|
659 | strictMinMax: boolean;
|
660 | /**
|
661 | * Indicates if this axis should use a logarithmic scale.
|
662 | *
|
663 | * Please note that logarithmic axis can **only** accommodate values bigger
|
664 | * than zero.
|
665 | *
|
666 | * Having zero or negative values will result in error and failure of the
|
667 | * whole chart.
|
668 | *
|
669 | * @param value Logarithmic scale?
|
670 | */
|
671 | /**
|
672 | * @return Logarithmic scale?
|
673 | */
|
674 | logarithmic: boolean;
|
675 | /**
|
676 | * Indicates if a current selection (zoom) should be kept across data updates.
|
677 | *
|
678 | * If your axis is zoomed while chart's data is updated, the axis will try
|
679 | * to retain the same start and end values.
|
680 | *
|
681 | * You can also use this to initially pre-zoom axis:
|
682 | *
|
683 | * ```TypeScript
|
684 | * axis.keepSelection = true;
|
685 | * axis.start = 0.5;
|
686 | * axis.end = 0.7;
|
687 | * ```
|
688 | * ```JavaScript
|
689 | * axis.keepSelection = true;
|
690 | * axis.start = 0.5;
|
691 | * axis.end = 0.7;
|
692 | * ```
|
693 | * ```JSON
|
694 | * {
|
695 | * "xAxes": [{
|
696 | * // ...
|
697 | * "keepSelection": true,
|
698 | * "start": 0.5,
|
699 | * "end": 0.7
|
700 | * }]
|
701 | * }
|
702 | * ```
|
703 | *
|
704 | * The above will start the chart zoomed from the middle of the actual scope
|
705 | * to 70%.
|
706 | *
|
707 | * @since 4.1.1
|
708 | * @default false
|
709 | * @param value Preseve zoom after data update?
|
710 | */
|
711 | /**
|
712 | * @return Preseve zoom after data update?
|
713 | */
|
714 | keepSelection: boolean;
|
715 | /**
|
716 | * If set to `true`, values of axis ranges will be included when calculating
|
717 | * range of values / scale of the [[ValueAxis]].
|
718 | *
|
719 | * @default false
|
720 | * @since 4.4.9
|
721 | * @param value Include ranges?
|
722 | */
|
723 | /**
|
724 | * @return Include ranges?
|
725 | */
|
726 | includeRangesInMinMax: boolean;
|
727 | /**
|
728 | * Maximum number of decimals to allow when placing grid lines and labels
|
729 | * on axis.
|
730 | *
|
731 | * Set it to `0` (zero) to force integer-only axis labels.
|
732 | *
|
733 | * @param {number}
|
734 | */
|
735 | /**
|
736 | * @return max precision
|
737 | */
|
738 | maxPrecision: number;
|
739 | /**
|
740 | * This setting allows using bigger precision for numbers displayed in axis
|
741 | * tooltip.
|
742 | *
|
743 | * Please note that this setting indicates additional decimal places to
|
744 | * automatically-calculated axis number precision.
|
745 | *
|
746 | * So if your axis displays numbers like 0.1, 0.2, etc. (one decimal place),
|
747 | * and you set `extraTooltipPrecision = 1`, tooltips will display numbers
|
748 | * like 0.12, 0.25, etc. (two decimal places).
|
749 | *
|
750 | * @default 0
|
751 | * @since 4.8.3
|
752 | * @param value Extra decimals
|
753 | */
|
754 | /**
|
755 | * @return Extra decimals
|
756 | */
|
757 | extraTooltipPrecision: number;
|
758 | /**
|
759 | * Invalidates axis data items when series extremes change
|
760 | */
|
761 | protected handleExtremesChange(): void;
|
762 | /**
|
763 | * Returns relative position on axis for series' data item's value.
|
764 | *
|
765 | * @ignore Exclude from docs
|
766 | * @todo Description (review)
|
767 | * @param dataItem Data item
|
768 | * @param key Data field to get value from
|
769 | * @param location Location (0-1)
|
770 | * @param stackKey ?
|
771 | * @return X coordinate (px)
|
772 | */
|
773 | getX(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
|
774 | /**
|
775 | * Returns the X coordinate for series' data item's value.
|
776 | *
|
777 | * @since 4.5.14
|
778 | * @param dataItem Data item
|
779 | * @param key Data field to get value from
|
780 | * @param location Location (0-1)
|
781 | * @param stackKey ?
|
782 | * @return Relative position
|
783 | */
|
784 | getPositionX(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
|
785 | /**
|
786 | * Returns the Y coordinate for series' data item's value.
|
787 | *
|
788 | * @ignore Exclude from docs
|
789 | * @todo Description (review)
|
790 | * @param dataItem Data item
|
791 | * @param key Data field to get value from
|
792 | * @param location Location (0-1)
|
793 | * @param stackKey Stack ID
|
794 | * @return Y coordinate (px)
|
795 | */
|
796 | getY(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
|
797 | /**
|
798 | * Returns relative position on axis for series' data item's value.
|
799 | *
|
800 | * @since 4.5.14
|
801 | * @param dataItem Data item
|
802 | * @param key Data field to get value from
|
803 | * @param location Location (0-1)
|
804 | * @param stackKey Stack ID
|
805 | * @return Relative position
|
806 | */
|
807 | getPositionY(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
|
808 | /**
|
809 | * Returns an angle for series data item.
|
810 | *
|
811 | * @ignore Exclude from docs
|
812 | * @todo Description (review)
|
813 | * @param dataItem Data item
|
814 | * @param key Data field to get value from
|
815 | * @param location Location (0-1)
|
816 | * @param stackKey Stack ID
|
817 | * @param range Range to fit in
|
818 | * @return Angle
|
819 | */
|
820 | getAngle(dataItem: XYSeriesDataItem, key: string, location?: number, stackKey?: string, range?: IRange): number;
|
821 | /**
|
822 | * [getAnyRangePath description]
|
823 | *
|
824 | * @ignore Exclude from docs
|
825 | * @todo Description
|
826 | * @param start [description]
|
827 | * @param end [description]
|
828 | * @param location [description]
|
829 | * @return [description]
|
830 | */
|
831 | getAnyRangePath(start: number, end: number, location?: number): string;
|
832 | /**
|
833 | * Returns text to show in a axis tooltip, based on specific position within
|
834 | * axis.
|
835 | *
|
836 | * The label will be formatted as per [[NumberFormatter]] set for the whole
|
837 | * chart, or explicitly for this Axis.
|
838 | *
|
839 | * @ignore Exclude from docs
|
840 | * @param position Position (px)
|
841 | * @return Label (numeric value)
|
842 | */
|
843 | getTooltipText(position: number): string;
|
844 | /**
|
845 | * Zooms axis to specific values.
|
846 | *
|
847 | * @param startValue Start value
|
848 | * @param endValue End value
|
849 | * @param skipRangeEvent Do not invoke events
|
850 | * @param instantly Do not play zoom animations
|
851 | */
|
852 | zoomToValues(startValue: number, endValue: number, skipRangeEvent?: boolean, instantly?: boolean): void;
|
853 | /**
|
854 | * A smallest value in axis scale within current zoom.
|
855 | *
|
856 | * @return Min zoom value
|
857 | */
|
858 | readonly minZoomed: number;
|
859 | /**
|
860 | * A biggest value in axis scale within current zoom.
|
861 | * @return [description]
|
862 | */
|
863 | readonly maxZoomed: number;
|
864 | /**
|
865 | * Updates positioning of Axis breaks after something changes.
|
866 | *
|
867 | * @ignore Exclude from docs
|
868 | */
|
869 | fixAxisBreaks(): void;
|
870 | /**
|
871 | * Returns value based on position.
|
872 | *
|
873 | * Please note that `position` represents position within axis which may be
|
874 | * zoomed and not correspond to Cursor's `position`.
|
875 | *
|
876 | * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.
|
877 | *
|
878 | * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.
|
879 | * @param position Relative position on axis (0-1)
|
880 | * @return Position label
|
881 | */
|
882 | getPositionLabel(position: number): string;
|
883 | /**
|
884 | * Shows Axis tooltip at specific value
|
885 | *
|
886 | * @param value Value
|
887 | */
|
888 | showTooltipAt(value: number): void;
|
889 | /**
|
890 | * Copies all properties and related data from a different instance of Axis.
|
891 | *
|
892 | * @param source Source Axis
|
893 | */
|
894 | copyFrom(source: this): void;
|
895 | /**
|
896 | * Enables syncing of grid with another axis.
|
897 | *
|
898 | * To enable, set to a reference of the other `ValueAxis`. This axis will try
|
899 | * to maintain its scale in such way that its grid matches target axis grid.
|
900 | *
|
901 | * IMPORTANT #1: At this stage it's an experimental feature. Use it at your
|
902 | * own risk, as it may not work in 100% of the scenarios.
|
903 | *
|
904 | * IMPORTANT #2: `syncWithAxis` is not compatible with `strictMinMax` and
|
905 | * `sequencedInterpolation` settings.
|
906 | *
|
907 | * IMPORTANT #3: `syncWithAxis` is not compatible with scrollbars. Make sure
|
908 | * you do not add a scrollbar in the same direction as synced axes. For
|
909 | * example, if you have vertical synced axes, do not add `scrollbarY` on
|
910 | * your chart. It will create anomalies when used.
|
911 | *
|
912 | * IMPORTANT #4: `syncWithAxis` is not compatible with `XYCursor` if it has
|
913 | * its `behavior` set to either `zoomY` or `zoomXY`.
|
914 | *
|
915 | * @since 4.8.1
|
916 | * @param axis Target axis
|
917 | */
|
918 | /**
|
919 | * @return Target axis
|
920 | */
|
921 | syncWithAxis: ValueAxis;
|
922 | /**
|
923 | * If set, zero values will be treated as this value.
|
924 | *
|
925 | * It is useful if you need to use data with zero-values on a logarithmic
|
926 | * axis scale.
|
927 | *
|
928 | * @since 4.9.34
|
929 | * @param value Zero replacement value
|
930 | */
|
931 | /**
|
932 | * @return Zero replacement value
|
933 | */
|
934 | treatZeroAs: number;
|
935 | /**
|
936 | * Syncs with a target axis.
|
937 | *
|
938 | * @param min Min
|
939 | * @param max Max
|
940 | * @param step Step
|
941 | */
|
942 | protected syncAxes(min: number, max: number, step: number): {
|
943 | min: number;
|
944 | max: number;
|
945 | step: number;
|
946 | };
|
947 | /**
|
948 | * Returns `true` if axis needs to be resunced with some other axis.
|
949 | */
|
950 | protected checkSync(min: number, max: number, step: number, count: number): boolean;
|
951 | /**
|
952 | * Processes JSON-based config before it is applied to the object.
|
953 | *
|
954 | * @ignore Exclude from docs
|
955 | * @param config Config
|
956 | */
|
957 | processConfig(config?: {
|
958 | [index: string]: any;
|
959 | }): void;
|
960 | }
|