@tectra-ng/charts 0.0.1 → 0.2.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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -1
  3. package/bar-list/README.md +30 -0
  4. package/boxplot/README.md +62 -0
  5. package/bullet/README.md +53 -0
  6. package/candlestick/README.md +57 -0
  7. package/column/README.md +73 -0
  8. package/combo/README.md +83 -0
  9. package/core/README.md +62 -0
  10. package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
  11. package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
  12. package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
  13. package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
  14. package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
  15. package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
  16. package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
  17. package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
  18. package/fesm2022/tectra-ng-charts-column.mjs +1166 -0
  19. package/fesm2022/tectra-ng-charts-column.mjs.map +1 -0
  20. package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
  21. package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
  22. package/fesm2022/tectra-ng-charts-core.mjs +3679 -0
  23. package/fesm2022/tectra-ng-charts-core.mjs.map +1 -0
  24. package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
  25. package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
  26. package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
  27. package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
  28. package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
  29. package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
  30. package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
  31. package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
  32. package/fesm2022/tectra-ng-charts-line.mjs +1541 -0
  33. package/fesm2022/tectra-ng-charts-line.mjs.map +1 -0
  34. package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
  35. package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
  36. package/fesm2022/tectra-ng-charts-pie.mjs +1059 -0
  37. package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -0
  38. package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
  39. package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
  40. package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
  41. package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
  42. package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
  43. package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
  44. package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
  45. package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
  46. package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
  47. package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
  48. package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
  49. package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
  50. package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
  51. package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
  52. package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
  53. package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
  54. package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
  55. package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
  56. package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
  57. package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
  58. package/fesm2022/tectra-ng-charts.mjs +4 -0
  59. package/fesm2022/tectra-ng-charts.mjs.map +1 -0
  60. package/funnel/README.md +53 -0
  61. package/gantt/README.md +53 -0
  62. package/gauge/README.md +41 -0
  63. package/heatmap/README.md +47 -0
  64. package/line/README.md +86 -0
  65. package/org-chart/README.md +57 -0
  66. package/package.json +173 -4
  67. package/pie/README.md +66 -0
  68. package/radar/README.md +64 -0
  69. package/radial-bar/README.md +62 -0
  70. package/range-area/README.md +66 -0
  71. package/rank-line/README.md +51 -0
  72. package/sankey/README.md +52 -0
  73. package/scatter/README.md +71 -0
  74. package/segmented-bar/README.md +35 -0
  75. package/sunburst/README.md +55 -0
  76. package/treemap/README.md +47 -0
  77. package/types/tectra-ng-charts-bar-list.d.ts +724 -0
  78. package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
  79. package/types/tectra-ng-charts-boxplot.d.ts +882 -0
  80. package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
  81. package/types/tectra-ng-charts-bullet.d.ts +833 -0
  82. package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
  83. package/types/tectra-ng-charts-candlestick.d.ts +854 -0
  84. package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
  85. package/types/tectra-ng-charts-column.d.ts +951 -0
  86. package/types/tectra-ng-charts-column.d.ts.map +1 -0
  87. package/types/tectra-ng-charts-combo.d.ts +987 -0
  88. package/types/tectra-ng-charts-combo.d.ts.map +1 -0
  89. package/types/tectra-ng-charts-core.d.ts +859 -0
  90. package/types/tectra-ng-charts-core.d.ts.map +1 -0
  91. package/types/tectra-ng-charts-funnel.d.ts +857 -0
  92. package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
  93. package/types/tectra-ng-charts-gantt.d.ts +884 -0
  94. package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
  95. package/types/tectra-ng-charts-gauge.d.ts +859 -0
  96. package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
  97. package/types/tectra-ng-charts-heatmap.d.ts +914 -0
  98. package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
  99. package/types/tectra-ng-charts-line.d.ts +1023 -0
  100. package/types/tectra-ng-charts-line.d.ts.map +1 -0
  101. package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
  102. package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
  103. package/types/tectra-ng-charts-pie.d.ts +983 -0
  104. package/types/tectra-ng-charts-pie.d.ts.map +1 -0
  105. package/types/tectra-ng-charts-radar.d.ts +903 -0
  106. package/types/tectra-ng-charts-radar.d.ts.map +1 -0
  107. package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
  108. package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
  109. package/types/tectra-ng-charts-range-area.d.ts +897 -0
  110. package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
  111. package/types/tectra-ng-charts-rank-line.d.ts +839 -0
  112. package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
  113. package/types/tectra-ng-charts-sankey.d.ts +866 -0
  114. package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
  115. package/types/tectra-ng-charts-scatter.d.ts +987 -0
  116. package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
  117. package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
  118. package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
  119. package/types/tectra-ng-charts-sunburst.d.ts +864 -0
  120. package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
  121. package/types/tectra-ng-charts-treemap.d.ts +847 -0
  122. package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
  123. package/types/tectra-ng-charts-waterfall.d.ts +869 -0
  124. package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
  125. package/types/tectra-ng-charts.d.ts +2 -0
  126. package/types/tectra-ng-charts.d.ts.map +1 -0
  127. package/waterfall/README.md +60 -0
