@amcharts/amcharts5 5.11.3 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.internal/charts/stock/toolbar/DrawingControl.d.ts.map +1 -1
- package/.internal/charts/stock/toolbar/DrawingControl.js +5 -2
- package/.internal/charts/stock/toolbar/DrawingControl.js.map +1 -1
- package/.internal/charts/timeline/AxisRendererCurveX.d.ts +132 -0
- package/.internal/charts/timeline/AxisRendererCurveX.d.ts.map +1 -0
- package/.internal/charts/timeline/AxisRendererCurveX.js +537 -0
- package/.internal/charts/timeline/AxisRendererCurveX.js.map +1 -0
- package/.internal/charts/timeline/AxisRendererCurveY.d.ts +132 -0
- package/.internal/charts/timeline/AxisRendererCurveY.d.ts.map +1 -0
- package/.internal/charts/timeline/AxisRendererCurveY.js +308 -0
- package/.internal/charts/timeline/AxisRendererCurveY.js.map +1 -0
- package/.internal/charts/timeline/CurveChart.d.ts +63 -0
- package/.internal/charts/timeline/CurveChart.d.ts.map +1 -0
- package/.internal/charts/timeline/CurveChart.js +123 -0
- package/.internal/charts/timeline/CurveChart.js.map +1 -0
- package/.internal/charts/timeline/CurveColumnSeries.d.ts +66 -0
- package/.internal/charts/timeline/CurveColumnSeries.d.ts.map +1 -0
- package/.internal/charts/timeline/CurveColumnSeries.js +163 -0
- package/.internal/charts/timeline/CurveColumnSeries.js.map +1 -0
- package/.internal/charts/timeline/CurveCursor.d.ts +61 -0
- package/.internal/charts/timeline/CurveCursor.d.ts.map +1 -0
- package/.internal/charts/timeline/CurveCursor.js +134 -0
- package/.internal/charts/timeline/CurveCursor.js.map +1 -0
- package/.internal/charts/timeline/CurveDefaultTheme.d.ts +8 -0
- package/.internal/charts/timeline/CurveDefaultTheme.d.ts.map +1 -0
- package/.internal/charts/timeline/CurveDefaultTheme.js +72 -0
- package/.internal/charts/timeline/CurveDefaultTheme.js.map +1 -0
- package/.internal/charts/timeline/CurveLineSeries.d.ts +40 -0
- package/.internal/charts/timeline/CurveLineSeries.d.ts.map +1 -0
- package/.internal/charts/timeline/CurveLineSeries.js +101 -0
- package/.internal/charts/timeline/CurveLineSeries.js.map +1 -0
- package/.internal/charts/timeline/SerpentineChart.d.ts +60 -0
- package/.internal/charts/timeline/SerpentineChart.d.ts.map +1 -0
- package/.internal/charts/timeline/SerpentineChart.js +146 -0
- package/.internal/charts/timeline/SerpentineChart.js.map +1 -0
- package/.internal/charts/timeline/SpiralChart.d.ts +60 -0
- package/.internal/charts/timeline/SpiralChart.d.ts.map +1 -0
- package/.internal/charts/timeline/SpiralChart.js +58 -0
- package/.internal/charts/timeline/SpiralChart.js.map +1 -0
- package/.internal/core/Classes.d.ts +16 -0
- package/.internal/core/Classes.d.ts.map +1 -1
- package/.internal/core/Classes.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/render/SerialChart.d.ts.map +1 -1
- package/.internal/core/render/SerialChart.js +12 -0
- package/.internal/core/render/SerialChart.js.map +1 -1
- package/.internal/core/util/List.d.ts +12 -0
- package/.internal/core/util/List.d.ts.map +1 -1
- package/.internal/core/util/List.js +23 -2
- package/.internal/core/util/List.js.map +1 -1
- package/.internal/core/util/Math.d.ts.map +1 -1
- package/.internal/core/util/Math.js +12 -5
- package/.internal/core/util/Math.js.map +1 -1
- package/.internal/plugins/json/Classes-script.d.ts +16 -0
- package/.internal/plugins/json/Classes-script.d.ts.map +1 -1
- package/.internal/plugins/json/Classes-script.js +8 -0
- package/.internal/plugins/json/Classes-script.js.map +1 -1
- package/.internal/plugins/json/Classes.d.ts +16 -0
- package/.internal/plugins/json/Classes.d.ts.map +1 -1
- package/.internal/plugins/json/Classes.js +8 -0
- package/.internal/plugins/json/Classes.js.map +1 -1
- package/CHANGELOG.md +13 -0
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/timeline-horizontal-serpentine-chart/README.md +6 -0
- package/examples/javascript/timeline-horizontal-serpentine-chart/index.css +11 -0
- package/examples/javascript/timeline-horizontal-serpentine-chart/index.html +12 -0
- package/examples/javascript/timeline-horizontal-serpentine-chart/index.js +268 -0
- package/examples/javascript/timeline-horizontal-serpentine-chart/package.json +16 -0
- package/examples/javascript/timeline-horizontal-serpentine-chart/webpack.config.js +38 -0
- package/examples/javascript/timeline-linear-process-diagram/README.md +6 -0
- package/examples/javascript/timeline-linear-process-diagram/index.css +11 -0
- package/examples/javascript/timeline-linear-process-diagram/index.html +12 -0
- package/examples/javascript/timeline-linear-process-diagram/index.js +365 -0
- package/examples/javascript/timeline-linear-process-diagram/package.json +16 -0
- package/examples/javascript/timeline-linear-process-diagram/webpack.config.js +38 -0
- package/examples/javascript/timeline-serpentine-chart/README.md +6 -0
- package/examples/javascript/timeline-serpentine-chart/index.css +11 -0
- package/examples/javascript/timeline-serpentine-chart/index.html +12 -0
- package/examples/javascript/timeline-serpentine-chart/index.js +274 -0
- package/examples/javascript/timeline-serpentine-chart/package.json +16 -0
- package/examples/javascript/timeline-serpentine-chart/webpack.config.js +38 -0
- package/examples/javascript/timeline-spiral-chart/README.md +6 -0
- package/examples/javascript/timeline-spiral-chart/index.css +11 -0
- package/examples/javascript/timeline-spiral-chart/index.html +12 -0
- package/examples/javascript/timeline-spiral-chart/index.js +274 -0
- package/examples/javascript/timeline-spiral-chart/package.json +16 -0
- package/examples/javascript/timeline-spiral-chart/webpack.config.js +38 -0
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/timeline-horizontal-serpentine-chart/README.md +6 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/index.css +11 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/index.html +12 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/index.ts +268 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/package.json +18 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/tsconfig.json +12 -0
- package/examples/typescript/timeline-horizontal-serpentine-chart/webpack.config.js +45 -0
- package/examples/typescript/timeline-linear-process-diagram/README.md +6 -0
- package/examples/typescript/timeline-linear-process-diagram/index.css +11 -0
- package/examples/typescript/timeline-linear-process-diagram/index.html +12 -0
- package/examples/typescript/timeline-linear-process-diagram/index.ts +365 -0
- package/examples/typescript/timeline-linear-process-diagram/package.json +18 -0
- package/examples/typescript/timeline-linear-process-diagram/tsconfig.json +12 -0
- package/examples/typescript/timeline-linear-process-diagram/webpack.config.js +45 -0
- package/examples/typescript/timeline-serpentine-chart/README.md +6 -0
- package/examples/typescript/timeline-serpentine-chart/index.css +11 -0
- package/examples/typescript/timeline-serpentine-chart/index.html +12 -0
- package/examples/typescript/timeline-serpentine-chart/index.ts +274 -0
- package/examples/typescript/timeline-serpentine-chart/package.json +18 -0
- package/examples/typescript/timeline-serpentine-chart/tsconfig.json +12 -0
- package/examples/typescript/timeline-serpentine-chart/webpack.config.js +45 -0
- package/examples/typescript/timeline-spiral-chart/README.md +6 -0
- package/examples/typescript/timeline-spiral-chart/index.css +11 -0
- package/examples/typescript/timeline-spiral-chart/index.html +12 -0
- package/examples/typescript/timeline-spiral-chart/index.ts +274 -0
- package/examples/typescript/timeline-spiral-chart/package.json +18 -0
- package/examples/typescript/timeline-spiral-chart/tsconfig.json +12 -0
- package/examples/typescript/timeline-spiral-chart/webpack.config.js +45 -0
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/package.json +1 -1
- package/timeline.d.ts +11 -0
- package/timeline.d.ts.map +1 -0
- package/timeline.js +11 -0
- package/timeline.js.map +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { CurveChart } from "./CurveChart";
|
|
2
|
+
import type { Grid } from "../xy/axes/Grid";
|
|
3
|
+
import type { IPoint } from "../../core/util/IPoint";
|
|
4
|
+
import type { AxisTick } from "../xy/axes/AxisTick";
|
|
5
|
+
import type { AxisBullet } from "../xy/axes/AxisBullet";
|
|
6
|
+
import type { Tooltip } from "../../core/render/Tooltip";
|
|
7
|
+
import type { AxisRendererCurveY } from "./AxisRendererCurveY";
|
|
8
|
+
import { Slice } from "../../core/render/Slice";
|
|
9
|
+
import { AxisRenderer, IAxisRendererSettings, IAxisRendererPrivate } from "../xy/axes/AxisRenderer";
|
|
10
|
+
import { AxisLabel } from "../xy/axes/AxisLabel";
|
|
11
|
+
import { ListTemplate } from "../../core/util/List";
|
|
12
|
+
export interface IAxisRendererCurveXSettings extends IAxisRendererSettings {
|
|
13
|
+
/**
|
|
14
|
+
* Array of control points to draw axis along.
|
|
15
|
+
*/
|
|
16
|
+
points?: Array<IPoint>;
|
|
17
|
+
/**
|
|
18
|
+
* Y renderer of a Y axis. Must be defined!
|
|
19
|
+
*/
|
|
20
|
+
yRenderer: AxisRendererCurveY;
|
|
21
|
+
/**
|
|
22
|
+
* If labels rotation should be adjusted to the axis rotation
|
|
23
|
+
*/
|
|
24
|
+
rotateLabels?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface IAxisRendererCurveXPrivate extends IAxisRendererPrivate {
|
|
27
|
+
scale?: number;
|
|
28
|
+
centerX?: number;
|
|
29
|
+
centerY?: number;
|
|
30
|
+
axisLength?: number;
|
|
31
|
+
autoScale?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Renderer for [[CurveChart]] "horizontal" axes.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://www.amcharts.com/docs/v5/charts/timeline/} for more info
|
|
37
|
+
* @since 5.12.0
|
|
38
|
+
* @important
|
|
39
|
+
*/
|
|
40
|
+
export declare class AxisRendererCurveX extends AxisRenderer {
|
|
41
|
+
/**
|
|
42
|
+
* Chart this renderer is for.
|
|
43
|
+
*/
|
|
44
|
+
chart: CurveChart | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* A list of labels in the axis.
|
|
47
|
+
*
|
|
48
|
+
* `labels.template` can be used to configure labels.
|
|
49
|
+
*
|
|
50
|
+
* @default new ListTemplate<AxisLabelRadial>
|
|
51
|
+
*/
|
|
52
|
+
readonly labels: ListTemplate<AxisLabel>;
|
|
53
|
+
/**
|
|
54
|
+
* A list of fills in the axis.
|
|
55
|
+
*
|
|
56
|
+
* `axisFills.template` can be used to configure axis fills.
|
|
57
|
+
*
|
|
58
|
+
* @default new ListTemplate<Slice>
|
|
59
|
+
*/
|
|
60
|
+
readonly axisFills: ListTemplate<Slice>;
|
|
61
|
+
static className: string;
|
|
62
|
+
static classNames: Array<string>;
|
|
63
|
+
_settings: IAxisRendererCurveXSettings;
|
|
64
|
+
_privateSettings: IAxisRendererCurveXPrivate;
|
|
65
|
+
pointPostion: Array<number>;
|
|
66
|
+
pointDistance: Array<number>;
|
|
67
|
+
protected _normalizedPoints: Array<IPoint>;
|
|
68
|
+
_afterNew(): void;
|
|
69
|
+
_beforeChanged(): void;
|
|
70
|
+
/**
|
|
71
|
+
* @ignore
|
|
72
|
+
*/
|
|
73
|
+
processAxis(): void;
|
|
74
|
+
/**
|
|
75
|
+
* @ignore
|
|
76
|
+
*/
|
|
77
|
+
_updateLayout(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @ignore
|
|
80
|
+
*/
|
|
81
|
+
updateGrid(grid?: Grid, position?: number, endPosition?: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Converts relative position to angle.
|
|
84
|
+
*
|
|
85
|
+
* @param position Position
|
|
86
|
+
* @return Angle
|
|
87
|
+
*/
|
|
88
|
+
positionToAngle(position: number): number;
|
|
89
|
+
getPoints(positionX: number, positionY: number, endPositionX: number, endPositionY: number): IPoint[];
|
|
90
|
+
protected _handleOpposite(): void;
|
|
91
|
+
positionToIndex(position: number): number;
|
|
92
|
+
indexToPosition(index: number): number;
|
|
93
|
+
pointToPosition(point: IPoint): IPoint;
|
|
94
|
+
/**
|
|
95
|
+
* Converts relative position to an X/Y coordinate.
|
|
96
|
+
*
|
|
97
|
+
* @param position Position
|
|
98
|
+
* @return Point
|
|
99
|
+
*/
|
|
100
|
+
positionToPoint(position: number, positionY?: number, doNotFix?: boolean): IPoint;
|
|
101
|
+
/**
|
|
102
|
+
* @ignore
|
|
103
|
+
*/
|
|
104
|
+
updateLabel(label?: AxisLabel, position?: number, endPosition?: number, count?: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* @ignore
|
|
107
|
+
*/
|
|
108
|
+
updateTick(tick?: AxisTick, position?: number, endPosition?: number, count?: number): void;
|
|
109
|
+
/**
|
|
110
|
+
* @ignore
|
|
111
|
+
*/
|
|
112
|
+
updateBullet(bullet?: AxisBullet, position?: number, endPosition?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* @ignore
|
|
115
|
+
*/
|
|
116
|
+
updateFill(fill?: Slice, position?: number, endPosition?: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Returns axis length in pixels.
|
|
119
|
+
*
|
|
120
|
+
* @return Length
|
|
121
|
+
*/
|
|
122
|
+
axisLength(): number;
|
|
123
|
+
/**
|
|
124
|
+
* @ignore
|
|
125
|
+
*/
|
|
126
|
+
positionTooltip(tooltip: Tooltip, position: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* @ignore
|
|
129
|
+
*/
|
|
130
|
+
updateTooltipBounds(_tooltip: Tooltip): void;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=AxisRendererCurveX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxisRendererCurveX.d.ts","sourceRoot":"","sources":["../../../../../src/.internal/charts/timeline/AxisRendererCurveX.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { Slice } from "../../core/render/Slice";
|
|
2
|
+
import { AxisRenderer } from "../xy/axes/AxisRenderer";
|
|
3
|
+
import { AxisLabel } from "../xy/axes/AxisLabel";
|
|
4
|
+
import { ListTemplate } from "../../core/util/List";
|
|
5
|
+
import { Template } from "../../core/util/Template";
|
|
6
|
+
import * as $utils from "../../core/util/Utils";
|
|
7
|
+
import * as $math from "../../core/util/Math";
|
|
8
|
+
import * as $array from "../../core/util/Array";
|
|
9
|
+
/**
|
|
10
|
+
* Renderer for [[CurveChart]] "horizontal" axes.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://www.amcharts.com/docs/v5/charts/timeline/} for more info
|
|
13
|
+
* @since 5.12.0
|
|
14
|
+
* @important
|
|
15
|
+
*/
|
|
16
|
+
export class AxisRendererCurveX extends AxisRenderer {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* A list of labels in the axis.
|
|
21
|
+
*
|
|
22
|
+
* `labels.template` can be used to configure labels.
|
|
23
|
+
*
|
|
24
|
+
* @default new ListTemplate<AxisLabelRadial>
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(this, "labels", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: this.addDisposer(new ListTemplate(Template.new({}), () => AxisLabel._new(this._root, {
|
|
31
|
+
themeTags: $utils.mergeTags(this.labels.template.get("themeTags", []), this.get("themeTags", []))
|
|
32
|
+
}, [this.labels.template])))
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* A list of fills in the axis.
|
|
36
|
+
*
|
|
37
|
+
* `axisFills.template` can be used to configure axis fills.
|
|
38
|
+
*
|
|
39
|
+
* @default new ListTemplate<Slice>
|
|
40
|
+
*/
|
|
41
|
+
Object.defineProperty(this, "axisFills", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: this.addDisposer(new ListTemplate(Template.new({}), () => Slice._new(this._root, {
|
|
46
|
+
themeTags: $utils.mergeTags(this.axisFills.template.get("themeTags", ["fill"]), this.get("themeTags", []))
|
|
47
|
+
}, [this.axisFills.template])))
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "pointPostion", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: []
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "pointDistance", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: []
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(this, "_normalizedPoints", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: []
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
_afterNew() {
|
|
69
|
+
this._settings.themeTags = $utils.mergeTags(this._settings.themeTags, ["renderer", "circular"]);
|
|
70
|
+
super._afterNew();
|
|
71
|
+
this.setPrivateRaw("letter", "X");
|
|
72
|
+
this.setRaw("position", "absolute");
|
|
73
|
+
}
|
|
74
|
+
_beforeChanged() {
|
|
75
|
+
super._beforeChanged();
|
|
76
|
+
if (this.isDirty("points")) {
|
|
77
|
+
this._updateLayout();
|
|
78
|
+
}
|
|
79
|
+
if (this.isDirty("yRenderer")) {
|
|
80
|
+
const yRenderer = this.get("yRenderer");
|
|
81
|
+
yRenderer.set("xRenderer", this);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @ignore
|
|
86
|
+
*/
|
|
87
|
+
processAxis() {
|
|
88
|
+
super.processAxis();
|
|
89
|
+
const axis = this.axis;
|
|
90
|
+
axis.labelsContainer.set("isMeasured", false);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
_updateLayout() {
|
|
96
|
+
const chart = this.chart;
|
|
97
|
+
if (chart) {
|
|
98
|
+
const points = this.get("points");
|
|
99
|
+
if (points) {
|
|
100
|
+
// find extreme points
|
|
101
|
+
let minX = Infinity;
|
|
102
|
+
let minY = Infinity;
|
|
103
|
+
let maxX = -Infinity;
|
|
104
|
+
let maxY = -Infinity;
|
|
105
|
+
let axisLength = 0;
|
|
106
|
+
let prevPoint = points[0];
|
|
107
|
+
$array.each(points, (point, i) => {
|
|
108
|
+
minX = Math.min(minX, point.x);
|
|
109
|
+
minY = Math.min(minY, point.y);
|
|
110
|
+
maxX = Math.max(maxX, point.x);
|
|
111
|
+
maxY = Math.max(maxY, point.y);
|
|
112
|
+
axisLength += Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
113
|
+
this.pointDistance[i] = axisLength;
|
|
114
|
+
prevPoint = point;
|
|
115
|
+
});
|
|
116
|
+
$array.each(points, (_p, i) => {
|
|
117
|
+
this.pointPostion[i] = this.pointDistance[i] / axisLength;
|
|
118
|
+
});
|
|
119
|
+
let yAxisLenght = this.get("yRenderer").get("axisLength", 0);
|
|
120
|
+
let aw = maxX - minX + 2 * yAxisLenght;
|
|
121
|
+
let ah = maxY - minY + 2 * yAxisLenght;
|
|
122
|
+
// calculate center
|
|
123
|
+
let centerX = (minX + maxX) / 2;
|
|
124
|
+
let centerY = (minY + maxY) / 2;
|
|
125
|
+
// take width and height of a chart
|
|
126
|
+
let width = chart.innerWidth();
|
|
127
|
+
let height = chart.innerHeight();
|
|
128
|
+
// calculate scale
|
|
129
|
+
let scaleX = width / aw;
|
|
130
|
+
let scaleY = height / ah;
|
|
131
|
+
// calculate scale
|
|
132
|
+
let scale = Math.min(scaleX, scaleY);
|
|
133
|
+
if (!this.getPrivate("autoScale", true)) {
|
|
134
|
+
scale = 1;
|
|
135
|
+
}
|
|
136
|
+
this.axis.setPrivateRaw("width", aw * scale);
|
|
137
|
+
this.axis.setPrivateRaw("height", ah * scale);
|
|
138
|
+
this.setPrivateRaw("centerX", centerX);
|
|
139
|
+
this.setPrivateRaw("centerY", centerY);
|
|
140
|
+
this.setPrivateRaw("scale", scale);
|
|
141
|
+
this.setPrivateRaw("axisLength", axisLength);
|
|
142
|
+
this.set("draw", (display) => {
|
|
143
|
+
display.moveTo((points[0].x - centerX) * scale, (points[0].y - centerY) * scale);
|
|
144
|
+
$array.each(points, (point) => {
|
|
145
|
+
display.lineTo((point.x - centerX) * scale, (point.y - centerY) * scale);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
prevPoint = points[0];
|
|
149
|
+
this._normalizedPoints = [];
|
|
150
|
+
$array.each(points, (point) => {
|
|
151
|
+
let distance = Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
152
|
+
for (let i = 1; i < distance; i++) {
|
|
153
|
+
let x = ((prevPoint.x + (point.x - prevPoint.x) * i / distance) - centerX) * scale;
|
|
154
|
+
let y = ((prevPoint.y + (point.y - prevPoint.y) * i / distance) - centerY) * scale;
|
|
155
|
+
// check distance to previous normalized point
|
|
156
|
+
const prevNormalized = this._normalizedPoints[this._normalizedPoints.length - 1];
|
|
157
|
+
if (prevNormalized) {
|
|
158
|
+
let distance = Math.hypot(x - prevNormalized.x, y - prevNormalized.y);
|
|
159
|
+
if (distance < .5) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this._normalizedPoints.push({ x: x, y: y });
|
|
164
|
+
}
|
|
165
|
+
prevPoint = point;
|
|
166
|
+
});
|
|
167
|
+
this.axis.markDirtySize();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @ignore
|
|
173
|
+
*/
|
|
174
|
+
updateGrid(grid, position, endPosition) {
|
|
175
|
+
if (grid) {
|
|
176
|
+
if (position == null) {
|
|
177
|
+
position = 0;
|
|
178
|
+
}
|
|
179
|
+
let location = grid.get("location", 0.5);
|
|
180
|
+
if (endPosition != null && endPosition != position) {
|
|
181
|
+
position = position + (endPosition - position) * location;
|
|
182
|
+
}
|
|
183
|
+
this.toggleVisibility(grid, position, 0, 1);
|
|
184
|
+
const p0 = this.positionToPoint(position, 0);
|
|
185
|
+
const p1 = this.positionToPoint(position, 1);
|
|
186
|
+
grid.set("draw", (display) => {
|
|
187
|
+
display.moveTo(p0.x, p0.y);
|
|
188
|
+
display.lineTo(p1.x, p1.y);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Converts relative position to angle.
|
|
194
|
+
*
|
|
195
|
+
* @param position Position
|
|
196
|
+
* @return Angle
|
|
197
|
+
*/
|
|
198
|
+
positionToAngle(position) {
|
|
199
|
+
position = this.toGlobalPosition(position);
|
|
200
|
+
let points = this.get("points");
|
|
201
|
+
let axisLength = this.getPrivate("axisLength", 0);
|
|
202
|
+
let angle = 0;
|
|
203
|
+
// find which segment the position is in
|
|
204
|
+
if (points) {
|
|
205
|
+
let totalLength = 0;
|
|
206
|
+
let prevPoint = points[0];
|
|
207
|
+
$array.eachContinue(points, (point) => {
|
|
208
|
+
let segmentLength = Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
209
|
+
totalLength += segmentLength;
|
|
210
|
+
if (totalLength > position * axisLength) {
|
|
211
|
+
angle = $math.getAngle(prevPoint, point) + 90;
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
prevPoint = point;
|
|
215
|
+
return true;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return angle;
|
|
219
|
+
}
|
|
220
|
+
getPoints(positionX, positionY, endPositionX, endPositionY) {
|
|
221
|
+
let yRenderer = this.get("yRenderer");
|
|
222
|
+
let points = [];
|
|
223
|
+
if (positionX > endPositionX) {
|
|
224
|
+
[positionX, endPositionX] = [endPositionX, positionX];
|
|
225
|
+
}
|
|
226
|
+
if (positionY > endPositionY) {
|
|
227
|
+
[positionY, endPositionY] = [endPositionY, positionY];
|
|
228
|
+
}
|
|
229
|
+
if (yRenderer) {
|
|
230
|
+
let indexStart = this.positionToIndex(positionX);
|
|
231
|
+
let indexEnd = this.positionToIndex(endPositionX);
|
|
232
|
+
points.push(this.positionToPoint(positionX, positionY));
|
|
233
|
+
for (let i = indexStart; i <= indexEnd + 1; i++) {
|
|
234
|
+
let position = this.indexToPosition(i);
|
|
235
|
+
if (position > positionX && position < endPositionX) {
|
|
236
|
+
points.push(this.positionToPoint(position, positionY));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
points.push(this.positionToPoint(endPositionX, positionY));
|
|
240
|
+
if (endPositionY != positionY) {
|
|
241
|
+
points.push(this.positionToPoint(endPositionX, endPositionY));
|
|
242
|
+
for (let i = indexEnd + 1; i >= indexStart; i--) {
|
|
243
|
+
let position = this.indexToPosition(i);
|
|
244
|
+
if (position > positionX && position < endPositionX) {
|
|
245
|
+
points.push(this.positionToPoint(position, endPositionY));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
points.push(this.positionToPoint(positionX, endPositionY));
|
|
249
|
+
points.push(points[0]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return points;
|
|
253
|
+
}
|
|
254
|
+
// do not delete
|
|
255
|
+
_handleOpposite() { }
|
|
256
|
+
positionToIndex(position) {
|
|
257
|
+
let points = this.get("points");
|
|
258
|
+
let axisLength = this.getPrivate("axisLength", 0);
|
|
259
|
+
let index = 0;
|
|
260
|
+
position = this.toGlobalPosition(position);
|
|
261
|
+
if (points && points.length > 1) {
|
|
262
|
+
let totalLength = 0;
|
|
263
|
+
let prevPoint = points[0];
|
|
264
|
+
if (position <= 0) {
|
|
265
|
+
index = 0;
|
|
266
|
+
}
|
|
267
|
+
else if (position >= 1) {
|
|
268
|
+
const len = points.length;
|
|
269
|
+
index = len - 1;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
let i = 0;
|
|
273
|
+
$array.eachContinue(points, (point) => {
|
|
274
|
+
let segmentLength = Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
275
|
+
totalLength += segmentLength;
|
|
276
|
+
if (totalLength >= position * axisLength) {
|
|
277
|
+
index = i;
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
prevPoint = point;
|
|
281
|
+
i++;
|
|
282
|
+
return true;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return index;
|
|
287
|
+
}
|
|
288
|
+
indexToPosition(index) {
|
|
289
|
+
let points = this.get("points");
|
|
290
|
+
let axisLength = this.getPrivate("axisLength", 0);
|
|
291
|
+
let position = 0;
|
|
292
|
+
if (points && points.length > 1) {
|
|
293
|
+
let totalLength = 0;
|
|
294
|
+
let prevPoint = points[0];
|
|
295
|
+
let i = 0;
|
|
296
|
+
$array.eachContinue(points, (point) => {
|
|
297
|
+
position = totalLength / axisLength;
|
|
298
|
+
if (i == index) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
let segmentLength = Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
302
|
+
totalLength += segmentLength;
|
|
303
|
+
prevPoint = point;
|
|
304
|
+
i++;
|
|
305
|
+
return true;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return this.toAxisPosition(position);
|
|
309
|
+
}
|
|
310
|
+
pointToPosition(point) {
|
|
311
|
+
let minDistance = Infinity;
|
|
312
|
+
let index = 0;
|
|
313
|
+
let prevPoint = this._normalizedPoints[0];
|
|
314
|
+
let angle = 0;
|
|
315
|
+
$array.each(this._normalizedPoints, (normalizedPoint, i) => {
|
|
316
|
+
let distance = Math.hypot(normalizedPoint.x - point.x, normalizedPoint.y - point.y);
|
|
317
|
+
if (distance < minDistance) {
|
|
318
|
+
minDistance = distance;
|
|
319
|
+
index = i;
|
|
320
|
+
angle = $math.getAngle(point, normalizedPoint) - $math.getAngle(prevPoint, normalizedPoint);
|
|
321
|
+
}
|
|
322
|
+
prevPoint = normalizedPoint;
|
|
323
|
+
});
|
|
324
|
+
const yRenderer = this.get("yRenderer");
|
|
325
|
+
const scale = this.getPrivate("scale", 1);
|
|
326
|
+
const rendererY = this.get("yRenderer");
|
|
327
|
+
const y = -minDistance / (yRenderer.get("axisLength", 0) * scale) * $math.sin(angle) + rendererY.get("axisLocation", 0);
|
|
328
|
+
return { x: index / this._normalizedPoints.length, y: y };
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Converts relative position to an X/Y coordinate.
|
|
332
|
+
*
|
|
333
|
+
* @param position Position
|
|
334
|
+
* @return Point
|
|
335
|
+
*/
|
|
336
|
+
positionToPoint(position, positionY, doNotFix) {
|
|
337
|
+
if (positionY == undefined) {
|
|
338
|
+
positionY = 0;
|
|
339
|
+
}
|
|
340
|
+
const rendererY = this.get("yRenderer");
|
|
341
|
+
if (!doNotFix) {
|
|
342
|
+
position = this.toGlobalPosition(position);
|
|
343
|
+
}
|
|
344
|
+
positionY = rendererY.toGlobalPosition(positionY);
|
|
345
|
+
positionY -= rendererY.get("axisLocation", 0);
|
|
346
|
+
let points = this.get("points");
|
|
347
|
+
let axisLength = this.getPrivate("axisLength", 0);
|
|
348
|
+
let scale = this.getPrivate("scale", 1);
|
|
349
|
+
let pointOfPosition = { x: 0, y: 0 };
|
|
350
|
+
let angle = 0;
|
|
351
|
+
// find which segment the position is in
|
|
352
|
+
if (points && points.length > 1) {
|
|
353
|
+
let totalLength = 0;
|
|
354
|
+
let prevPoint = points[0];
|
|
355
|
+
if (position <= 0) {
|
|
356
|
+
angle = $math.getAngle(points[0], points[1]) + 90;
|
|
357
|
+
pointOfPosition = points[0];
|
|
358
|
+
}
|
|
359
|
+
else if (position >= 1) {
|
|
360
|
+
const len = points.length;
|
|
361
|
+
angle = $math.getAngle(points[len - 2], points[len - 1]) + 90;
|
|
362
|
+
pointOfPosition = points[len - 1];
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
$array.eachContinue(points, (point) => {
|
|
366
|
+
let segmentLength = Math.hypot(point.x - prevPoint.x, point.y - prevPoint.y);
|
|
367
|
+
totalLength += segmentLength;
|
|
368
|
+
if (totalLength >= position * axisLength) {
|
|
369
|
+
let segementStartPosition = (totalLength - segmentLength) / axisLength;
|
|
370
|
+
let segmentPosition = (position * axisLength - segementStartPosition * axisLength) / segmentLength;
|
|
371
|
+
pointOfPosition = { x: prevPoint.x + (point.x - prevPoint.x) * segmentPosition, y: prevPoint.y + (point.y - prevPoint.y) * segmentPosition };
|
|
372
|
+
angle = $math.getAngle(prevPoint, point) + 90;
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
prevPoint = point;
|
|
376
|
+
return true;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
let centerX = this.getPrivate("centerX", 0);
|
|
381
|
+
let centerY = this.getPrivate("centerY", 0);
|
|
382
|
+
let axisX = (pointOfPosition.x - centerX) * scale;
|
|
383
|
+
let axisY = (pointOfPosition.y - centerY) * scale;
|
|
384
|
+
if (positionY == null) {
|
|
385
|
+
positionY = 0;
|
|
386
|
+
}
|
|
387
|
+
let lengthY = -rendererY.get("axisLength", 0);
|
|
388
|
+
let dy = lengthY * positionY * scale;
|
|
389
|
+
let x = axisX + $math.cos(angle) * dy;
|
|
390
|
+
let y = axisY + $math.sin(angle) * dy;
|
|
391
|
+
return { x: x, y: y };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* @ignore
|
|
395
|
+
*/
|
|
396
|
+
updateLabel(label, position, endPosition, count) {
|
|
397
|
+
if (label) {
|
|
398
|
+
if (position == null) {
|
|
399
|
+
position = 0;
|
|
400
|
+
}
|
|
401
|
+
let location = 0.5;
|
|
402
|
+
if (count != null && count > 1) {
|
|
403
|
+
location = label.get("multiLocation", location);
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
location = label.get("location", location);
|
|
407
|
+
}
|
|
408
|
+
if (endPosition != null && endPosition != position) {
|
|
409
|
+
position = position + (endPosition - position) * location;
|
|
410
|
+
}
|
|
411
|
+
const angle = this.positionToAngle(position);
|
|
412
|
+
const rendererY = this.get("yRenderer");
|
|
413
|
+
const axisY = rendererY.axis;
|
|
414
|
+
const point = this.positionToPoint(position, axisY.get("start", 0) + rendererY.get("axisLocation", 0));
|
|
415
|
+
label.setAll({
|
|
416
|
+
x: point.x,
|
|
417
|
+
y: point.y
|
|
418
|
+
});
|
|
419
|
+
if (this.get("rotateLabels", true)) {
|
|
420
|
+
label.set("rotation", angle - 90);
|
|
421
|
+
}
|
|
422
|
+
this.toggleVisibility(label, position, label.get("minPosition", 0), label.get("maxPosition", 1));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @ignore
|
|
427
|
+
*/
|
|
428
|
+
updateTick(tick, position, endPosition, count) {
|
|
429
|
+
if (tick) {
|
|
430
|
+
if (position == null) {
|
|
431
|
+
position = 0;
|
|
432
|
+
}
|
|
433
|
+
let location = 0.5;
|
|
434
|
+
if (count != null && count > 1) {
|
|
435
|
+
location = tick.get("multiLocation", location);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
location = tick.get("location", location);
|
|
439
|
+
}
|
|
440
|
+
if (endPosition != null && endPosition != position) {
|
|
441
|
+
position = position + (endPosition - position) * location;
|
|
442
|
+
}
|
|
443
|
+
let length = tick.get("length", 0);
|
|
444
|
+
const inside = tick.get("inside");
|
|
445
|
+
if (inside) {
|
|
446
|
+
length *= -1;
|
|
447
|
+
}
|
|
448
|
+
let angle = this.positionToAngle(position);
|
|
449
|
+
this.toggleVisibility(tick, position, tick.get("minPosition", 0), tick.get("maxPosition", 1));
|
|
450
|
+
const rendererY = this.get("yRenderer");
|
|
451
|
+
const axisY = rendererY.axis;
|
|
452
|
+
const point = this.positionToPoint(position, axisY.get("start"));
|
|
453
|
+
tick.set("draw", (display) => {
|
|
454
|
+
display.moveTo(point.x, point.y);
|
|
455
|
+
display.lineTo(point.x - length * $math.cos(angle), point.y - length * $math.sin(angle));
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* @ignore
|
|
461
|
+
*/
|
|
462
|
+
updateBullet(bullet, position, endPosition) {
|
|
463
|
+
if (bullet) {
|
|
464
|
+
const sprite = bullet.get("sprite");
|
|
465
|
+
if (sprite) {
|
|
466
|
+
if (position == null) {
|
|
467
|
+
position = 0;
|
|
468
|
+
}
|
|
469
|
+
let location = bullet.get("location", 0.5);
|
|
470
|
+
if (endPosition != null && endPosition != position) {
|
|
471
|
+
position = position + (endPosition - position) * location;
|
|
472
|
+
}
|
|
473
|
+
const rendererY = this.get("yRenderer");
|
|
474
|
+
const axisY = rendererY.axis;
|
|
475
|
+
const point = this.positionToPoint(position, axisY.get("start"));
|
|
476
|
+
sprite.setAll({ x: point.x, y: point.y });
|
|
477
|
+
this.toggleVisibility(sprite, position, 0, 1);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* @ignore
|
|
483
|
+
*/
|
|
484
|
+
updateFill(fill, position, endPosition) {
|
|
485
|
+
if (fill) {
|
|
486
|
+
if (position == null) {
|
|
487
|
+
position = 0;
|
|
488
|
+
}
|
|
489
|
+
if (endPosition == null) {
|
|
490
|
+
endPosition = 1;
|
|
491
|
+
}
|
|
492
|
+
const yRenderer = this.get("yRenderer");
|
|
493
|
+
const yAxis = yRenderer.axis;
|
|
494
|
+
const points = this.getPoints(position, yAxis.get("start", 0), endPosition, yAxis.get("end", 1));
|
|
495
|
+
fill.set("draw", (display) => {
|
|
496
|
+
display.moveTo(points[0].x, points[0].y);
|
|
497
|
+
$array.each(points, (point) => {
|
|
498
|
+
display.lineTo(point.x, point.y);
|
|
499
|
+
});
|
|
500
|
+
display.closePath();
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Returns axis length in pixels.
|
|
506
|
+
*
|
|
507
|
+
* @return Length
|
|
508
|
+
*/
|
|
509
|
+
axisLength() {
|
|
510
|
+
return this.getPrivate("axisLength", 0);
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* @ignore
|
|
514
|
+
*/
|
|
515
|
+
positionTooltip(tooltip, position) {
|
|
516
|
+
const point = this.positionToPoint(position, this.get("yRenderer").axis.get("start", 0));
|
|
517
|
+
this._positionTooltip(tooltip, point);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* @ignore
|
|
521
|
+
*/
|
|
522
|
+
updateTooltipBounds(_tooltip) {
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
Object.defineProperty(AxisRendererCurveX, "className", {
|
|
526
|
+
enumerable: true,
|
|
527
|
+
configurable: true,
|
|
528
|
+
writable: true,
|
|
529
|
+
value: "AxisRendererCurveX"
|
|
530
|
+
});
|
|
531
|
+
Object.defineProperty(AxisRendererCurveX, "classNames", {
|
|
532
|
+
enumerable: true,
|
|
533
|
+
configurable: true,
|
|
534
|
+
writable: true,
|
|
535
|
+
value: AxisRenderer.classNames.concat([AxisRendererCurveX.className])
|
|
536
|
+
});
|
|
537
|
+
//# sourceMappingURL=AxisRendererCurveX.js.map
|