@@ -0,0 +1,1541 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, linkedSignal, model, output, signal, viewChild } from "@angular/core";
3
+ import { TxChartAnnotations, TxChartAxes, TxChartFrame, TxChartLegendTemplate, TxChartTooltipTemplate, areaPath, cartesianLayout, chartAnnotationShapes, chartCategoryIndex, chartMonthNames, chartNumberFormatter, chartSummary, chartTable, cycleIndex, decimateSeries, extent, hasChartData, initialChartSize, injectChartEntrance, linePath, normalizeSeries, prefersReducedMotion, readTokenNumber, seriesColor, stackValues, stepIndex, timeInterval, timeTooltipFormatter, toTime, toggleKey } from "@tectra-ng/charts/core";
4
+ import { uniqueId } from "@tectra-ng/core/a11y";
5
+ import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
6
+ import { TxLocaleService, formatMessage, injectTranslations } from "@tectra-ng/core/i18n";
7
+ import { optionalBoolean } from "@tectra-ng/core/utils";
8
+ import { toStyleObject } from "@tectra-ng/themes";
9
+ const DECIMATE_RATIO = 1.5;
10
+ const OVERVIEW = 44;
11
+ const OVERVIEW_GAP = 18;
12
+ const OVERVIEW_PAD = 4;
13
+ const OVERVIEW_HANDLE = 20;
14
+ const HANDLE_REACH = 7;
15
+ const DRAG_THRESHOLD = 3;
16
+ const CLIP_PAD = 8;
17
+ const MIN_CATEGORY_SPAN = 2;
18
+ const MIN_SPAN_SHARE = .02;
19
+ const KEY_ZOOM = .7;
20
+ const KEY_PAN = .2;
21
+ const SLIDE_SECONDS = .32;
22
+ const SLIDE_EASING = "cubic-bezier(0.22, 1, 0.36, 1)";
23
+ var TxLineChart = class TxLineChart {
24
+ locale = inject(TxLocaleService);
25
+ translations = injectTranslations();
26
+ series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
27
+ categories = input([], ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
28
+ xType = input("category", ...ngDevMode ? [{ debugName: "xType" }] : /* istanbul ignore next */ []);
29
+ annotations = input([], ...ngDevMode ? [{ debugName: "annotations" }] : /* istanbul ignore next */ []);
30
+ zoom = input(false, {
31
+ ...ngDevMode ? { debugName: "zoom" } : /* istanbul ignore next */ {},
32
+ transform: booleanAttribute
33
+ });
34
+ brush = input(false, {
35
+ ...ngDevMode ? { debugName: "brush" } : /* istanbul ignore next */ {},
36
+ transform: booleanAttribute
37
+ });
38
+ xRange = model(null, ...ngDevMode ? [{ debugName: "xRange" }] : /* istanbul ignore next */ []);
39
+ maxPoints = input(void 0, ...ngDevMode ? [{ debugName: "maxPoints" }] : /* istanbul ignore next */ []);
40
+ live = input(false, {
41
+ ...ngDevMode ? { debugName: "live" } : /* istanbul ignore next */ {},
42
+ transform: booleanAttribute
43
+ });
44
+ height = input(450, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
45
+ curve = input("smooth", ...ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []);
46
+ area = input(true, {
47
+ ...ngDevMode ? { debugName: "area" } : /* istanbul ignore next */ {},
48
+ transform: booleanAttribute
49
+ });
50
+ stacked = input(false, {
51
+ ...ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {},
52
+ transform: booleanAttribute
53
+ });
54
+ stackType = input("normal", ...ngDevMode ? [{ debugName: "stackType" }] : /* istanbul ignore next */ []);
55
+ markers = input(false, {
56
+ ...ngDevMode ? { debugName: "markers" } : /* istanbul ignore next */ {},
57
+ transform: booleanAttribute
58
+ });
59
+ showLegend = input(true, {
60
+ ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
61
+ transform: booleanAttribute
62
+ });
63
+ legendPosition = input("top", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
64
+ legendAlign = input("start", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
65
+ legendVariant = input("line", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
66
+ showTooltip = input(true, {
67
+ ...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
68
+ transform: booleanAttribute
69
+ });
70
+ tooltipMode = input("shared", ...ngDevMode ? [{ debugName: "tooltipMode" }] : /* istanbul ignore next */ []);
71
+ tooltipFormatter = input(null, ...ngDevMode ? [{ debugName: "tooltipFormatter" }] : /* istanbul ignore next */ []);
72
+ valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
73
+ yScale = input("linear", ...ngDevMode ? [{ debugName: "yScale" }] : /* istanbul ignore next */ []);
74
+ yMin = input(void 0, ...ngDevMode ? [{ debugName: "yMin" }] : /* istanbul ignore next */ []);
75
+ yMax = input(void 0, ...ngDevMode ? [{ debugName: "yMax" }] : /* istanbul ignore next */ []);
76
+ xAxisTitle = input("", ...ngDevMode ? [{ debugName: "xAxisTitle" }] : /* istanbul ignore next */ []);
77
+ yAxisTitle = input("", ...ngDevMode ? [{ debugName: "yAxisTitle" }] : /* istanbul ignore next */ []);
78
+ grid = input("value", ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
79
+ xAxisPosition = input("bottom", ...ngDevMode ? [{ debugName: "xAxisPosition" }] : /* istanbul ignore next */ []);
80
+ yAxisPosition = input("left", ...ngDevMode ? [{ debugName: "yAxisPosition" }] : /* istanbul ignore next */ []);
81
+ labelMode = input("auto", ...ngDevMode ? [{ debugName: "labelMode" }] : /* istanbul ignore next */ []);
82
+ maxLabels = input(10, ...ngDevMode ? [{ debugName: "maxLabels" }] : /* istanbul ignore next */ []);
83
+ decimation = input(true, {
84
+ ...ngDevMode ? { debugName: "decimation" } : /* istanbul ignore next */ {},
85
+ transform: booleanAttribute
86
+ });
87
+ toolbar = input(true, {
88
+ ...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
89
+ transform: booleanAttribute
90
+ });
91
+ loading = input(false, {
92
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
93
+ transform: booleanAttribute
94
+ });
95
+ ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
96
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
97
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
98
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
99
+ unstyled = input(void 0, {
100
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
101
+ transform: optionalBoolean
102
+ });
103
+ seriesToggle = output();
104
+ pointClick = output();
105
+ legendTemplate = contentChild(TxChartLegendTemplate, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
106
+ tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
107
+ frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
108
+ layer = viewChild("layer", ...ngDevMode ? [{ debugName: "layer" }] : /* istanbul ignore next */ []);
109
+ host = inject(ElementRef);
110
+ isUnstyled = injectUnstyled(this.unstyled);
111
+ passThrough = injectPassThrough("lineChart", this, this.pt, this.ptOptions);
112
+ tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
113
+ hostStyle = computed(() => ({
114
+ ...this.tokenStyle(),
115
+ ...this.passThrough().root?.style
116
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
117
+ entrance = injectChartEntrance();
118
+ morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
119
+ uid = uniqueId("tx-line-chart");
120
+ hidden = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
121
+ focusedSeries = signal(null, ...ngDevMode ? [{ debugName: "focusedSeries" }] : /* istanbul ignore next */ []);
122
+ active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
123
+ size = linkedSignal(() => initialChartSize(this.height(), this.legendShown() ? this.legendPosition() : null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
124
+ intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
125
+ list = computed(() => this.series() ?? [], ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
126
+ fullTable = computed(() => {
127
+ const categories = this.categories() ?? [];
128
+ const fallback = this.xType() === "category" && !categories.length && this.list().every((item) => item.data.every((value) => typeof value !== "object"));
129
+ const table = normalizeSeries(this.list(), fallback ? chartMonthNames(this.intl(), "long") : categories, this.xType());
130
+ const limit = this.maxPoints();
131
+ if (!limit || limit < 2 || table.xs.length <= limit) return table;
132
+ const from = table.xs.length - limit;
133
+ return {
134
+ labels: table.labels.slice(from),
135
+ xs: this.xType() === "category" ? table.xs.slice(from).map((_, index) => index) : table.xs.slice(from),
136
+ values: table.values.map((row) => row.slice(from))
137
+ };
138
+ }, ...ngDevMode ? [{ debugName: "fullTable" }] : /* istanbul ignore next */ []);
139
+ zoomable = computed(() => this.zoom() || this.brush(), ...ngDevMode ? [{ debugName: "zoomable" }] : /* istanbul ignore next */ []);
140
+ fullDomain = computed(() => {
141
+ const xs = this.fullTable().xs;
142
+ return xs.length ? [xs[0], xs[xs.length - 1] === xs[0] ? xs[0] + 1 : xs[xs.length - 1]] : [0, 1];
143
+ }, ...ngDevMode ? [{ debugName: "fullDomain" }] : /* istanbul ignore next */ []);
144
+ minSpan = computed(() => {
145
+ const [from, to] = this.fullDomain();
146
+ return this.xType() === "category" ? Math.min(to - from, MIN_CATEGORY_SPAN) : (to - from) * MIN_SPAN_SHARE;
147
+ }, ...ngDevMode ? [{ debugName: "minSpan" }] : /* istanbul ignore next */ []);
148
+ view = computed(() => {
149
+ const range = this.xRange();
150
+ if (!range || !this.zoomable()) return null;
151
+ const [low, high] = this.fullDomain();
152
+ const span = Math.max(this.minSpan(), Math.abs(range[1] - range[0]));
153
+ let from = Math.max(low, Math.min(range[0], range[1]));
154
+ let to = Math.min(high, from + span);
155
+ from = Math.max(low, to - span);
156
+ to = Math.min(high, from + span);
157
+ return from <= low && to >= high ? null : [from, to];
158
+ }, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
159
+ windowed = computed(() => {
160
+ const full = this.fullTable();
161
+ const view = this.view();
162
+ if (!view) return {
163
+ table: full,
164
+ start: 0
165
+ };
166
+ const xs = full.xs;
167
+ let start;
168
+ let end;
169
+ if (this.xType() === "category") {
170
+ start = Math.max(0, Math.floor(view[0]));
171
+ end = Math.min(xs.length - 1, Math.ceil(view[1]));
172
+ } else {
173
+ const first = xs.findIndex((x) => x >= view[0]);
174
+ const last = xs.length - 1 - [...xs].reverse().findIndex((x) => x <= view[1]);
175
+ start = Math.max(0, (first < 0 ? xs.length - 1 : first) - 1);
176
+ end = Math.min(xs.length - 1, (last >= xs.length ? 0 : last) + 1);
177
+ }
178
+ return {
179
+ start,
180
+ table: {
181
+ labels: full.labels.slice(start, end + 1),
182
+ xs: this.xType() === "category" ? xs.slice(start, end + 1).map((_, index) => index) : xs.slice(start, end + 1),
183
+ values: full.values.map((row) => row.slice(start, end + 1))
184
+ }
185
+ };
186
+ }, ...ngDevMode ? [{ debugName: "windowed" }] : /* istanbul ignore next */ []);
187
+ table = computed(() => this.windowed().table, ...ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []);
188
+ offset = computed(() => this.windowed().start, ...ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []);
189
+ keys = computed(() => this.list().map((item, index) => `${index}:${item.name}`), ...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
190
+ visibleIndexes = computed(() => this.keys().flatMap((key, index) => this.hidden().has(key) ? [] : [index]), ...ngDevMode ? [{ debugName: "visibleIndexes" }] : /* istanbul ignore next */ []);
191
+ isEmpty = computed(() => !this.list().length || !hasChartData(this.table().values), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
192
+ isStacked = computed(() => this.stacked() || this.stackType() === "100%", ...ngDevMode ? [{ debugName: "isStacked" }] : /* istanbul ignore next */ []);
193
+ legendShown = computed(() => this.showLegend() && this.list().length > 1, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
194
+ stackedValues = computed(() => {
195
+ const values = this.table().values;
196
+ const visible = new Set(this.visibleIndexes());
197
+ const rows = values.map((row, index) => visible.has(index) ? row : row.map(() => null));
198
+ return stackValues(rows, this.stackType());
199
+ }, ...ngDevMode ? [{ debugName: "stackedValues" }] : /* istanbul ignore next */ []);
200
+ valueExtent = computed(() => {
201
+ const visible = this.visibleIndexes();
202
+ if (this.isStacked()) {
203
+ const all = this.stackedValues().flatMap((row, index) => visible.includes(index) ? row.flatMap((value) => value ? [value[0], value[1]] : []) : []);
204
+ return extent(all) ?? [0, 1];
205
+ }
206
+ return extent(visible.flatMap((index) => this.table().values[index])) ?? [0, 1];
207
+ }, ...ngDevMode ? [{ debugName: "valueExtent" }] : /* istanbul ignore next */ []);
208
+ axisFormat = computed(() => this.stackType() === "100%" && this.isStacked() && this.valueFormat() === "number" ? "percent" : this.valueFormat(), ...ngDevMode ? [{ debugName: "axisFormat" }] : /* istanbul ignore next */ []);
209
+ timeLabel = computed(() => {
210
+ const xs = this.table().xs;
211
+ if (this.xType() !== "time" || xs.length < 1) return null;
212
+ return timeTooltipFormatter(this.intl(), timeInterval(xs[0], xs[xs.length - 1], Math.max(2, Math.min(12, xs.length))));
213
+ }, ...ngDevMode ? [{ debugName: "timeLabel" }] : /* istanbul ignore next */ []);
214
+ labels = computed(() => {
215
+ const format = this.timeLabel();
216
+ const { labels, xs } = this.table();
217
+ return format ? xs.map((x) => format(x)) : labels;
218
+ }, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
219
+ layout = computed(() => {
220
+ const { width } = this.size();
221
+ const height = this.size().height - (this.brush() ? 62 : 0);
222
+ const { xs } = this.table();
223
+ const kind = this.xType() === "category" ? "point" : this.xType() === "time" ? "time" : "linear";
224
+ const view = this.view();
225
+ const domain = view && this.xType() !== "category" ? view : xs.length ? [xs[0], xs[xs.length - 1] === xs[0] ? xs[0] + 1 : xs[xs.length - 1]] : [0, 1];
226
+ return cartesianLayout({
227
+ width,
228
+ height,
229
+ intl: this.intl(),
230
+ category: {
231
+ kind,
232
+ labels: this.table().labels,
233
+ count: xs.length,
234
+ domain,
235
+ labelMode: this.labelMode(),
236
+ maxLabels: this.maxLabels(),
237
+ title: this.xAxisTitle() || void 0
238
+ },
239
+ value: {
240
+ extent: this.valueExtent(),
241
+ scale: this.yScale(),
242
+ format: this.axisFormat(),
243
+ includeZero: this.area() || this.isStacked(),
244
+ min: this.isStacked() && this.stackType() === "100%" ? 0 : this.yMin(),
245
+ max: this.isStacked() && this.stackType() === "100%" ? 100 : this.yMax(),
246
+ title: this.yAxisTitle() || void 0
247
+ },
248
+ grid: this.grid(),
249
+ xAxisPosition: this.xAxisPosition(),
250
+ yAxisPosition: this.yAxisPosition()
251
+ });
252
+ }, ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
253
+ xPositions = computed(() => {
254
+ const layout = this.layout();
255
+ const { xs } = this.table();
256
+ return xs.map((x, index) => layout.categoryPosition(index, x));
257
+ }, ...ngDevMode ? [{ debugName: "xPositions" }] : /* istanbul ignore next */ []);
258
+ paths = computed(() => {
259
+ const layout = this.layout();
260
+ const xs = this.xPositions();
261
+ const { values } = this.table();
262
+ const stacked = this.isStacked();
263
+ const stackedValues = this.stackedValues();
264
+ const visible = this.visibleIndexes();
265
+ const scale = layout.value;
266
+ const base = scale.map(scale.domain[0] <= 0 && scale.domain[1] >= 0 ? 0 : scale.domain[0]);
267
+ const threshold = Math.max(16, Math.round(layout.plot.width * DECIMATE_RATIO));
268
+ const curve = this.curve();
269
+ return visible.map((seriesIndex) => {
270
+ const item = this.list()[seriesIndex];
271
+ const top = values[seriesIndex].map((value, index) => {
272
+ if (value === null) return null;
273
+ const y = stacked ? stackedValues[seriesIndex][index]?.[1] ?? null : value;
274
+ return y === null ? null : {
275
+ x: xs[index],
276
+ y: scale.map(y)
277
+ };
278
+ });
279
+ const bottom = values[seriesIndex].map((value, index) => {
280
+ if (value === null) return null;
281
+ const y0 = stacked ? stackedValues[seriesIndex][index]?.[0] ?? 0 : null;
282
+ return {
283
+ x: xs[index],
284
+ y: y0 === null ? base : scale.map(y0)
285
+ };
286
+ });
287
+ const sampled = this.decimation() && top.length > threshold ? decimateSeries(top, threshold) : null;
288
+ const drawnTop = sampled ?? top;
289
+ const drawnBottom = sampled ? sampled.map((point) => point ? bottom[point.index] ?? null : null) : bottom;
290
+ const showMarkers = this.markers() && top.length <= layout.plot.width / 6;
291
+ return {
292
+ index: seriesIndex,
293
+ key: this.keys()[seriesIndex],
294
+ name: item.name,
295
+ color: seriesColor(item.color, seriesIndex),
296
+ line: linePath(drawnTop, curve),
297
+ area: this.area() ? areaPath(drawnTop, drawnBottom, curve) : "",
298
+ markers: showMarkers ? top.flatMap((point, index) => point ? [{
299
+ x: point.x,
300
+ y: point.y,
301
+ index
302
+ }] : []) : [],
303
+ gradient: `${this.uid}-fill-${seriesIndex}`
304
+ };
305
+ });
306
+ }, ...ngDevMode ? [{ debugName: "paths" }] : /* istanbul ignore next */ []);
307
+ clip = computed(() => {
308
+ const plot = this.layout().plot;
309
+ return {
310
+ x: plot.left - CLIP_PAD,
311
+ y: plot.top - CLIP_PAD,
312
+ width: plot.width + 16,
313
+ height: plot.height + 16
314
+ };
315
+ }, ...ngDevMode ? [{ debugName: "clip" }] : /* istanbul ignore next */ []);
316
+ clipped = computed(() => this.zoomable() || this.live(), ...ngDevMode ? [{ debugName: "clipped" }] : /* istanbul ignore next */ []);
317
+ overview = computed(() => {
318
+ if (!this.brush() || this.isEmpty()) return null;
319
+ const plot = this.layout().plot;
320
+ const top = this.size().height - OVERVIEW;
321
+ const full = this.fullTable();
322
+ const [low, high] = this.fullDomain();
323
+ const span = high - low || 1;
324
+ const at = (u) => plot.left + (u - low) / span * plot.width;
325
+ const seriesIndex = this.visibleIndexes()[0] ?? 0;
326
+ const values = full.values[seriesIndex] ?? [];
327
+ const range = extent(values) ?? [0, 1];
328
+ const bottom = Math.min(0, range[0]);
329
+ const peak = range[1] === bottom ? bottom + 1 : range[1];
330
+ const points = values.map((value, index) => value === null ? null : {
331
+ x: at(full.xs[index]),
332
+ y: top + OVERVIEW - OVERVIEW_PAD - (value - bottom) / (peak - bottom) * 36
333
+ });
334
+ const base = points.map((point) => point ? {
335
+ x: point.x,
336
+ y: top + OVERVIEW
337
+ } : null);
338
+ const [from, to] = this.view() ?? [low, high];
339
+ return {
340
+ top,
341
+ height: OVERVIEW,
342
+ left: plot.left,
343
+ width: plot.width,
344
+ line: linePath(points, this.curve()),
345
+ area: areaPath(points, base, this.curve()),
346
+ x0: at(from),
347
+ x1: at(to),
348
+ color: seriesColor(this.list()[seriesIndex]?.color, seriesIndex),
349
+ handleY: top + 12,
350
+ handleHeight: OVERVIEW_HANDLE
351
+ };
352
+ }, ...ngDevMode ? [{ debugName: "overview" }] : /* istanbul ignore next */ []);
353
+ annotationShapes = computed(() => {
354
+ const layout = this.layout();
355
+ return chartAnnotationShapes(this.annotations(), {
356
+ plot: layout.plot,
357
+ x: (value) => this.xPosition(value),
358
+ y: (value) => layout.value.map(value)
359
+ });
360
+ }, ...ngDevMode ? [{ debugName: "annotationShapes" }] : /* istanbul ignore next */ []);
361
+ legendItems = computed(() => {
362
+ const stat = this.legendVariant() === "stat";
363
+ const active = this.active();
364
+ const format = this.formatValue();
365
+ return this.list().map((item, index) => {
366
+ const values = this.table().values[index] ?? [];
367
+ let at = active?.index ?? -1;
368
+ if (stat && at < 0) {
369
+ for (let cursor = values.length - 1; cursor >= 0; cursor--) if (values[cursor] !== null) {
370
+ at = cursor;
371
+ break;
372
+ }
373
+ }
374
+ const raw = at >= 0 ? values[at] : null;
375
+ return {
376
+ key: this.keys()[index],
377
+ label: item.name,
378
+ color: seriesColor(item.color, index),
379
+ hidden: this.hidden().has(this.keys()[index]),
380
+ ...stat ? {
381
+ value: raw === null || raw === void 0 ? "—" : format(raw, index, at),
382
+ caption: at >= 0 ? this.labels()[at] : void 0
383
+ } : {}
384
+ };
385
+ });
386
+ }, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
387
+ valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat() === "number" ? "integer" : this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
388
+ formatValue = computed(() => {
389
+ const custom = this.tooltipFormatter();
390
+ const format = this.valueFormatter();
391
+ return (value, seriesIndex, dataPointIndex) => custom ? custom(value, {
392
+ seriesIndex,
393
+ dataPointIndex
394
+ }) : format(value);
395
+ }, ...ngDevMode ? [{ debugName: "formatValue" }] : /* istanbul ignore next */ []);
396
+ crosshair = computed(() => {
397
+ const active = this.active();
398
+ if (!active) return null;
399
+ const x = this.xPositions()[active.index];
400
+ const plot = this.layout().plot;
401
+ return x === void 0 ? null : {
402
+ x,
403
+ y1: plot.top,
404
+ y2: plot.top + plot.height
405
+ };
406
+ }, ...ngDevMode ? [{ debugName: "crosshair" }] : /* istanbul ignore next */ []);
407
+ activePoints = computed(() => {
408
+ const active = this.active();
409
+ if (!active) return [];
410
+ const scale = this.layout().value;
411
+ const x = this.xPositions()[active.index];
412
+ return this.visibleIndexes().flatMap((seriesIndex) => {
413
+ const value = this.pointValue(seriesIndex, active.index);
414
+ if (value === null || this.tooltipMode() === "single" && seriesIndex !== active.series) return [];
415
+ return [{
416
+ x,
417
+ y: scale.map(value),
418
+ color: seriesColor(this.list()[seriesIndex].color, seriesIndex),
419
+ series: seriesIndex
420
+ }];
421
+ });
422
+ }, ...ngDevMode ? [{ debugName: "activePoints" }] : /* istanbul ignore next */ []);
423
+ tooltip = computed(() => {
424
+ const active = this.active();
425
+ if (!active || !this.showTooltip() || this.isEmpty() || this.legendVariant() === "stat") return null;
426
+ const format = this.formatValue();
427
+ const rows = this.visibleIndexes().filter((seriesIndex) => this.tooltipMode() === "shared" || seriesIndex === active.series).flatMap((seriesIndex) => {
428
+ const raw = this.table().values[seriesIndex][active.index];
429
+ if (raw === null || raw === void 0) return [];
430
+ return [{
431
+ label: this.list()[seriesIndex].name,
432
+ value: format(raw, seriesIndex, active.index),
433
+ color: seriesColor(this.list()[seriesIndex].color, seriesIndex),
434
+ raw,
435
+ seriesIndex,
436
+ active: seriesIndex === active.series
437
+ }];
438
+ });
439
+ if (!rows.length) return null;
440
+ const points = this.activePoints();
441
+ const x = this.xPositions()[active.index];
442
+ const y = this.tooltipMode() === "single" ? points.find((point) => point.series === active.series)?.y ?? this.layout().plot.top : this.layout().plot.top;
443
+ const total = this.isStacked() && rows.length > 1 ? this.valueFormatter()(rows.reduce((sum, row) => sum + (row.raw ?? 0), 0)) : void 0;
444
+ return {
445
+ title: this.labels()[active.index] ?? "",
446
+ rows,
447
+ index: active.index,
448
+ x,
449
+ y,
450
+ placement: "top",
451
+ total
452
+ };
453
+ }, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
454
+ summary = computed(() => {
455
+ const t = this.translations();
456
+ const type = this.area() ? t.chartArea : t.chartLine;
457
+ const values = this.fullTable().values.flat().filter((value) => value !== null);
458
+ const range = extent(values);
459
+ const format = this.valueFormatter();
460
+ const text = chartSummary(t, this.intl(), type, this.list().length, this.fullTable().xs.length, range ? [format(range[0]), format(range[1])] : null);
461
+ return this.ariaLabel() ? `${this.ariaLabel()}. ${text}` : text;
462
+ }, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
463
+ dataTable = computed(() => {
464
+ const format = this.valueFormatter();
465
+ const full = this.fullTable();
466
+ const time = this.timeLabel();
467
+ return chartTable(time ? full.xs.map((x) => time(x)) : full.labels, this.list().map((item, index) => ({
468
+ name: item.name,
469
+ values: full.values[index]
470
+ })), format);
471
+ }, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
472
+ drag = null;
473
+ suppressClick = false;
474
+ anchor = null;
475
+ constructor() {
476
+ afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
477
+ afterRenderEffect(() => this.slide());
478
+ }
479
+ resetZoom() {
480
+ this.active.set(null);
481
+ this.xRange.set(null);
482
+ }
483
+ zoomAt(px, factor) {
484
+ const [low, high] = this.fullDomain();
485
+ const current = this.view() ?? [low, high];
486
+ const plot = this.layout().plot;
487
+ const span = current[1] - current[0];
488
+ const share = Math.max(0, Math.min(1, (px - plot.left) / Math.max(1, plot.width)));
489
+ const at = current[0] + share * span;
490
+ const next = Math.max(this.minSpan(), Math.min(high - low, span * factor));
491
+ this.setRange([at - share * next, at - share * next + next]);
492
+ }
493
+ panBy(dx) {
494
+ const current = this.view();
495
+ if (!current) return;
496
+ const span = current[1] - current[0];
497
+ const du = -dx / Math.max(1, this.layout().plot.width) * span;
498
+ this.setRange([current[0] + du, current[1] + du]);
499
+ }
500
+ setRange(range) {
501
+ const [low, high] = this.fullDomain();
502
+ const span = Math.min(high - low, Math.max(this.minSpan(), range[1] - range[0]));
503
+ const from = Math.max(low, Math.min(high - span, range[0]));
504
+ this.active.set(null);
505
+ this.xRange.set(from <= low && from + span >= high ? null : [from, from + span]);
506
+ }
507
+ fromOverview(px) {
508
+ const overview = this.overview();
509
+ const [low, high] = this.fullDomain();
510
+ return overview ? low + (px - overview.left) / Math.max(1, overview.width) * (high - low) : low;
511
+ }
512
+ handleDrag(event) {
513
+ const overview = this.overview();
514
+ const inOverview = !!overview && event.y >= overview.top - OVERVIEW_GAP / 2;
515
+ if (event.type === "down") {
516
+ const current = this.view() ?? this.fullDomain();
517
+ if (overview && inOverview) {
518
+ const near = HANDLE_REACH;
519
+ let range = [current[0], current[1]];
520
+ let mode = "move";
521
+ if (Math.abs(event.x - overview.x0) <= near) mode = "start";
522
+ else if (Math.abs(event.x - overview.x1) <= near) mode = "end";
523
+ else if (event.x < overview.x0 || event.x > overview.x1) {
524
+ const centre = this.fromOverview(event.x);
525
+ const span = current[1] - current[0];
526
+ this.setRange([centre - span / 2, centre + span / 2]);
527
+ range = this.view() ?? this.fullDomain();
528
+ }
529
+ this.drag = {
530
+ mode,
531
+ x: event.x,
532
+ range,
533
+ moved: false,
534
+ overview: true
535
+ };
536
+ this.active.set(null);
537
+ return true;
538
+ }
539
+ if (this.view()) this.drag = {
540
+ mode: "pan",
541
+ x: event.x,
542
+ range: [current[0], current[1]],
543
+ moved: false,
544
+ overview: false
545
+ };
546
+ return false;
547
+ }
548
+ if (event.type === "move" && this.drag) {
549
+ if (!((event.buttons ?? 0) & 1)) {
550
+ this.drag = null;
551
+ return false;
552
+ }
553
+ const drag = this.drag;
554
+ const dx = event.x - drag.x;
555
+ if (Math.abs(dx) > DRAG_THRESHOLD) drag.moved = true;
556
+ if (!drag.moved) return drag.overview;
557
+ const [from, to] = drag.range;
558
+ if (drag.overview && overview) {
559
+ const [low, high] = this.fullDomain();
560
+ const du = dx / Math.max(1, overview.width) * (high - low);
561
+ if (drag.mode === "start") this.setRange([Math.min(from + du, to - this.minSpan()), to]);
562
+ else if (drag.mode === "end") this.setRange([from, Math.max(to + du, from + this.minSpan())]);
563
+ else this.setRange([from + du, to + du]);
564
+ } else {
565
+ const du = -dx / Math.max(1, this.layout().plot.width) * (to - from);
566
+ this.setRange([from + du, to + du]);
567
+ }
568
+ this.active.set(null);
569
+ return true;
570
+ }
571
+ if (event.type === "up") {
572
+ const drag = this.drag;
573
+ this.drag = null;
574
+ if (drag?.moved) this.suppressClick = true;
575
+ return !!drag?.overview || !!drag?.moved;
576
+ }
577
+ if (event.type === "click" && (this.suppressClick || inOverview)) {
578
+ this.suppressClick = false;
579
+ return true;
580
+ }
581
+ return false;
582
+ }
583
+ slide() {
584
+ const table = this.table();
585
+ const positions = this.xPositions();
586
+ const live = this.live();
587
+ const layer = this.layer()?.nativeElement;
588
+ const last = table.xs.length - 1;
589
+ if (last < 0) {
590
+ this.anchor = null;
591
+ return;
592
+ }
593
+ const identity = (index) => this.xType() === "category" ? table.labels[index] : String(table.xs[index]);
594
+ const anchor = this.anchor;
595
+ this.anchor = {
596
+ id: identity(last),
597
+ px: positions[last]
598
+ };
599
+ if (!live || !anchor || !layer || this.view() || prefersReducedMotion(this.host.nativeElement.ownerDocument)) return;
600
+ let at = -1;
601
+ for (let index = last; index >= 0; index--) if (identity(index) === anchor.id) {
602
+ at = index;
603
+ break;
604
+ }
605
+ if (at < 0 || at === last) return;
606
+ const dx = anchor.px - positions[at];
607
+ if (Math.abs(dx) < .5) return;
608
+ const duration = readTokenNumber(this.host.nativeElement, "--tx-chart-motion-update-duration", SLIDE_SECONDS) * 1e3;
609
+ layer.animate([{ transform: `translateX(${dx}px)` }, { transform: "translateX(0)" }], {
610
+ duration,
611
+ easing: SLIDE_EASING
612
+ });
613
+ }
614
+ xPosition(value) {
615
+ const layout = this.layout();
616
+ const { xs } = this.table();
617
+ if (this.xType() === "category") {
618
+ const index = chartCategoryIndex(value, this.fullTable().labels) - this.offset();
619
+ return index < 0 || index >= xs.length ? null : layout.categoryPosition(index, xs[index]);
620
+ }
621
+ const x = this.xType() === "time" ? toTime(value) : typeof value === "number" ? value : Number(value);
622
+ return x === null || !Number.isFinite(x) ? null : layout.categoryPosition(0, x);
623
+ }
624
+ pointValue(seriesIndex, index) {
625
+ const raw = this.table().values[seriesIndex]?.[index] ?? null;
626
+ if (raw === null) return null;
627
+ return this.isStacked() ? this.stackedValues()[seriesIndex][index]?.[1] ?? null : raw;
628
+ }
629
+ onPointer(event) {
630
+ if (event.type === "leave") {
631
+ this.drag = null;
632
+ this.active.set(null);
633
+ return;
634
+ }
635
+ if (this.zoomable() && this.handleDrag(event)) return;
636
+ const plot = this.layout().plot;
637
+ if (event.x < plot.left - 8 || event.x > plot.left + plot.width + 8 || event.y < plot.top - 8 || event.y > plot.top + plot.height + 8) {
638
+ this.active.set(null);
639
+ return;
640
+ }
641
+ const index = this.layout().categoryIndexAt(event.x, this.table().xs);
642
+ if (index < 0) return;
643
+ const series = this.nearestSeries(index, event.y);
644
+ this.active.set({
645
+ index,
646
+ series,
647
+ pointerY: event.y,
648
+ keyboard: false
649
+ });
650
+ if (event.type === "click" && series >= 0) this.pointClick.emit({
651
+ seriesIndex: series,
652
+ dataPointIndex: index + this.offset(),
653
+ value: this.table().values[series][index],
654
+ category: this.labels()[index] ?? ""
655
+ });
656
+ }
657
+ onNavigate(event) {
658
+ if (this.zoomable() && this.zoomKey(event)) return;
659
+ const count = this.table().xs.length;
660
+ const current = this.active();
661
+ if (event.key === "Escape") {
662
+ this.active.set(null);
663
+ return;
664
+ }
665
+ const visible = this.visibleIndexes();
666
+ let index = current?.index ?? -1;
667
+ let series = current?.series ?? visible[0] ?? -1;
668
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
669
+ series = cycleIndex(series, event.key === "ArrowDown" ? 1 : -1, visible);
670
+ index = Math.max(0, index);
671
+ } else index = stepIndex(event.key, index, count);
672
+ if (index < 0 || series < 0) return;
673
+ this.active.set({
674
+ index,
675
+ series,
676
+ pointerY: null,
677
+ keyboard: true
678
+ });
679
+ const value = this.table().values[series][index];
680
+ this.frame()?.announce(formatMessage(this.translations().chartPoint, {
681
+ series: this.list()[series].name,
682
+ category: this.labels()[index] ?? "",
683
+ value: value === null ? "—" : this.formatValue()(value, series, index)
684
+ }));
685
+ }
686
+ zoomKey(event) {
687
+ const plot = this.layout().plot;
688
+ const active = this.active();
689
+ const focus = active ? this.xPositions()[active.index] ?? plot.left + plot.width / 2 : plot.left + plot.width / 2;
690
+ if (event.key === "+" || event.key === "=") this.zoomAt(focus, KEY_ZOOM);
691
+ else if (event.key === "-" || event.key === "_") this.zoomAt(focus, 1 / KEY_ZOOM);
692
+ else if (event.key === "0") this.resetZoom();
693
+ else if (event.shiftKey && (event.key === "ArrowLeft" || event.key === "ArrowRight") && this.view()) this.panBy((event.key === "ArrowLeft" ? 1 : -1) * plot.width * KEY_PAN);
694
+ else return false;
695
+ this.active.set(null);
696
+ return true;
697
+ }
698
+ onLegendToggle(key) {
699
+ const index = this.keys().indexOf(key);
700
+ this.hidden.update((keys) => toggleKey(keys, key));
701
+ this.seriesToggle.emit({
702
+ seriesIndex: index,
703
+ name: this.list()[index]?.name ?? "",
704
+ hidden: this.hidden().has(key)
705
+ });
706
+ }
707
+ onLegendHover(key) {
708
+ const index = key === null ? -1 : this.keys().indexOf(key);
709
+ this.focusedSeries.set(index >= 0 && !this.hidden().has(key ?? "") ? index : null);
710
+ }
711
+ nearestSeries(index, y) {
712
+ const scale = this.layout().value;
713
+ let best = this.visibleIndexes()[0] ?? -1;
714
+ let distance = Infinity;
715
+ for (const seriesIndex of this.visibleIndexes()) {
716
+ const value = this.pointValue(seriesIndex, index);
717
+ if (value === null) continue;
718
+ const next = Math.abs(scale.map(value) - y);
719
+ if (next < distance) {
720
+ distance = next;
721
+ best = seriesIndex;
722
+ }
723
+ }
724
+ return best;
725
+ }
726
+ static ɵfac = i0.ɵɵngDeclareFactory({
727
+ minVersion: "12.0.0",
728
+ version: "22.2.3",
729
+ ngImport: i0,
730
+ type: TxLineChart,
731
+ deps: [],
732
+ target: i0.ɵɵFactoryTarget.Component
733
+ });
734
+ static ɵcmp = i0.ɵɵngDeclareComponent({
735
+ minVersion: "17.0.0",
736
+ version: "22.2.3",
737
+ type: TxLineChart,
738
+ isStandalone: true,
739
+ selector: "tx-line-chart",
740
+ inputs: {
741
+ series: {
742
+ classPropertyName: "series",
743
+ publicName: "series",
744
+ isSignal: true,
745
+ isRequired: false,
746
+ transformFunction: null
747
+ },
748
+ categories: {
749
+ classPropertyName: "categories",
750
+ publicName: "categories",
751
+ isSignal: true,
752
+ isRequired: false,
753
+ transformFunction: null
754
+ },
755
+ xType: {
756
+ classPropertyName: "xType",
757
+ publicName: "xType",
758
+ isSignal: true,
759
+ isRequired: false,
760
+ transformFunction: null
761
+ },
762
+ annotations: {
763
+ classPropertyName: "annotations",
764
+ publicName: "annotations",
765
+ isSignal: true,
766
+ isRequired: false,
767
+ transformFunction: null
768
+ },
769
+ zoom: {
770
+ classPropertyName: "zoom",
771
+ publicName: "zoom",
772
+ isSignal: true,
773
+ isRequired: false,
774
+ transformFunction: null
775
+ },
776
+ brush: {
777
+ classPropertyName: "brush",
778
+ publicName: "brush",
779
+ isSignal: true,
780
+ isRequired: false,
781
+ transformFunction: null
782
+ },
783
+ xRange: {
784
+ classPropertyName: "xRange",
785
+ publicName: "xRange",
786
+ isSignal: true,
787
+ isRequired: false,
788
+ transformFunction: null
789
+ },
790
+ maxPoints: {
791
+ classPropertyName: "maxPoints",
792
+ publicName: "maxPoints",
793
+ isSignal: true,
794
+ isRequired: false,
795
+ transformFunction: null
796
+ },
797
+ live: {
798
+ classPropertyName: "live",
799
+ publicName: "live",
800
+ isSignal: true,
801
+ isRequired: false,
802
+ transformFunction: null
803
+ },
804
+ height: {
805
+ classPropertyName: "height",
806
+ publicName: "height",
807
+ isSignal: true,
808
+ isRequired: false,
809
+ transformFunction: null
810
+ },
811
+ curve: {
812
+ classPropertyName: "curve",
813
+ publicName: "curve",
814
+ isSignal: true,
815
+ isRequired: false,
816
+ transformFunction: null
817
+ },
818
+ area: {
819
+ classPropertyName: "area",
820
+ publicName: "area",
821
+ isSignal: true,
822
+ isRequired: false,
823
+ transformFunction: null
824
+ },
825
+ stacked: {
826
+ classPropertyName: "stacked",
827
+ publicName: "stacked",
828
+ isSignal: true,
829
+ isRequired: false,
830
+ transformFunction: null
831
+ },
832
+ stackType: {
833
+ classPropertyName: "stackType",
834
+ publicName: "stackType",
835
+ isSignal: true,
836
+ isRequired: false,
837
+ transformFunction: null
838
+ },
839
+ markers: {
840
+ classPropertyName: "markers",
841
+ publicName: "markers",
842
+ isSignal: true,
843
+ isRequired: false,
844
+ transformFunction: null
845
+ },
846
+ showLegend: {
847
+ classPropertyName: "showLegend",
848
+ publicName: "showLegend",
849
+ isSignal: true,
850
+ isRequired: false,
851
+ transformFunction: null
852
+ },
853
+ legendPosition: {
854
+ classPropertyName: "legendPosition",
855
+ publicName: "legendPosition",
856
+ isSignal: true,
857
+ isRequired: false,
858
+ transformFunction: null
859
+ },
860
+ legendAlign: {
861
+ classPropertyName: "legendAlign",
862
+ publicName: "legendAlign",
863
+ isSignal: true,
864
+ isRequired: false,
865
+ transformFunction: null
866
+ },
867
+ legendVariant: {
868
+ classPropertyName: "legendVariant",
869
+ publicName: "legendVariant",
870
+ isSignal: true,
871
+ isRequired: false,
872
+ transformFunction: null
873
+ },
874
+ showTooltip: {
875
+ classPropertyName: "showTooltip",
876
+ publicName: "showTooltip",
877
+ isSignal: true,
878
+ isRequired: false,
879
+ transformFunction: null
880
+ },
881
+ tooltipMode: {
882
+ classPropertyName: "tooltipMode",
883
+ publicName: "tooltipMode",
884
+ isSignal: true,
885
+ isRequired: false,
886
+ transformFunction: null
887
+ },
888
+ tooltipFormatter: {
889
+ classPropertyName: "tooltipFormatter",
890
+ publicName: "tooltipFormatter",
891
+ isSignal: true,
892
+ isRequired: false,
893
+ transformFunction: null
894
+ },
895
+ valueFormat: {
896
+ classPropertyName: "valueFormat",
897
+ publicName: "valueFormat",
898
+ isSignal: true,
899
+ isRequired: false,
900
+ transformFunction: null
901
+ },
902
+ yScale: {
903
+ classPropertyName: "yScale",
904
+ publicName: "yScale",
905
+ isSignal: true,
906
+ isRequired: false,
907
+ transformFunction: null
908
+ },
909
+ yMin: {
910
+ classPropertyName: "yMin",
911
+ publicName: "yMin",
912
+ isSignal: true,
913
+ isRequired: false,
914
+ transformFunction: null
915
+ },
916
+ yMax: {
917
+ classPropertyName: "yMax",
918
+ publicName: "yMax",
919
+ isSignal: true,
920
+ isRequired: false,
921
+ transformFunction: null
922
+ },
923
+ xAxisTitle: {
924
+ classPropertyName: "xAxisTitle",
925
+ publicName: "xAxisTitle",
926
+ isSignal: true,
927
+ isRequired: false,
928
+ transformFunction: null
929
+ },
930
+ yAxisTitle: {
931
+ classPropertyName: "yAxisTitle",
932
+ publicName: "yAxisTitle",
933
+ isSignal: true,
934
+ isRequired: false,
935
+ transformFunction: null
936
+ },
937
+ grid: {
938
+ classPropertyName: "grid",
939
+ publicName: "grid",
940
+ isSignal: true,
941
+ isRequired: false,
942
+ transformFunction: null
943
+ },
944
+ xAxisPosition: {
945
+ classPropertyName: "xAxisPosition",
946
+ publicName: "xAxisPosition",
947
+ isSignal: true,
948
+ isRequired: false,
949
+ transformFunction: null
950
+ },
951
+ yAxisPosition: {
952
+ classPropertyName: "yAxisPosition",
953
+ publicName: "yAxisPosition",
954
+ isSignal: true,
955
+ isRequired: false,
956
+ transformFunction: null
957
+ },
958
+ labelMode: {
959
+ classPropertyName: "labelMode",
960
+ publicName: "labelMode",
961
+ isSignal: true,
962
+ isRequired: false,
963
+ transformFunction: null
964
+ },
965
+ maxLabels: {
966
+ classPropertyName: "maxLabels",
967
+ publicName: "maxLabels",
968
+ isSignal: true,
969
+ isRequired: false,
970
+ transformFunction: null
971
+ },
972
+ decimation: {
973
+ classPropertyName: "decimation",
974
+ publicName: "decimation",
975
+ isSignal: true,
976
+ isRequired: false,
977
+ transformFunction: null
978
+ },
979
+ toolbar: {
980
+ classPropertyName: "toolbar",
981
+ publicName: "toolbar",
982
+ isSignal: true,
983
+ isRequired: false,
984
+ transformFunction: null
985
+ },
986
+ loading: {
987
+ classPropertyName: "loading",
988
+ publicName: "loading",
989
+ isSignal: true,
990
+ isRequired: false,
991
+ transformFunction: null
992
+ },
993
+ ariaLabel: {
994
+ classPropertyName: "ariaLabel",
995
+ publicName: "ariaLabel",
996
+ isSignal: true,
997
+ isRequired: false,
998
+ transformFunction: null
999
+ },
1000
+ dt: {
1001
+ classPropertyName: "dt",
1002
+ publicName: "dt",
1003
+ isSignal: true,
1004
+ isRequired: false,
1005
+ transformFunction: null
1006
+ },
1007
+ pt: {
1008
+ classPropertyName: "pt",
1009
+ publicName: "pt",
1010
+ isSignal: true,
1011
+ isRequired: false,
1012
+ transformFunction: null
1013
+ },
1014
+ ptOptions: {
1015
+ classPropertyName: "ptOptions",
1016
+ publicName: "ptOptions",
1017
+ isSignal: true,
1018
+ isRequired: false,
1019
+ transformFunction: null
1020
+ },
1021
+ unstyled: {
1022
+ classPropertyName: "unstyled",
1023
+ publicName: "unstyled",
1024
+ isSignal: true,
1025
+ isRequired: false,
1026
+ transformFunction: null
1027
+ }
1028
+ },
1029
+ outputs: {
1030
+ xRange: "xRangeChange",
1031
+ seriesToggle: "seriesToggle",
1032
+ pointClick: "pointClick"
1033
+ },
1034
+ host: {
1035
+ properties: {
1036
+ "class": "passThrough().root?.class",
1037
+ "style": "hostStyle()",
1038
+ "attr.data-styled": "!isUnstyled() || null",
1039
+ "attr.data-curve": "curve()",
1040
+ "class.tx-line-chart--area": "area()",
1041
+ "class.tx-line-chart--fill": "typeof height() === \"string\"",
1042
+ "class.tx-line-chart--entering": "entrance.active()",
1043
+ "class.tx-line-chart--morph": "morph()",
1044
+ "class.tx-line-chart--focused": "focusedSeries() !== null",
1045
+ "class.tx-line-chart--live": "live()"
1046
+ },
1047
+ classAttribute: "tx-line-chart"
1048
+ },
1049
+ queries: [{
1050
+ propertyName: "legendTemplate",
1051
+ first: true,
1052
+ predicate: TxChartLegendTemplate,
1053
+ descendants: true,
1054
+ isSignal: true
1055
+ }, {
1056
+ propertyName: "tooltipTemplate",
1057
+ first: true,
1058
+ predicate: TxChartTooltipTemplate,
1059
+ descendants: true,
1060
+ isSignal: true
1061
+ }],
1062
+ viewQueries: [{
1063
+ propertyName: "frame",
1064
+ first: true,
1065
+ predicate: TxChartFrame,
1066
+ descendants: true,
1067
+ isSignal: true
1068
+ }, {
1069
+ propertyName: "layer",
1070
+ first: true,
1071
+ predicate: ["layer"],
1072
+ descendants: true,
1073
+ isSignal: true
1074
+ }],
1075
+ ngImport: i0,
1076
+ template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [legendItems]=\"legendItems()\"\n [showLegend]=\"legendShown()\"\n [legendPosition]=\"legendPosition()\"\n [legendAlign]=\"legendAlign()\"\n [legendVariant]=\"legendVariant()\"\n [legendTemplate]=\"legendTemplate()?.template\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-line\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n [zoomable]=\"zoomable()\"\n [zoomedIn]=\"!!view()\"\n (zoomed)=\"zoomAt($event.x, $event.factor)\"\n (panned)=\"panBy($event.dx)\"\n (zoomReset)=\"resetZoom()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n @if (clipped()) {\n <svg:clipPath [attr.id]=\"uid + '-clip'\">\n <svg:rect [attr.x]=\"clip().x\" [attr.y]=\"clip().y\" [attr.width]=\"clip().width\" [attr.height]=\"clip().height\" />\n </svg:clipPath>\n }\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"back\" [part]=\"passThrough().annotation\" />\n @if (crosshair(); as line) {\n <svg:line\n class=\"tx-line-chart__crosshair\"\n [class]=\"passThrough().crosshair?.class\"\n [style]=\"passThrough().crosshair?.style\"\n [attr.x1]=\"line.x\"\n [attr.x2]=\"line.x\"\n [attr.y1]=\"line.y1\"\n [attr.y2]=\"line.y2\"\n />\n }\n <svg:g #layer class=\"tx-line-chart__layer\" [attr.clip-path]=\"clipped() ? 'url(#' + uid + '-clip)' : null\">\n @for (path of paths(); track path.key) {\n <svg:g\n class=\"tx-line-chart__series\"\n [class.tx-line-chart__series--focused]=\"focusedSeries() === path.index\"\n [class]=\"passThrough().series?.class\"\n [style]=\"passThrough().series?.style\"\n [style.--tx-line-chart-color]=\"path.color\"\n [attr.data-series]=\"path.index\"\n >\n @if (path.area) {\n <svg:linearGradient [attr.id]=\"path.gradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <svg:stop class=\"tx-line-chart__stop-from\" offset=\"0\" [style.stop-color]=\"path.color\" />\n <svg:stop class=\"tx-line-chart__stop-to\" offset=\"0.95\" [style.stop-color]=\"path.color\" />\n </svg:linearGradient>\n <svg:path\n class=\"tx-line-chart__area\"\n [class.tx-line-chart__area--stacked]=\"isStacked()\"\n [class]=\"passThrough().area?.class\"\n [style]=\"passThrough().area?.style\"\n [attr.d]=\"path.area\"\n [attr.fill]=\"'url(#' + path.gradient + ')'\"\n />\n }\n <svg:path\n class=\"tx-line-chart__line\"\n [class]=\"passThrough().line?.class\"\n [style]=\"passThrough().line?.style\"\n [attr.d]=\"path.line\"\n [style.stroke]=\"path.color\"\n />\n @for (marker of path.markers; track marker.index) {\n <svg:circle\n class=\"tx-line-chart__point\"\n [class]=\"passThrough().marker?.class\"\n [style]=\"passThrough().marker?.style\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [style.fill]=\"path.color\"\n />\n }\n </svg:g>\n }\n @for (point of activePoints(); track point.series) {\n <svg:circle class=\"tx-line-chart__halo\" [attr.cx]=\"point.x\" [attr.cy]=\"point.y\" [style.fill]=\"point.color\" />\n <svg:circle\n class=\"tx-line-chart__marker\"\n [class]=\"passThrough().marker?.class\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [style.fill]=\"point.color\"\n />\n }\n </svg:g>\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"front\" [part]=\"passThrough().annotation\" />\n @if (overview(); as strip) {\n <svg:g class=\"tx-line-chart__overview\" [class]=\"passThrough().brush?.class\" [style]=\"passThrough().brush?.style\" [style.--tx-line-chart-color]=\"strip.color\">\n <svg:rect class=\"tx-line-chart__overview-track\" [attr.x]=\"strip.left\" [attr.y]=\"strip.top\" [attr.width]=\"strip.width\" [attr.height]=\"strip.height\" />\n <svg:path class=\"tx-line-chart__overview-area\" [attr.d]=\"strip.area\" />\n <svg:path class=\"tx-line-chart__overview-line\" [attr.d]=\"strip.line\" />\n <svg:rect class=\"tx-line-chart__overview-mask\" [attr.x]=\"strip.left\" [attr.y]=\"strip.top\" [attr.width]=\"strip.x0 - strip.left\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-mask\" [attr.x]=\"strip.x1\" [attr.y]=\"strip.top\" [attr.width]=\"strip.left + strip.width - strip.x1\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-window\" [attr.x]=\"strip.x0\" [attr.y]=\"strip.top\" [attr.width]=\"strip.x1 - strip.x0\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-handle\" [attr.x]=\"strip.x0 - 3\" [attr.y]=\"strip.handleY\" width=\"6\" [attr.height]=\"strip.handleHeight\" />\n <svg:rect class=\"tx-line-chart__overview-handle\" [attr.x]=\"strip.x1 - 3\" [attr.y]=\"strip.handleY\" width=\"6\" [attr.height]=\"strip.handleHeight\" />\n </svg:g>\n }\n</tx-chart-frame>\n",
1077
+ styles: [":host{display:block;min-width:0}:host(.tx-line-chart--fill){height:100%}.tx-line-chart__line{fill:none;stroke-linecap:round;stroke-linejoin:round}.tx-line-chart__overview{cursor:pointer}.tx-line-chart__overview-track{fill:transparent}.tx-line-chart__overview-area{fill:var(--tx-line-chart-color);fill-opacity:.2}.tx-line-chart__overview-line{fill:none;stroke:var(--tx-line-chart-color)}.tx-line-chart__overview-mask{fill:currentColor;fill-opacity:.08}.tx-line-chart__overview-window{fill:none;stroke:currentColor;cursor:grab}.tx-line-chart__overview-handle{fill:currentColor;cursor:ew-resize}.tx-line-chart__crosshair{pointer-events:none;shape-rendering:crispEdges}.tx-line-chart__marker,.tx-line-chart__halo,.tx-line-chart__point{pointer-events:none}:host([data-styled]) .tx-line-chart__line{stroke-width:var(--tx-chart-line-stroke-width)}:host([data-styled]) .tx-line-chart__stop-from{stop-opacity:var(--tx-chart-line-area-opacity-from)}:host([data-styled]) .tx-line-chart__stop-to{stop-opacity:var(--tx-chart-line-area-opacity-to)}:host([data-styled]) .tx-line-chart__area--stacked{fill:var(--tx-line-chart-color);fill-opacity:var(--tx-chart-line-stacked-area-opacity)}:host([data-styled]) .tx-line-chart__point{r:var(--tx-chart-line-point-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host([data-styled]) .tx-line-chart__marker{r:var(--tx-chart-marker-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host([data-styled]) .tx-line-chart__halo{r:var(--tx-chart-marker-halo-radius);opacity:var(--tx-chart-marker-halo-opacity)}:host([data-styled]) .tx-line-chart__crosshair{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled]) .tx-line-chart__series{transition:opacity var(--tx-chart-motion-update-duration) ease}:host([data-styled].tx-line-chart--focused) .tx-line-chart__series:not(.tx-line-chart__series--focused){opacity:var(--tx-chart-line-dimmed-opacity)}:host([data-styled].tx-line-chart--morph) .tx-line-chart__line,:host([data-styled].tx-line-chart--morph) .tx-line-chart__area{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-line-chart--morph) .tx-line-chart__point{transition:cx var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),cy var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-line-chart--entering) .tx-line-chart__series{animation:tx-line-chart-reveal var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}@keyframes tx-line-chart-reveal{0%{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0 0 0)}}:host([data-styled]) .tx-line-chart__overview-track{fill:var(--tx-chart-brush-track-background);rx:var(--tx-chart-brush-radius)}:host([data-styled]) .tx-line-chart__overview-area{fill-opacity:var(--tx-chart-brush-area-opacity)}:host([data-styled]) .tx-line-chart__overview-line{stroke-width:var(--tx-chart-brush-line-width)}:host([data-styled]) .tx-line-chart__overview-mask{fill:var(--tx-chart-brush-mask-color);fill-opacity:1}:host([data-styled]) .tx-line-chart__overview-window{stroke:var(--tx-chart-brush-window-border-color);stroke-width:var(--tx-chart-brush-window-border-width);rx:var(--tx-chart-brush-radius)}:host([data-styled]) .tx-line-chart__overview-handle{fill:var(--tx-chart-brush-handle-color);stroke:var(--tx-chart-brush-handle-border-color);rx:var(--tx-chart-brush-handle-radius)}:host([data-styled].tx-line-chart--live) .tx-line-chart__line,:host([data-styled].tx-line-chart--live) .tx-line-chart__area,:host([data-styled].tx-line-chart--live) .tx-line-chart__point{transition:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-line-chart__series,:host([data-styled].tx-line-chart--morph) .tx-line-chart__line,:host([data-styled].tx-line-chart--morph) .tx-line-chart__area,:host([data-styled].tx-line-chart--morph) .tx-line-chart__point{transition:none;animation:none}}\n"],
1078
+ dependencies: [
1079
+ {
1080
+ kind: "component",
1081
+ type: TxChartFrame,
1082
+ selector: "tx-chart-frame",
1083
+ inputs: [
1084
+ "height",
1085
+ "size",
1086
+ "legendItems",
1087
+ "showLegend",
1088
+ "legendPosition",
1089
+ "legendAlign",
1090
+ "legendVariant",
1091
+ "legendToggle",
1092
+ "legendTemplate",
1093
+ "empty",
1094
+ "loading",
1095
+ "emptyIcon",
1096
+ "summary",
1097
+ "table",
1098
+ "tooltip",
1099
+ "tooltipTemplate",
1100
+ "tooltipPlacement",
1101
+ "panelStyle",
1102
+ "parts",
1103
+ "styled",
1104
+ "interactive",
1105
+ "actionKeys",
1106
+ "zoomable",
1107
+ "zoomedIn",
1108
+ "plotHeight",
1109
+ "toolbar",
1110
+ "exportName"
1111
+ ],
1112
+ outputs: [
1113
+ "sizeChange",
1114
+ "pointer",
1115
+ "navigate",
1116
+ "legendToggled",
1117
+ "legendHovered",
1118
+ "tooltipClosed",
1119
+ "zoomed",
1120
+ "panned",
1121
+ "zoomReset"
1122
+ ]
1123
+ },
1124
+ {
1125
+ kind: "component",
1126
+ type: TxChartAxes,
1127
+ selector: "g[tx-chart-axes]",
1128
+ inputs: [
1129
+ "tx-chart-axes",
1130
+ "gridPart",
1131
+ "axisPart"
1132
+ ]
1133
+ },
1134
+ {
1135
+ kind: "component",
1136
+ type: TxChartAnnotations,
1137
+ selector: "g[tx-chart-annotations]",
1138
+ inputs: [
1139
+ "tx-chart-annotations",
1140
+ "part",
1141
+ "layer"
1142
+ ]
1143
+ }
1144
+ ],
1145
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1146
+ });
1147
+ };
1148
+ i0.ɵɵngDeclareClassMetadata({
1149
+ minVersion: "12.0.0",
1150
+ version: "22.2.3",
1151
+ ngImport: i0,
1152
+ type: TxLineChart,
1153
+ decorators: [{
1154
+ type: Component,
1155
+ args: [{
1156
+ selector: "tx-line-chart",
1157
+ imports: [
1158
+ TxChartFrame,
1159
+ TxChartAxes,
1160
+ TxChartAnnotations
1161
+ ],
1162
+ changeDetection: ChangeDetectionStrategy.OnPush,
1163
+ host: {
1164
+ class: "tx-line-chart",
1165
+ "[class]": "passThrough().root?.class",
1166
+ "[style]": "hostStyle()",
1167
+ "[attr.data-styled]": "!isUnstyled() || null",
1168
+ "[attr.data-curve]": "curve()",
1169
+ "[class.tx-line-chart--area]": "area()",
1170
+ "[class.tx-line-chart--fill]": "typeof height() === \"string\"",
1171
+ "[class.tx-line-chart--entering]": "entrance.active()",
1172
+ "[class.tx-line-chart--morph]": "morph()",
1173
+ "[class.tx-line-chart--focused]": "focusedSeries() !== null",
1174
+ "[class.tx-line-chart--live]": "live()"
1175
+ },
1176
+ template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [legendItems]=\"legendItems()\"\n [showLegend]=\"legendShown()\"\n [legendPosition]=\"legendPosition()\"\n [legendAlign]=\"legendAlign()\"\n [legendVariant]=\"legendVariant()\"\n [legendTemplate]=\"legendTemplate()?.template\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-line\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n [zoomable]=\"zoomable()\"\n [zoomedIn]=\"!!view()\"\n (zoomed)=\"zoomAt($event.x, $event.factor)\"\n (panned)=\"panBy($event.dx)\"\n (zoomReset)=\"resetZoom()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n @if (clipped()) {\n <svg:clipPath [attr.id]=\"uid + '-clip'\">\n <svg:rect [attr.x]=\"clip().x\" [attr.y]=\"clip().y\" [attr.width]=\"clip().width\" [attr.height]=\"clip().height\" />\n </svg:clipPath>\n }\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"back\" [part]=\"passThrough().annotation\" />\n @if (crosshair(); as line) {\n <svg:line\n class=\"tx-line-chart__crosshair\"\n [class]=\"passThrough().crosshair?.class\"\n [style]=\"passThrough().crosshair?.style\"\n [attr.x1]=\"line.x\"\n [attr.x2]=\"line.x\"\n [attr.y1]=\"line.y1\"\n [attr.y2]=\"line.y2\"\n />\n }\n <svg:g #layer class=\"tx-line-chart__layer\" [attr.clip-path]=\"clipped() ? 'url(#' + uid + '-clip)' : null\">\n @for (path of paths(); track path.key) {\n <svg:g\n class=\"tx-line-chart__series\"\n [class.tx-line-chart__series--focused]=\"focusedSeries() === path.index\"\n [class]=\"passThrough().series?.class\"\n [style]=\"passThrough().series?.style\"\n [style.--tx-line-chart-color]=\"path.color\"\n [attr.data-series]=\"path.index\"\n >\n @if (path.area) {\n <svg:linearGradient [attr.id]=\"path.gradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <svg:stop class=\"tx-line-chart__stop-from\" offset=\"0\" [style.stop-color]=\"path.color\" />\n <svg:stop class=\"tx-line-chart__stop-to\" offset=\"0.95\" [style.stop-color]=\"path.color\" />\n </svg:linearGradient>\n <svg:path\n class=\"tx-line-chart__area\"\n [class.tx-line-chart__area--stacked]=\"isStacked()\"\n [class]=\"passThrough().area?.class\"\n [style]=\"passThrough().area?.style\"\n [attr.d]=\"path.area\"\n [attr.fill]=\"'url(#' + path.gradient + ')'\"\n />\n }\n <svg:path\n class=\"tx-line-chart__line\"\n [class]=\"passThrough().line?.class\"\n [style]=\"passThrough().line?.style\"\n [attr.d]=\"path.line\"\n [style.stroke]=\"path.color\"\n />\n @for (marker of path.markers; track marker.index) {\n <svg:circle\n class=\"tx-line-chart__point\"\n [class]=\"passThrough().marker?.class\"\n [style]=\"passThrough().marker?.style\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [style.fill]=\"path.color\"\n />\n }\n </svg:g>\n }\n @for (point of activePoints(); track point.series) {\n <svg:circle class=\"tx-line-chart__halo\" [attr.cx]=\"point.x\" [attr.cy]=\"point.y\" [style.fill]=\"point.color\" />\n <svg:circle\n class=\"tx-line-chart__marker\"\n [class]=\"passThrough().marker?.class\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n [style.fill]=\"point.color\"\n />\n }\n </svg:g>\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"front\" [part]=\"passThrough().annotation\" />\n @if (overview(); as strip) {\n <svg:g class=\"tx-line-chart__overview\" [class]=\"passThrough().brush?.class\" [style]=\"passThrough().brush?.style\" [style.--tx-line-chart-color]=\"strip.color\">\n <svg:rect class=\"tx-line-chart__overview-track\" [attr.x]=\"strip.left\" [attr.y]=\"strip.top\" [attr.width]=\"strip.width\" [attr.height]=\"strip.height\" />\n <svg:path class=\"tx-line-chart__overview-area\" [attr.d]=\"strip.area\" />\n <svg:path class=\"tx-line-chart__overview-line\" [attr.d]=\"strip.line\" />\n <svg:rect class=\"tx-line-chart__overview-mask\" [attr.x]=\"strip.left\" [attr.y]=\"strip.top\" [attr.width]=\"strip.x0 - strip.left\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-mask\" [attr.x]=\"strip.x1\" [attr.y]=\"strip.top\" [attr.width]=\"strip.left + strip.width - strip.x1\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-window\" [attr.x]=\"strip.x0\" [attr.y]=\"strip.top\" [attr.width]=\"strip.x1 - strip.x0\" [attr.height]=\"strip.height\" />\n <svg:rect class=\"tx-line-chart__overview-handle\" [attr.x]=\"strip.x0 - 3\" [attr.y]=\"strip.handleY\" width=\"6\" [attr.height]=\"strip.handleHeight\" />\n <svg:rect class=\"tx-line-chart__overview-handle\" [attr.x]=\"strip.x1 - 3\" [attr.y]=\"strip.handleY\" width=\"6\" [attr.height]=\"strip.handleHeight\" />\n </svg:g>\n }\n</tx-chart-frame>\n",
1177
+ styles: [":host{display:block;min-width:0}:host(.tx-line-chart--fill){height:100%}.tx-line-chart__line{fill:none;stroke-linecap:round;stroke-linejoin:round}.tx-line-chart__overview{cursor:pointer}.tx-line-chart__overview-track{fill:transparent}.tx-line-chart__overview-area{fill:var(--tx-line-chart-color);fill-opacity:.2}.tx-line-chart__overview-line{fill:none;stroke:var(--tx-line-chart-color)}.tx-line-chart__overview-mask{fill:currentColor;fill-opacity:.08}.tx-line-chart__overview-window{fill:none;stroke:currentColor;cursor:grab}.tx-line-chart__overview-handle{fill:currentColor;cursor:ew-resize}.tx-line-chart__crosshair{pointer-events:none;shape-rendering:crispEdges}.tx-line-chart__marker,.tx-line-chart__halo,.tx-line-chart__point{pointer-events:none}:host([data-styled]) .tx-line-chart__line{stroke-width:var(--tx-chart-line-stroke-width)}:host([data-styled]) .tx-line-chart__stop-from{stop-opacity:var(--tx-chart-line-area-opacity-from)}:host([data-styled]) .tx-line-chart__stop-to{stop-opacity:var(--tx-chart-line-area-opacity-to)}:host([data-styled]) .tx-line-chart__area--stacked{fill:var(--tx-line-chart-color);fill-opacity:var(--tx-chart-line-stacked-area-opacity)}:host([data-styled]) .tx-line-chart__point{r:var(--tx-chart-line-point-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host([data-styled]) .tx-line-chart__marker{r:var(--tx-chart-marker-radius);stroke:var(--tx-chart-marker-stroke-color);stroke-width:var(--tx-chart-marker-stroke-width)}:host([data-styled]) .tx-line-chart__halo{r:var(--tx-chart-marker-halo-radius);opacity:var(--tx-chart-marker-halo-opacity)}:host([data-styled]) .tx-line-chart__crosshair{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled]) .tx-line-chart__series{transition:opacity var(--tx-chart-motion-update-duration) ease}:host([data-styled].tx-line-chart--focused) .tx-line-chart__series:not(.tx-line-chart__series--focused){opacity:var(--tx-chart-line-dimmed-opacity)}:host([data-styled].tx-line-chart--morph) .tx-line-chart__line,:host([data-styled].tx-line-chart--morph) .tx-line-chart__area{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-line-chart--morph) .tx-line-chart__point{transition:cx var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),cy var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-line-chart--entering) .tx-line-chart__series{animation:tx-line-chart-reveal var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}@keyframes tx-line-chart-reveal{0%{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0 0 0)}}:host([data-styled]) .tx-line-chart__overview-track{fill:var(--tx-chart-brush-track-background);rx:var(--tx-chart-brush-radius)}:host([data-styled]) .tx-line-chart__overview-area{fill-opacity:var(--tx-chart-brush-area-opacity)}:host([data-styled]) .tx-line-chart__overview-line{stroke-width:var(--tx-chart-brush-line-width)}:host([data-styled]) .tx-line-chart__overview-mask{fill:var(--tx-chart-brush-mask-color);fill-opacity:1}:host([data-styled]) .tx-line-chart__overview-window{stroke:var(--tx-chart-brush-window-border-color);stroke-width:var(--tx-chart-brush-window-border-width);rx:var(--tx-chart-brush-radius)}:host([data-styled]) .tx-line-chart__overview-handle{fill:var(--tx-chart-brush-handle-color);stroke:var(--tx-chart-brush-handle-border-color);rx:var(--tx-chart-brush-handle-radius)}:host([data-styled].tx-line-chart--live) .tx-line-chart__line,:host([data-styled].tx-line-chart--live) .tx-line-chart__area,:host([data-styled].tx-line-chart--live) .tx-line-chart__point{transition:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-line-chart__series,:host([data-styled].tx-line-chart--morph) .tx-line-chart__line,:host([data-styled].tx-line-chart--morph) .tx-line-chart__area,:host([data-styled].tx-line-chart--morph) .tx-line-chart__point{transition:none;animation:none}}\n"]
1178
+ }]
1179
+ }],
1180
+ ctorParameters: () => [],
1181
+ propDecorators: {
1182
+ series: [{
1183
+ type: i0.Input,
1184
+ args: [{
1185
+ isSignal: true,
1186
+ alias: "series",
1187
+ required: false
1188
+ }]
1189
+ }],
1190
+ categories: [{
1191
+ type: i0.Input,
1192
+ args: [{
1193
+ isSignal: true,
1194
+ alias: "categories",
1195
+ required: false
1196
+ }]
1197
+ }],
1198
+ xType: [{
1199
+ type: i0.Input,
1200
+ args: [{
1201
+ isSignal: true,
1202
+ alias: "xType",
1203
+ required: false
1204
+ }]
1205
+ }],
1206
+ annotations: [{
1207
+ type: i0.Input,
1208
+ args: [{
1209
+ isSignal: true,
1210
+ alias: "annotations",
1211
+ required: false
1212
+ }]
1213
+ }],
1214
+ zoom: [{
1215
+ type: i0.Input,
1216
+ args: [{
1217
+ isSignal: true,
1218
+ alias: "zoom",
1219
+ required: false
1220
+ }]
1221
+ }],
1222
+ brush: [{
1223
+ type: i0.Input,
1224
+ args: [{
1225
+ isSignal: true,
1226
+ alias: "brush",
1227
+ required: false
1228
+ }]
1229
+ }],
1230
+ xRange: [{
1231
+ type: i0.Input,
1232
+ args: [{
1233
+ isSignal: true,
1234
+ alias: "xRange",
1235
+ required: false
1236
+ }]
1237
+ }, {
1238
+ type: i0.Output,
1239
+ args: ["xRangeChange"]
1240
+ }],
1241
+ maxPoints: [{
1242
+ type: i0.Input,
1243
+ args: [{
1244
+ isSignal: true,
1245
+ alias: "maxPoints",
1246
+ required: false
1247
+ }]
1248
+ }],
1249
+ live: [{
1250
+ type: i0.Input,
1251
+ args: [{
1252
+ isSignal: true,
1253
+ alias: "live",
1254
+ required: false
1255
+ }]
1256
+ }],
1257
+ height: [{
1258
+ type: i0.Input,
1259
+ args: [{
1260
+ isSignal: true,
1261
+ alias: "height",
1262
+ required: false
1263
+ }]
1264
+ }],
1265
+ curve: [{
1266
+ type: i0.Input,
1267
+ args: [{
1268
+ isSignal: true,
1269
+ alias: "curve",
1270
+ required: false
1271
+ }]
1272
+ }],
1273
+ area: [{
1274
+ type: i0.Input,
1275
+ args: [{
1276
+ isSignal: true,
1277
+ alias: "area",
1278
+ required: false
1279
+ }]
1280
+ }],
1281
+ stacked: [{
1282
+ type: i0.Input,
1283
+ args: [{
1284
+ isSignal: true,
1285
+ alias: "stacked",
1286
+ required: false
1287
+ }]
1288
+ }],
1289
+ stackType: [{
1290
+ type: i0.Input,
1291
+ args: [{
1292
+ isSignal: true,
1293
+ alias: "stackType",
1294
+ required: false
1295
+ }]
1296
+ }],
1297
+ markers: [{
1298
+ type: i0.Input,
1299
+ args: [{
1300
+ isSignal: true,
1301
+ alias: "markers",
1302
+ required: false
1303
+ }]
1304
+ }],
1305
+ showLegend: [{
1306
+ type: i0.Input,
1307
+ args: [{
1308
+ isSignal: true,
1309
+ alias: "showLegend",
1310
+ required: false
1311
+ }]
1312
+ }],
1313
+ legendPosition: [{
1314
+ type: i0.Input,
1315
+ args: [{
1316
+ isSignal: true,
1317
+ alias: "legendPosition",
1318
+ required: false
1319
+ }]
1320
+ }],
1321
+ legendAlign: [{
1322
+ type: i0.Input,
1323
+ args: [{
1324
+ isSignal: true,
1325
+ alias: "legendAlign",
1326
+ required: false
1327
+ }]
1328
+ }],
1329
+ legendVariant: [{
1330
+ type: i0.Input,
1331
+ args: [{
1332
+ isSignal: true,
1333
+ alias: "legendVariant",
1334
+ required: false
1335
+ }]
1336
+ }],
1337
+ showTooltip: [{
1338
+ type: i0.Input,
1339
+ args: [{
1340
+ isSignal: true,
1341
+ alias: "showTooltip",
1342
+ required: false
1343
+ }]
1344
+ }],
1345
+ tooltipMode: [{
1346
+ type: i0.Input,
1347
+ args: [{
1348
+ isSignal: true,
1349
+ alias: "tooltipMode",
1350
+ required: false
1351
+ }]
1352
+ }],
1353
+ tooltipFormatter: [{
1354
+ type: i0.Input,
1355
+ args: [{
1356
+ isSignal: true,
1357
+ alias: "tooltipFormatter",
1358
+ required: false
1359
+ }]
1360
+ }],
1361
+ valueFormat: [{
1362
+ type: i0.Input,
1363
+ args: [{
1364
+ isSignal: true,
1365
+ alias: "valueFormat",
1366
+ required: false
1367
+ }]
1368
+ }],
1369
+ yScale: [{
1370
+ type: i0.Input,
1371
+ args: [{
1372
+ isSignal: true,
1373
+ alias: "yScale",
1374
+ required: false
1375
+ }]
1376
+ }],
1377
+ yMin: [{
1378
+ type: i0.Input,
1379
+ args: [{
1380
+ isSignal: true,
1381
+ alias: "yMin",
1382
+ required: false
1383
+ }]
1384
+ }],
1385
+ yMax: [{
1386
+ type: i0.Input,
1387
+ args: [{
1388
+ isSignal: true,
1389
+ alias: "yMax",
1390
+ required: false
1391
+ }]
1392
+ }],
1393
+ xAxisTitle: [{
1394
+ type: i0.Input,
1395
+ args: [{
1396
+ isSignal: true,
1397
+ alias: "xAxisTitle",
1398
+ required: false
1399
+ }]
1400
+ }],
1401
+ yAxisTitle: [{
1402
+ type: i0.Input,
1403
+ args: [{
1404
+ isSignal: true,
1405
+ alias: "yAxisTitle",
1406
+ required: false
1407
+ }]
1408
+ }],
1409
+ grid: [{
1410
+ type: i0.Input,
1411
+ args: [{
1412
+ isSignal: true,
1413
+ alias: "grid",
1414
+ required: false
1415
+ }]
1416
+ }],
1417
+ xAxisPosition: [{
1418
+ type: i0.Input,
1419
+ args: [{
1420
+ isSignal: true,
1421
+ alias: "xAxisPosition",
1422
+ required: false
1423
+ }]
1424
+ }],
1425
+ yAxisPosition: [{
1426
+ type: i0.Input,
1427
+ args: [{
1428
+ isSignal: true,
1429
+ alias: "yAxisPosition",
1430
+ required: false
1431
+ }]
1432
+ }],
1433
+ labelMode: [{
1434
+ type: i0.Input,
1435
+ args: [{
1436
+ isSignal: true,
1437
+ alias: "labelMode",
1438
+ required: false
1439
+ }]
1440
+ }],
1441
+ maxLabels: [{
1442
+ type: i0.Input,
1443
+ args: [{
1444
+ isSignal: true,
1445
+ alias: "maxLabels",
1446
+ required: false
1447
+ }]
1448
+ }],
1449
+ decimation: [{
1450
+ type: i0.Input,
1451
+ args: [{
1452
+ isSignal: true,
1453
+ alias: "decimation",
1454
+ required: false
1455
+ }]
1456
+ }],
1457
+ toolbar: [{
1458
+ type: i0.Input,
1459
+ args: [{
1460
+ isSignal: true,
1461
+ alias: "toolbar",
1462
+ required: false
1463
+ }]
1464
+ }],
1465
+ loading: [{
1466
+ type: i0.Input,
1467
+ args: [{
1468
+ isSignal: true,
1469
+ alias: "loading",
1470
+ required: false
1471
+ }]
1472
+ }],
1473
+ ariaLabel: [{
1474
+ type: i0.Input,
1475
+ args: [{
1476
+ isSignal: true,
1477
+ alias: "ariaLabel",
1478
+ required: false
1479
+ }]
1480
+ }],
1481
+ dt: [{
1482
+ type: i0.Input,
1483
+ args: [{
1484
+ isSignal: true,
1485
+ alias: "dt",
1486
+ required: false
1487
+ }]
1488
+ }],
1489
+ pt: [{
1490
+ type: i0.Input,
1491
+ args: [{
1492
+ isSignal: true,
1493
+ alias: "pt",
1494
+ required: false
1495
+ }]
1496
+ }],
1497
+ ptOptions: [{
1498
+ type: i0.Input,
1499
+ args: [{
1500
+ isSignal: true,
1501
+ alias: "ptOptions",
1502
+ required: false
1503
+ }]
1504
+ }],
1505
+ unstyled: [{
1506
+ type: i0.Input,
1507
+ args: [{
1508
+ isSignal: true,
1509
+ alias: "unstyled",
1510
+ required: false
1511
+ }]
1512
+ }],
1513
+ seriesToggle: [{
1514
+ type: i0.Output,
1515
+ args: ["seriesToggle"]
1516
+ }],
1517
+ pointClick: [{
1518
+ type: i0.Output,
1519
+ args: ["pointClick"]
1520
+ }],
1521
+ legendTemplate: [{
1522
+ type: i0.ContentChild,
1523
+ args: [i0.forwardRef(() => TxChartLegendTemplate), { isSignal: true }]
1524
+ }],
1525
+ tooltipTemplate: [{
1526
+ type: i0.ContentChild,
1527
+ args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
1528
+ }],
1529
+ frame: [{
1530
+ type: i0.ViewChild,
1531
+ args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
1532
+ }],
1533
+ layer: [{
1534
+ type: i0.ViewChild,
1535
+ args: ["layer", { isSignal: true }]
1536
+ }]
1537
+ }
1538
+ });
1539
+ export { TxLineChart };
1540
+
1541
+ //# sourceMappingURL=tectra-ng-charts-line.mjs.map