@tectra-ng/charts 0.1.9 → 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 (122) hide show
  1. package/README.md +21 -1
  2. package/bar-list/README.md +30 -0
  3. package/boxplot/README.md +62 -0
  4. package/bullet/README.md +53 -0
  5. package/candlestick/README.md +57 -0
  6. package/column/README.md +4 -2
  7. package/combo/README.md +83 -0
  8. package/core/README.md +3 -1
  9. package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
  10. package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
  11. package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
  12. package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
  13. package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
  14. package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
  15. package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
  16. package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
  17. package/fesm2022/tectra-ng-charts-column.mjs +149 -66
  18. package/fesm2022/tectra-ng-charts-column.mjs.map +1 -1
  19. package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
  20. package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
  21. package/fesm2022/tectra-ng-charts-core.mjs +1334 -49
  22. package/fesm2022/tectra-ng-charts-core.mjs.map +1 -1
  23. package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
  24. package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
  25. package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
  26. package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
  27. package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
  28. package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
  29. package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
  30. package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
  31. package/fesm2022/tectra-ng-charts-line.mjs +527 -67
  32. package/fesm2022/tectra-ng-charts-line.mjs.map +1 -1
  33. package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
  34. package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
  35. package/fesm2022/tectra-ng-charts-pie.mjs +47 -86
  36. package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -1
  37. package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
  38. package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
  39. package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
  40. package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
  41. package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
  42. package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
  43. package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
  44. package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
  45. package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
  46. package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
  47. package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
  48. package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
  49. package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
  50. package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
  51. package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
  52. package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
  53. package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
  54. package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
  55. package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
  56. package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
  57. package/funnel/README.md +53 -0
  58. package/gantt/README.md +53 -0
  59. package/gauge/README.md +41 -0
  60. package/heatmap/README.md +47 -0
  61. package/line/README.md +13 -2
  62. package/org-chart/README.md +57 -0
  63. package/package.json +114 -6
  64. package/pie/README.md +1 -0
  65. package/radar/README.md +64 -0
  66. package/radial-bar/README.md +62 -0
  67. package/range-area/README.md +66 -0
  68. package/rank-line/README.md +51 -0
  69. package/sankey/README.md +52 -0
  70. package/scatter/README.md +71 -0
  71. package/segmented-bar/README.md +35 -0
  72. package/sunburst/README.md +55 -0
  73. package/treemap/README.md +47 -0
  74. package/types/tectra-ng-charts-bar-list.d.ts +724 -0
  75. package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
  76. package/types/tectra-ng-charts-boxplot.d.ts +882 -0
  77. package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
  78. package/types/tectra-ng-charts-bullet.d.ts +833 -0
  79. package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
  80. package/types/tectra-ng-charts-candlestick.d.ts +854 -0
  81. package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
  82. package/types/tectra-ng-charts-column.d.ts +486 -3
  83. package/types/tectra-ng-charts-column.d.ts.map +1 -1
  84. package/types/tectra-ng-charts-combo.d.ts +987 -0
  85. package/types/tectra-ng-charts-combo.d.ts.map +1 -0
  86. package/types/tectra-ng-charts-core.d.ts +266 -5
  87. package/types/tectra-ng-charts-core.d.ts.map +1 -1
  88. package/types/tectra-ng-charts-funnel.d.ts +857 -0
  89. package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
  90. package/types/tectra-ng-charts-gantt.d.ts +884 -0
  91. package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
  92. package/types/tectra-ng-charts-gauge.d.ts +859 -0
  93. package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
  94. package/types/tectra-ng-charts-heatmap.d.ts +914 -0
  95. package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
  96. package/types/tectra-ng-charts-line.d.ts +556 -2
  97. package/types/tectra-ng-charts-line.d.ts.map +1 -1
  98. package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
  99. package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
  100. package/types/tectra-ng-charts-pie.d.ts +477 -14
  101. package/types/tectra-ng-charts-pie.d.ts.map +1 -1
  102. package/types/tectra-ng-charts-radar.d.ts +903 -0
  103. package/types/tectra-ng-charts-radar.d.ts.map +1 -0
  104. package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
  105. package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
  106. package/types/tectra-ng-charts-range-area.d.ts +897 -0
  107. package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
  108. package/types/tectra-ng-charts-rank-line.d.ts +839 -0
  109. package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
  110. package/types/tectra-ng-charts-sankey.d.ts +866 -0
  111. package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
  112. package/types/tectra-ng-charts-scatter.d.ts +987 -0
  113. package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
  114. package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
  115. package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
  116. package/types/tectra-ng-charts-sunburst.d.ts +864 -0
  117. package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
  118. package/types/tectra-ng-charts-treemap.d.ts +847 -0
  119. package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
  120. package/types/tectra-ng-charts-waterfall.d.ts +869 -0
  121. package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
  122. package/waterfall/README.md +60 -0
@@ -0,0 +1,1174 @@
1
+ import { TX_CHART_TABLE_ROWS, TxChartAnnotations, TxChartAxes, TxChartFrame, TxChartLegendTemplate, TxChartTooltipTemplate, cartesianLayout, chartAnnotationShapes, chartNumberFormatter, chartSummary, cycleIndex, extent, initialChartSize, injectChartEntrance, niceDomain, readTokenNumber, seriesColor, stepIndex, timeInterval, timeTooltipFormatter, toTime, toggleKey } from "@tectra-ng/charts/core";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, linkedSignal, output, signal, viewChild } from "@angular/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
+ function isTuple(point) {
10
+ return Array.isArray(point);
11
+ }
12
+ function scatterData(series) {
13
+ return series.map((item, seriesIndex) => item.data.flatMap((point, index) => {
14
+ const raw = isTuple(point) ? {
15
+ x: point[0],
16
+ y: point[1],
17
+ size: point[2]
18
+ } : point;
19
+ const x = typeof raw.x === "number" ? raw.x : toTime(raw.x);
20
+ if (x === null || !Number.isFinite(x) || raw.y === null || raw.y === void 0 || !Number.isFinite(raw.y)) return [];
21
+ const size = raw.size === void 0 || raw.size === null || !Number.isFinite(raw.size) ? null : raw.size;
22
+ const extra = isTuple(point) ? null : point;
23
+ return [{
24
+ series: seriesIndex,
25
+ index,
26
+ x,
27
+ y: raw.y,
28
+ size,
29
+ color: extra?.color ?? null,
30
+ label: extra?.label ?? null
31
+ }];
32
+ }));
33
+ }
34
+ function bubbleRadius(size, maxSize, min, max) {
35
+ if (size === null || !(maxSize > 0) || size <= 0) return min;
36
+ return Math.max(min, max * Math.sqrt(size / maxSize));
37
+ }
38
+ function linearTrend(points) {
39
+ if (points.length < 2) return null;
40
+ const n = points.length;
41
+ const meanX = points.reduce((sum, point) => sum + point.x, 0) / n;
42
+ const meanY = points.reduce((sum, point) => sum + point.y, 0) / n;
43
+ let top = 0;
44
+ let bottom = 0;
45
+ let from = Infinity;
46
+ let to = -Infinity;
47
+ for (const point of points) {
48
+ top += (point.x - meanX) * (point.y - meanY);
49
+ bottom += (point.x - meanX) ** 2;
50
+ from = Math.min(from, point.x);
51
+ to = Math.max(to, point.x);
52
+ }
53
+ if (!bottom) return null;
54
+ const slope = top / bottom;
55
+ return {
56
+ slope,
57
+ intercept: meanY - slope * meanX,
58
+ from,
59
+ to
60
+ };
61
+ }
62
+ function nearestDot(dots, x, y, slack) {
63
+ let best = null;
64
+ let distance = Infinity;
65
+ for (const dot of dots) {
66
+ const next = Math.hypot(dot.cx - x, dot.cy - y);
67
+ if (next <= Math.max(dot.r + slack, slack * 2) && (next < distance || best && next === distance && dot.r < best.r)) {
68
+ distance = next;
69
+ best = dot;
70
+ }
71
+ }
72
+ return best;
73
+ }
74
+ const DEFAULT_RADIUS = {
75
+ point: 5,
76
+ min: 4,
77
+ max: 26
78
+ };
79
+ const HIT_SLACK = 8;
80
+ const STAGGER_GROUPS = 24;
81
+ const BUBBLE_PLOT_SHARE = .8;
82
+ var TxScatterChart = class TxScatterChart {
83
+ locale = inject(TxLocaleService);
84
+ host = inject(ElementRef);
85
+ translations = injectTranslations();
86
+ series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
87
+ xType = input("linear", ...ngDevMode ? [{ debugName: "xType" }] : /* istanbul ignore next */ []);
88
+ annotations = input([], ...ngDevMode ? [{ debugName: "annotations" }] : /* istanbul ignore next */ []);
89
+ height = input(350, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
90
+ trendLine = input(false, {
91
+ ...ngDevMode ? { debugName: "trendLine" } : /* istanbul ignore next */ {},
92
+ transform: booleanAttribute
93
+ });
94
+ showLegend = input(true, {
95
+ ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
96
+ transform: booleanAttribute
97
+ });
98
+ legendPosition = input("top", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
99
+ legendAlign = input("start", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
100
+ legendVariant = input("dot", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
101
+ showTooltip = input(true, {
102
+ ...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
103
+ transform: booleanAttribute
104
+ });
105
+ xValueFormat = input("number", ...ngDevMode ? [{ debugName: "xValueFormat" }] : /* istanbul ignore next */ []);
106
+ valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
107
+ sizeFormat = input("number", ...ngDevMode ? [{ debugName: "sizeFormat" }] : /* istanbul ignore next */ []);
108
+ yScale = input("linear", ...ngDevMode ? [{ debugName: "yScale" }] : /* istanbul ignore next */ []);
109
+ xMin = input(void 0, ...ngDevMode ? [{ debugName: "xMin" }] : /* istanbul ignore next */ []);
110
+ xMax = input(void 0, ...ngDevMode ? [{ debugName: "xMax" }] : /* istanbul ignore next */ []);
111
+ yMin = input(void 0, ...ngDevMode ? [{ debugName: "yMin" }] : /* istanbul ignore next */ []);
112
+ yMax = input(void 0, ...ngDevMode ? [{ debugName: "yMax" }] : /* istanbul ignore next */ []);
113
+ xAxisTitle = input("", ...ngDevMode ? [{ debugName: "xAxisTitle" }] : /* istanbul ignore next */ []);
114
+ yAxisTitle = input("", ...ngDevMode ? [{ debugName: "yAxisTitle" }] : /* istanbul ignore next */ []);
115
+ sizeLabel = input("", ...ngDevMode ? [{ debugName: "sizeLabel" }] : /* istanbul ignore next */ []);
116
+ grid = input("both", ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
117
+ xAxisPosition = input("bottom", ...ngDevMode ? [{ debugName: "xAxisPosition" }] : /* istanbul ignore next */ []);
118
+ yAxisPosition = input("left", ...ngDevMode ? [{ debugName: "yAxisPosition" }] : /* istanbul ignore next */ []);
119
+ toolbar = input(true, {
120
+ ...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
121
+ transform: booleanAttribute
122
+ });
123
+ loading = input(false, {
124
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
125
+ transform: booleanAttribute
126
+ });
127
+ ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
128
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
129
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
130
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
131
+ unstyled = input(void 0, {
132
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
133
+ transform: optionalBoolean
134
+ });
135
+ seriesToggle = output();
136
+ pointClick = output();
137
+ legendTemplate = contentChild(TxChartLegendTemplate, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
138
+ tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
139
+ frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
140
+ isUnstyled = injectUnstyled(this.unstyled);
141
+ passThrough = injectPassThrough("scatterChart", this, this.pt, this.ptOptions);
142
+ tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
143
+ hostStyle = computed(() => ({
144
+ ...this.tokenStyle(),
145
+ ...this.passThrough().root?.style
146
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
147
+ entrance = injectChartEntrance();
148
+ morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
149
+ uid = uniqueId("tx-scatter-chart");
150
+ hidden = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
151
+ focusedSeries = signal(null, ...ngDevMode ? [{ debugName: "focusedSeries" }] : /* istanbul ignore next */ []);
152
+ active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
153
+ radius = signal(DEFAULT_RADIUS, ...ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []);
154
+ intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
155
+ list = computed(() => this.series() ?? [], ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
156
+ data = computed(() => scatterData(this.list()), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
157
+ keys = computed(() => this.list().map((item, index) => `${index}:${item.name}`), ...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
158
+ visibleIndexes = computed(() => this.keys().flatMap((key, index) => this.hidden().has(key) ? [] : [index]), ...ngDevMode ? [{ debugName: "visibleIndexes" }] : /* istanbul ignore next */ []);
159
+ visibleData = computed(() => this.visibleIndexes().flatMap((index) => this.data()[index] ?? []), ...ngDevMode ? [{ debugName: "visibleData" }] : /* istanbul ignore next */ []);
160
+ isBubble = computed(() => this.data().some((points) => points.some((point) => point.size !== null)), ...ngDevMode ? [{ debugName: "isBubble" }] : /* istanbul ignore next */ []);
161
+ isEmpty = computed(() => !this.data().some((points) => points.length), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
162
+ legendShown = computed(() => this.showLegend() && this.list().length > 1, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
163
+ size = linkedSignal(() => initialChartSize(this.height(), this.legendShown() ? this.legendPosition() : null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
164
+ order = computed(() => this.data().map((points) => points.map((_, position) => position).sort((a, b) => points[a].x - points[b].x || points[a].y - points[b].y)), ...ngDevMode ? [{ debugName: "order" }] : /* istanbul ignore next */ []);
165
+ maxSize = computed(() => Math.max(0, ...this.data().flatMap((points) => points.map((point) => point.size ?? 0))), ...ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []);
166
+ xDomain = computed(() => {
167
+ const range = extent(this.visibleData().map((point) => point.x)) ?? extent(this.data().flat().map((point) => point.x)) ?? [0, 1];
168
+ if (this.xType() === "time") {
169
+ const [from, to] = range;
170
+ return [this.xMin() ?? from, this.xMax() ?? (to === from ? from + 864e5 : to)];
171
+ }
172
+ const [from, to] = padRange(range, this.bubblePad(range, this.size().width));
173
+ const nice = niceDomain(from, to, 6);
174
+ return [this.xMin() ?? nice[0], this.xMax() ?? nice[1]];
175
+ }, ...ngDevMode ? [{ debugName: "xDomain" }] : /* istanbul ignore next */ []);
176
+ yExtent = computed(() => {
177
+ const range = extent(this.visibleData().map((point) => point.y)) ?? [0, 1];
178
+ if (this.yScale() === "log") return range;
179
+ return padRange(range, this.bubblePad(range, this.size().height));
180
+ }, ...ngDevMode ? [{ debugName: "yExtent" }] : /* istanbul ignore next */ []);
181
+ layout = computed(() => {
182
+ const { width, height } = this.size();
183
+ const format = this.xValueFormat();
184
+ return cartesianLayout({
185
+ width,
186
+ height,
187
+ intl: this.intl(),
188
+ category: {
189
+ kind: this.xType() === "time" ? "time" : "linear",
190
+ domain: this.xDomain(),
191
+ format: this.xType() === "linear" && format !== "number" ? chartNumberFormatter(this.intl(), format) : void 0,
192
+ title: this.xAxisTitle() || void 0
193
+ },
194
+ value: {
195
+ extent: this.yExtent(),
196
+ scale: this.yScale(),
197
+ format: this.valueFormat(),
198
+ includeZero: false,
199
+ min: this.yMin(),
200
+ max: this.yMax(),
201
+ title: this.yAxisTitle() || void 0
202
+ },
203
+ grid: this.grid(),
204
+ xAxisPosition: this.xAxisPosition(),
205
+ yAxisPosition: this.yAxisPosition()
206
+ });
207
+ }, ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
208
+ formatX = computed(() => {
209
+ if (this.xType() === "time") {
210
+ const [from, to] = this.xDomain();
211
+ return timeTooltipFormatter(this.intl(), timeInterval(from, to, 6));
212
+ }
213
+ return chartNumberFormatter(this.intl(), this.xValueFormat());
214
+ }, ...ngDevMode ? [{ debugName: "formatX" }] : /* istanbul ignore next */ []);
215
+ formatY = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "formatY" }] : /* istanbul ignore next */ []);
216
+ formatSize = computed(() => chartNumberFormatter(this.intl(), this.sizeFormat()), ...ngDevMode ? [{ debugName: "formatSize" }] : /* istanbul ignore next */ []);
217
+ dots = computed(() => {
218
+ const layout = this.layout();
219
+ const radius = this.radius();
220
+ const bubble = this.isBubble();
221
+ const maxSize = this.maxSize();
222
+ return this.visibleIndexes().flatMap((seriesIndex) => {
223
+ const color = seriesColor(this.list()[seriesIndex].color, seriesIndex);
224
+ return this.data()[seriesIndex].map((point, position) => ({
225
+ key: `${seriesIndex}:${point.index}`,
226
+ series: seriesIndex,
227
+ index: position,
228
+ cx: layout.categoryPosition(position, point.x),
229
+ cy: layout.value.map(point.y),
230
+ r: bubble ? bubbleRadius(point.size, maxSize, radius.min, radius.max) : radius.point,
231
+ color: point.color ?? color,
232
+ order: position % STAGGER_GROUPS
233
+ }));
234
+ });
235
+ }, ...ngDevMode ? [{ debugName: "dots" }] : /* istanbul ignore next */ []);
236
+ drawnDots = computed(() => this.isBubble() ? [...this.dots()].sort((a, b) => b.r - a.r) : this.dots(), ...ngDevMode ? [{ debugName: "drawnDots" }] : /* istanbul ignore next */ []);
237
+ trends = computed(() => {
238
+ if (!this.trendLine()) return [];
239
+ const layout = this.layout();
240
+ return this.visibleIndexes().flatMap((seriesIndex) => {
241
+ const fit = linearTrend(this.data()[seriesIndex]);
242
+ if (!fit) return [];
243
+ const at = (x) => ({
244
+ x: layout.categoryPosition(0, x),
245
+ y: layout.value.map(fit.slope * x + fit.intercept)
246
+ });
247
+ const from = at(fit.from);
248
+ const to = at(fit.to);
249
+ return [{
250
+ key: this.keys()[seriesIndex],
251
+ series: seriesIndex,
252
+ color: seriesColor(this.list()[seriesIndex].color, seriesIndex),
253
+ x1: from.x,
254
+ y1: from.y,
255
+ x2: to.x,
256
+ y2: to.y
257
+ }];
258
+ });
259
+ }, ...ngDevMode ? [{ debugName: "trends" }] : /* istanbul ignore next */ []);
260
+ activeDot = computed(() => {
261
+ const active = this.active();
262
+ if (!active) return null;
263
+ return this.dots().find((dot) => dot.series === active.series && dot.index === active.index) ?? null;
264
+ }, ...ngDevMode ? [{ debugName: "activeDot" }] : /* istanbul ignore next */ []);
265
+ guides = computed(() => {
266
+ const dot = this.activeDot();
267
+ if (!dot) return null;
268
+ const plot = this.layout().plot;
269
+ const bottom = this.xAxisPosition() === "bottom";
270
+ const left = this.yAxisPosition() === "left";
271
+ return {
272
+ x: {
273
+ x1: dot.cx,
274
+ y1: bottom ? dot.cy + dot.r : plot.top,
275
+ x2: dot.cx,
276
+ y2: bottom ? plot.top + plot.height : dot.cy - dot.r
277
+ },
278
+ y: {
279
+ x1: left ? plot.left : dot.cx + dot.r,
280
+ y1: dot.cy,
281
+ x2: left ? dot.cx - dot.r : plot.left + plot.width,
282
+ y2: dot.cy
283
+ }
284
+ };
285
+ }, ...ngDevMode ? [{ debugName: "guides" }] : /* istanbul ignore next */ []);
286
+ annotationShapes = computed(() => {
287
+ const layout = this.layout();
288
+ return chartAnnotationShapes(this.annotations(), {
289
+ plot: layout.plot,
290
+ x: (value) => {
291
+ const x = this.xType() === "time" ? toTime(value) : typeof value === "number" ? value : Number(value);
292
+ return x === null || !Number.isFinite(x) ? null : layout.categoryPosition(0, x);
293
+ },
294
+ y: (value) => layout.value.map(value)
295
+ });
296
+ }, ...ngDevMode ? [{ debugName: "annotationShapes" }] : /* istanbul ignore next */ []);
297
+ labels = computed(() => {
298
+ const t = this.translations();
299
+ return {
300
+ x: this.xAxisTitle() || "x",
301
+ y: this.yAxisTitle() || "y",
302
+ size: this.sizeLabel() || t.chartSize
303
+ };
304
+ }, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
305
+ legendItems = computed(() => {
306
+ const stat = this.legendVariant() === "stat";
307
+ const active = this.active();
308
+ const format = this.formatY();
309
+ return this.list().map((item, index) => {
310
+ const point = active?.series === index ? this.data()[index][active.index] : null;
311
+ return {
312
+ key: this.keys()[index],
313
+ label: item.name,
314
+ color: seriesColor(item.color, index),
315
+ hidden: this.hidden().has(this.keys()[index]),
316
+ ...stat ? point ? {
317
+ value: format(point.y),
318
+ caption: point.label ?? this.formatX()(point.x)
319
+ } : {
320
+ value: this.integer()(this.data()[index].length),
321
+ caption: this.translations().chartTotal
322
+ } : {}
323
+ };
324
+ });
325
+ }, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
326
+ integer = computed(() => chartNumberFormatter(this.intl(), "integer"), ...ngDevMode ? [{ debugName: "integer" }] : /* istanbul ignore next */ []);
327
+ tooltip = computed(() => {
328
+ const active = this.active();
329
+ const dot = this.activeDot();
330
+ if (!active || !dot || !this.showTooltip() || this.legendVariant() === "stat") return null;
331
+ const point = this.data()[active.series][active.index];
332
+ const labels = this.labels();
333
+ const rows = [
334
+ {
335
+ label: this.list()[active.series].name,
336
+ value: "",
337
+ color: dot.color,
338
+ raw: null,
339
+ seriesIndex: active.series
340
+ },
341
+ {
342
+ label: labels.x,
343
+ value: this.formatX()(point.x),
344
+ color: "transparent",
345
+ raw: point.x,
346
+ seriesIndex: active.series
347
+ },
348
+ {
349
+ label: labels.y,
350
+ value: this.formatY()(point.y),
351
+ color: "transparent",
352
+ raw: point.y,
353
+ seriesIndex: active.series
354
+ },
355
+ ...point.size !== null ? [{
356
+ label: labels.size,
357
+ value: this.formatSize()(point.size),
358
+ color: "transparent",
359
+ raw: point.size,
360
+ seriesIndex: active.series
361
+ }] : []
362
+ ];
363
+ return {
364
+ title: point.label ?? "",
365
+ rows,
366
+ index: active.index,
367
+ x: dot.cx,
368
+ y: dot.cy - dot.r,
369
+ placement: "top"
370
+ };
371
+ }, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
372
+ summary = computed(() => {
373
+ const t = this.translations();
374
+ const points = this.data().flat();
375
+ const range = extent(points.map((point) => point.y));
376
+ const format = this.formatY();
377
+ const text = chartSummary(t, this.intl(), this.isBubble() ? t.chartBubble : t.chartScatter, this.list().length, points.length, range ? [format(range[0]), format(range[1])] : null);
378
+ return this.ariaLabel() ? `${this.ariaLabel()}. ${text}` : text;
379
+ }, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
380
+ dataTable = computed(() => {
381
+ const labels = this.labels();
382
+ const bubble = this.isBubble();
383
+ const rows = this.data().flatMap((points, seriesIndex) => points.map((point) => ({
384
+ label: point.label ? `${this.list()[seriesIndex].name}, ${point.label}` : this.list()[seriesIndex].name,
385
+ cells: [
386
+ this.formatX()(point.x),
387
+ this.formatY()(point.y),
388
+ ...bubble ? [point.size === null ? "—" : this.formatSize()(point.size)] : []
389
+ ]
390
+ })));
391
+ return {
392
+ columns: [
393
+ {
394
+ key: "x",
395
+ label: labels.x
396
+ },
397
+ {
398
+ key: "y",
399
+ label: labels.y
400
+ },
401
+ ...bubble ? [{
402
+ key: "size",
403
+ label: labels.size
404
+ }] : []
405
+ ],
406
+ rows: rows.slice(0, TX_CHART_TABLE_ROWS)
407
+ };
408
+ }, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
409
+ constructor() {
410
+ afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
411
+ afterRenderEffect(() => {
412
+ this.dt();
413
+ this.readRadius();
414
+ });
415
+ }
416
+ bubblePad(range, length) {
417
+ if (!this.isBubble()) return 0;
418
+ const span = range[1] - range[0] || Math.abs(range[0]) || 1;
419
+ const usable = Math.max(1, length * BUBBLE_PLOT_SHARE - this.radius().max * 2);
420
+ return span * this.radius().max / usable;
421
+ }
422
+ isActive(dot) {
423
+ const active = this.active();
424
+ return !!active && active.series === dot.series && active.index === dot.index;
425
+ }
426
+ onPointer(event) {
427
+ if (event.type === "leave") {
428
+ this.active.set(null);
429
+ return;
430
+ }
431
+ const dot = nearestDot(this.dots(), event.x, event.y, HIT_SLACK);
432
+ if (!dot) {
433
+ this.active.set(null);
434
+ return;
435
+ }
436
+ this.active.set({
437
+ index: dot.index,
438
+ series: dot.series,
439
+ pointerY: event.y,
440
+ keyboard: false
441
+ });
442
+ if (event.type === "click") this.pointClick.emit(this.pointEvent(this.data()[dot.series][dot.index]));
443
+ }
444
+ onNavigate(event) {
445
+ if (event.key === "Escape") {
446
+ this.active.set(null);
447
+ return;
448
+ }
449
+ const visible = this.visibleIndexes().filter((index) => this.data()[index].length);
450
+ const current = this.active();
451
+ let series = current && visible.includes(current.series) ? current.series : visible[0] ?? -1;
452
+ if (series < 0) return;
453
+ let position = current?.series === series ? this.order()[series].indexOf(current.index) : -1;
454
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
455
+ const x = position >= 0 ? this.data()[series][this.order()[series][position]].x : null;
456
+ series = cycleIndex(series, event.key === "ArrowDown" ? 1 : -1, visible);
457
+ position = x === null ? 0 : this.closestPosition(series, x);
458
+ } else position = stepIndex(event.key, position, this.order()[series].length);
459
+ if (position < 0) return;
460
+ const index = this.order()[series][position];
461
+ this.active.set({
462
+ index,
463
+ series,
464
+ pointerY: null,
465
+ keyboard: true
466
+ });
467
+ const point = this.data()[series][index];
468
+ const size = point.size === null ? "" : `, ${this.labels().size} ${this.formatSize()(point.size)}`;
469
+ this.frame()?.announce(formatMessage(this.translations().chartPoint, {
470
+ series: this.list()[series].name,
471
+ category: point.label ?? `${this.labels().x} ${this.formatX()(point.x)}`,
472
+ value: `${this.labels().y} ${this.formatY()(point.y)}${size}`
473
+ }));
474
+ }
475
+ onLegendToggle(key) {
476
+ const index = this.keys().indexOf(key);
477
+ this.hidden.update((keys) => toggleKey(keys, key));
478
+ if (this.active()?.series === index) this.active.set(null);
479
+ this.seriesToggle.emit({
480
+ seriesIndex: index,
481
+ name: this.list()[index]?.name ?? "",
482
+ hidden: this.hidden().has(key)
483
+ });
484
+ }
485
+ onLegendHover(key) {
486
+ const index = key === null ? -1 : this.keys().indexOf(key);
487
+ this.focusedSeries.set(index >= 0 && !this.hidden().has(key ?? "") ? index : null);
488
+ }
489
+ closestPosition(series, x) {
490
+ const order = this.order()[series];
491
+ let best = 0;
492
+ let distance = Infinity;
493
+ order.forEach((index, position) => {
494
+ const next = Math.abs(this.data()[series][index].x - x);
495
+ if (next < distance) {
496
+ distance = next;
497
+ best = position;
498
+ }
499
+ });
500
+ return best;
501
+ }
502
+ pointEvent(point) {
503
+ return {
504
+ seriesIndex: point.series,
505
+ dataPointIndex: point.index,
506
+ x: point.x,
507
+ y: point.y,
508
+ size: point.size,
509
+ label: point.label
510
+ };
511
+ }
512
+ readRadius() {
513
+ const element = this.host.nativeElement;
514
+ const next = {
515
+ point: readTokenNumber(element, "--tx-chart-scatter-point-radius", DEFAULT_RADIUS.point),
516
+ min: readTokenNumber(element, "--tx-chart-scatter-bubble-min-radius", DEFAULT_RADIUS.min),
517
+ max: readTokenNumber(element, "--tx-chart-scatter-bubble-max-radius", DEFAULT_RADIUS.max)
518
+ };
519
+ const current = this.radius();
520
+ if (current.point !== next.point || current.min !== next.min || current.max !== next.max) this.radius.set(next);
521
+ }
522
+ static ɵfac = i0.ɵɵngDeclareFactory({
523
+ minVersion: "12.0.0",
524
+ version: "22.2.3",
525
+ ngImport: i0,
526
+ type: TxScatterChart,
527
+ deps: [],
528
+ target: i0.ɵɵFactoryTarget.Component
529
+ });
530
+ static ɵcmp = i0.ɵɵngDeclareComponent({
531
+ minVersion: "17.0.0",
532
+ version: "22.2.3",
533
+ type: TxScatterChart,
534
+ isStandalone: true,
535
+ selector: "tx-scatter-chart",
536
+ inputs: {
537
+ series: {
538
+ classPropertyName: "series",
539
+ publicName: "series",
540
+ isSignal: true,
541
+ isRequired: false,
542
+ transformFunction: null
543
+ },
544
+ xType: {
545
+ classPropertyName: "xType",
546
+ publicName: "xType",
547
+ isSignal: true,
548
+ isRequired: false,
549
+ transformFunction: null
550
+ },
551
+ annotations: {
552
+ classPropertyName: "annotations",
553
+ publicName: "annotations",
554
+ isSignal: true,
555
+ isRequired: false,
556
+ transformFunction: null
557
+ },
558
+ height: {
559
+ classPropertyName: "height",
560
+ publicName: "height",
561
+ isSignal: true,
562
+ isRequired: false,
563
+ transformFunction: null
564
+ },
565
+ trendLine: {
566
+ classPropertyName: "trendLine",
567
+ publicName: "trendLine",
568
+ isSignal: true,
569
+ isRequired: false,
570
+ transformFunction: null
571
+ },
572
+ showLegend: {
573
+ classPropertyName: "showLegend",
574
+ publicName: "showLegend",
575
+ isSignal: true,
576
+ isRequired: false,
577
+ transformFunction: null
578
+ },
579
+ legendPosition: {
580
+ classPropertyName: "legendPosition",
581
+ publicName: "legendPosition",
582
+ isSignal: true,
583
+ isRequired: false,
584
+ transformFunction: null
585
+ },
586
+ legendAlign: {
587
+ classPropertyName: "legendAlign",
588
+ publicName: "legendAlign",
589
+ isSignal: true,
590
+ isRequired: false,
591
+ transformFunction: null
592
+ },
593
+ legendVariant: {
594
+ classPropertyName: "legendVariant",
595
+ publicName: "legendVariant",
596
+ isSignal: true,
597
+ isRequired: false,
598
+ transformFunction: null
599
+ },
600
+ showTooltip: {
601
+ classPropertyName: "showTooltip",
602
+ publicName: "showTooltip",
603
+ isSignal: true,
604
+ isRequired: false,
605
+ transformFunction: null
606
+ },
607
+ xValueFormat: {
608
+ classPropertyName: "xValueFormat",
609
+ publicName: "xValueFormat",
610
+ isSignal: true,
611
+ isRequired: false,
612
+ transformFunction: null
613
+ },
614
+ valueFormat: {
615
+ classPropertyName: "valueFormat",
616
+ publicName: "valueFormat",
617
+ isSignal: true,
618
+ isRequired: false,
619
+ transformFunction: null
620
+ },
621
+ sizeFormat: {
622
+ classPropertyName: "sizeFormat",
623
+ publicName: "sizeFormat",
624
+ isSignal: true,
625
+ isRequired: false,
626
+ transformFunction: null
627
+ },
628
+ yScale: {
629
+ classPropertyName: "yScale",
630
+ publicName: "yScale",
631
+ isSignal: true,
632
+ isRequired: false,
633
+ transformFunction: null
634
+ },
635
+ xMin: {
636
+ classPropertyName: "xMin",
637
+ publicName: "xMin",
638
+ isSignal: true,
639
+ isRequired: false,
640
+ transformFunction: null
641
+ },
642
+ xMax: {
643
+ classPropertyName: "xMax",
644
+ publicName: "xMax",
645
+ isSignal: true,
646
+ isRequired: false,
647
+ transformFunction: null
648
+ },
649
+ yMin: {
650
+ classPropertyName: "yMin",
651
+ publicName: "yMin",
652
+ isSignal: true,
653
+ isRequired: false,
654
+ transformFunction: null
655
+ },
656
+ yMax: {
657
+ classPropertyName: "yMax",
658
+ publicName: "yMax",
659
+ isSignal: true,
660
+ isRequired: false,
661
+ transformFunction: null
662
+ },
663
+ xAxisTitle: {
664
+ classPropertyName: "xAxisTitle",
665
+ publicName: "xAxisTitle",
666
+ isSignal: true,
667
+ isRequired: false,
668
+ transformFunction: null
669
+ },
670
+ yAxisTitle: {
671
+ classPropertyName: "yAxisTitle",
672
+ publicName: "yAxisTitle",
673
+ isSignal: true,
674
+ isRequired: false,
675
+ transformFunction: null
676
+ },
677
+ sizeLabel: {
678
+ classPropertyName: "sizeLabel",
679
+ publicName: "sizeLabel",
680
+ isSignal: true,
681
+ isRequired: false,
682
+ transformFunction: null
683
+ },
684
+ grid: {
685
+ classPropertyName: "grid",
686
+ publicName: "grid",
687
+ isSignal: true,
688
+ isRequired: false,
689
+ transformFunction: null
690
+ },
691
+ xAxisPosition: {
692
+ classPropertyName: "xAxisPosition",
693
+ publicName: "xAxisPosition",
694
+ isSignal: true,
695
+ isRequired: false,
696
+ transformFunction: null
697
+ },
698
+ yAxisPosition: {
699
+ classPropertyName: "yAxisPosition",
700
+ publicName: "yAxisPosition",
701
+ isSignal: true,
702
+ isRequired: false,
703
+ transformFunction: null
704
+ },
705
+ toolbar: {
706
+ classPropertyName: "toolbar",
707
+ publicName: "toolbar",
708
+ isSignal: true,
709
+ isRequired: false,
710
+ transformFunction: null
711
+ },
712
+ loading: {
713
+ classPropertyName: "loading",
714
+ publicName: "loading",
715
+ isSignal: true,
716
+ isRequired: false,
717
+ transformFunction: null
718
+ },
719
+ ariaLabel: {
720
+ classPropertyName: "ariaLabel",
721
+ publicName: "ariaLabel",
722
+ isSignal: true,
723
+ isRequired: false,
724
+ transformFunction: null
725
+ },
726
+ dt: {
727
+ classPropertyName: "dt",
728
+ publicName: "dt",
729
+ isSignal: true,
730
+ isRequired: false,
731
+ transformFunction: null
732
+ },
733
+ pt: {
734
+ classPropertyName: "pt",
735
+ publicName: "pt",
736
+ isSignal: true,
737
+ isRequired: false,
738
+ transformFunction: null
739
+ },
740
+ ptOptions: {
741
+ classPropertyName: "ptOptions",
742
+ publicName: "ptOptions",
743
+ isSignal: true,
744
+ isRequired: false,
745
+ transformFunction: null
746
+ },
747
+ unstyled: {
748
+ classPropertyName: "unstyled",
749
+ publicName: "unstyled",
750
+ isSignal: true,
751
+ isRequired: false,
752
+ transformFunction: null
753
+ }
754
+ },
755
+ outputs: {
756
+ seriesToggle: "seriesToggle",
757
+ pointClick: "pointClick"
758
+ },
759
+ host: {
760
+ properties: {
761
+ "class": "passThrough().root?.class",
762
+ "style": "hostStyle()",
763
+ "attr.data-styled": "!isUnstyled() || null",
764
+ "class.tx-scatter-chart--bubble": "isBubble()",
765
+ "class.tx-scatter-chart--fill": "typeof height() === \"string\"",
766
+ "class.tx-scatter-chart--entering": "entrance.active()",
767
+ "class.tx-scatter-chart--morph": "morph()",
768
+ "class.tx-scatter-chart--focused": "focusedSeries() !== null",
769
+ "class.tx-scatter-chart--active": "active() !== null"
770
+ },
771
+ classAttribute: "tx-scatter-chart"
772
+ },
773
+ queries: [{
774
+ propertyName: "legendTemplate",
775
+ first: true,
776
+ predicate: TxChartLegendTemplate,
777
+ descendants: true,
778
+ isSignal: true
779
+ }, {
780
+ propertyName: "tooltipTemplate",
781
+ first: true,
782
+ predicate: TxChartTooltipTemplate,
783
+ descendants: true,
784
+ isSignal: true
785
+ }],
786
+ viewQueries: [{
787
+ propertyName: "frame",
788
+ first: true,
789
+ predicate: TxChartFrame,
790
+ descendants: true,
791
+ isSignal: true
792
+ }],
793
+ ngImport: i0,
794
+ 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-scatter\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\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 (guides(); as guide) {\n <svg:g class=\"tx-scatter-chart__guides\" [class]=\"passThrough().guide?.class\" [style]=\"passThrough().guide?.style\">\n <svg:line class=\"tx-scatter-chart__guide\" [attr.x1]=\"guide.x.x1\" [attr.y1]=\"guide.x.y1\" [attr.x2]=\"guide.x.x2\" [attr.y2]=\"guide.x.y2\" />\n <svg:line class=\"tx-scatter-chart__guide\" [attr.x1]=\"guide.y.x1\" [attr.y1]=\"guide.y.y1\" [attr.x2]=\"guide.y.x2\" [attr.y2]=\"guide.y.y2\" />\n </svg:g>\n }\n <svg:g class=\"tx-scatter-chart__points\">\n @for (dot of drawnDots(); track dot.key) {\n <svg:circle\n class=\"tx-scatter-chart__point\"\n [class.tx-scatter-chart__point--focused]=\"focusedSeries() === dot.series\"\n [class.tx-scatter-chart__point--active]=\"isActive(dot)\"\n [class]=\"passThrough().point?.class\"\n [style]=\"passThrough().point?.style\"\n [attr.data-series]=\"dot.series\"\n [attr.data-index]=\"dot.index\"\n [attr.cx]=\"dot.cx\"\n [attr.cy]=\"dot.cy\"\n [attr.r]=\"dot.r\"\n [style.--tx-scatter-chart-color]=\"dot.color\"\n [style.--tx-scatter-chart-order]=\"dot.order\"\n />\n }\n </svg:g>\n @for (trend of trends(); track trend.key) {\n <svg:line\n class=\"tx-scatter-chart__trend\"\n [class.tx-scatter-chart__trend--focused]=\"focusedSeries() === trend.series\"\n [class]=\"passThrough().trendLine?.class\"\n [style]=\"passThrough().trendLine?.style\"\n [attr.data-series]=\"trend.series\"\n [attr.x1]=\"trend.x1\"\n [attr.y1]=\"trend.y1\"\n [attr.x2]=\"trend.x2\"\n [attr.y2]=\"trend.y2\"\n [style.stroke]=\"trend.color\"\n />\n }\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"front\" [part]=\"passThrough().annotation\" />\n</tx-chart-frame>\n",
795
+ styles: [":host{display:block;min-width:0}:host(.tx-scatter-chart--fill){height:100%}.tx-scatter-chart__point{fill:var(--tx-scatter-chart-color);transform-box:fill-box;transform-origin:center}.tx-scatter-chart__trend,.tx-scatter-chart__guide{pointer-events:none}.tx-scatter-chart__guide{shape-rendering:crispEdges}:host([data-styled]) .tx-scatter-chart__point{fill-opacity:var(--tx-chart-scatter-fill-opacity);stroke:var(--tx-chart-scatter-stroke-color);stroke-width:var(--tx-chart-scatter-stroke-width);transition:opacity var(--tx-chart-motion-hover-duration) ease,fill-opacity var(--tx-chart-motion-hover-duration) ease,stroke var(--tx-chart-motion-hover-duration) ease,stroke-width var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-scatter-chart__point--active{fill-opacity:1;stroke:var(--tx-scatter-chart-color);stroke-width:var(--tx-chart-scatter-active-stroke-width);paint-order:stroke}:host([data-styled]) .tx-scatter-chart__trend{stroke-width:var(--tx-chart-scatter-trend-width);stroke-dasharray:var(--tx-chart-scatter-trend-dash);stroke-linecap:round;transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-scatter-chart__guide{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled].tx-scatter-chart--bubble) .tx-scatter-chart__point:not(.tx-scatter-chart__point--active){fill-opacity:var(--tx-chart-scatter-bubble-fill-opacity)}:host([data-styled].tx-scatter-chart--focused) .tx-scatter-chart__point:not(.tx-scatter-chart__point--focused),:host([data-styled].tx-scatter-chart--focused) .tx-scatter-chart__trend:not(.tx-scatter-chart__trend--focused){opacity:var(--tx-chart-scatter-dimmed-opacity)}:host([data-styled].tx-scatter-chart--morph) .tx-scatter-chart__point{transition:opacity var(--tx-chart-motion-hover-duration) ease,fill-opacity var(--tx-chart-motion-hover-duration) ease,stroke var(--tx-chart-motion-hover-duration) ease,stroke-width var(--tx-chart-motion-hover-duration) ease,cx var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),cy var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),r var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-scatter-chart--entering) .tx-scatter-chart__point{animation:tx-scatter-chart-pop var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-scatter-chart-order, 0) * var(--tx-chart-motion-stagger) * .5)}:host([data-styled].tx-scatter-chart--entering) .tx-scatter-chart__trend{animation:tx-scatter-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-scatter-chart-pop{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes tx-scatter-chart-fade{0%,50%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-scatter-chart__point,:host([data-styled]) .tx-scatter-chart__trend{transition:none;animation:none}}\n"],
796
+ dependencies: [
797
+ {
798
+ kind: "component",
799
+ type: TxChartFrame,
800
+ selector: "tx-chart-frame",
801
+ inputs: [
802
+ "height",
803
+ "size",
804
+ "legendItems",
805
+ "showLegend",
806
+ "legendPosition",
807
+ "legendAlign",
808
+ "legendVariant",
809
+ "legendToggle",
810
+ "legendTemplate",
811
+ "empty",
812
+ "loading",
813
+ "emptyIcon",
814
+ "summary",
815
+ "table",
816
+ "tooltip",
817
+ "tooltipTemplate",
818
+ "tooltipPlacement",
819
+ "panelStyle",
820
+ "parts",
821
+ "styled",
822
+ "interactive",
823
+ "actionKeys",
824
+ "zoomable",
825
+ "zoomedIn",
826
+ "plotHeight",
827
+ "toolbar",
828
+ "exportName"
829
+ ],
830
+ outputs: [
831
+ "sizeChange",
832
+ "pointer",
833
+ "navigate",
834
+ "legendToggled",
835
+ "legendHovered",
836
+ "tooltipClosed",
837
+ "zoomed",
838
+ "panned",
839
+ "zoomReset"
840
+ ]
841
+ },
842
+ {
843
+ kind: "component",
844
+ type: TxChartAxes,
845
+ selector: "g[tx-chart-axes]",
846
+ inputs: [
847
+ "tx-chart-axes",
848
+ "gridPart",
849
+ "axisPart"
850
+ ]
851
+ },
852
+ {
853
+ kind: "component",
854
+ type: TxChartAnnotations,
855
+ selector: "g[tx-chart-annotations]",
856
+ inputs: [
857
+ "tx-chart-annotations",
858
+ "part",
859
+ "layer"
860
+ ]
861
+ }
862
+ ],
863
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
864
+ });
865
+ };
866
+ i0.ɵɵngDeclareClassMetadata({
867
+ minVersion: "12.0.0",
868
+ version: "22.2.3",
869
+ ngImport: i0,
870
+ type: TxScatterChart,
871
+ decorators: [{
872
+ type: Component,
873
+ args: [{
874
+ selector: "tx-scatter-chart",
875
+ imports: [
876
+ TxChartFrame,
877
+ TxChartAxes,
878
+ TxChartAnnotations
879
+ ],
880
+ changeDetection: ChangeDetectionStrategy.OnPush,
881
+ host: {
882
+ class: "tx-scatter-chart",
883
+ "[class]": "passThrough().root?.class",
884
+ "[style]": "hostStyle()",
885
+ "[attr.data-styled]": "!isUnstyled() || null",
886
+ "[class.tx-scatter-chart--bubble]": "isBubble()",
887
+ "[class.tx-scatter-chart--fill]": "typeof height() === \"string\"",
888
+ "[class.tx-scatter-chart--entering]": "entrance.active()",
889
+ "[class.tx-scatter-chart--morph]": "morph()",
890
+ "[class.tx-scatter-chart--focused]": "focusedSeries() !== null",
891
+ "[class.tx-scatter-chart--active]": "active() !== null"
892
+ },
893
+ 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-scatter\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\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 (guides(); as guide) {\n <svg:g class=\"tx-scatter-chart__guides\" [class]=\"passThrough().guide?.class\" [style]=\"passThrough().guide?.style\">\n <svg:line class=\"tx-scatter-chart__guide\" [attr.x1]=\"guide.x.x1\" [attr.y1]=\"guide.x.y1\" [attr.x2]=\"guide.x.x2\" [attr.y2]=\"guide.x.y2\" />\n <svg:line class=\"tx-scatter-chart__guide\" [attr.x1]=\"guide.y.x1\" [attr.y1]=\"guide.y.y1\" [attr.x2]=\"guide.y.x2\" [attr.y2]=\"guide.y.y2\" />\n </svg:g>\n }\n <svg:g class=\"tx-scatter-chart__points\">\n @for (dot of drawnDots(); track dot.key) {\n <svg:circle\n class=\"tx-scatter-chart__point\"\n [class.tx-scatter-chart__point--focused]=\"focusedSeries() === dot.series\"\n [class.tx-scatter-chart__point--active]=\"isActive(dot)\"\n [class]=\"passThrough().point?.class\"\n [style]=\"passThrough().point?.style\"\n [attr.data-series]=\"dot.series\"\n [attr.data-index]=\"dot.index\"\n [attr.cx]=\"dot.cx\"\n [attr.cy]=\"dot.cy\"\n [attr.r]=\"dot.r\"\n [style.--tx-scatter-chart-color]=\"dot.color\"\n [style.--tx-scatter-chart-order]=\"dot.order\"\n />\n }\n </svg:g>\n @for (trend of trends(); track trend.key) {\n <svg:line\n class=\"tx-scatter-chart__trend\"\n [class.tx-scatter-chart__trend--focused]=\"focusedSeries() === trend.series\"\n [class]=\"passThrough().trendLine?.class\"\n [style]=\"passThrough().trendLine?.style\"\n [attr.data-series]=\"trend.series\"\n [attr.x1]=\"trend.x1\"\n [attr.y1]=\"trend.y1\"\n [attr.x2]=\"trend.x2\"\n [attr.y2]=\"trend.y2\"\n [style.stroke]=\"trend.color\"\n />\n }\n <svg:g [tx-chart-annotations]=\"annotationShapes()\" layer=\"front\" [part]=\"passThrough().annotation\" />\n</tx-chart-frame>\n",
894
+ styles: [":host{display:block;min-width:0}:host(.tx-scatter-chart--fill){height:100%}.tx-scatter-chart__point{fill:var(--tx-scatter-chart-color);transform-box:fill-box;transform-origin:center}.tx-scatter-chart__trend,.tx-scatter-chart__guide{pointer-events:none}.tx-scatter-chart__guide{shape-rendering:crispEdges}:host([data-styled]) .tx-scatter-chart__point{fill-opacity:var(--tx-chart-scatter-fill-opacity);stroke:var(--tx-chart-scatter-stroke-color);stroke-width:var(--tx-chart-scatter-stroke-width);transition:opacity var(--tx-chart-motion-hover-duration) ease,fill-opacity var(--tx-chart-motion-hover-duration) ease,stroke var(--tx-chart-motion-hover-duration) ease,stroke-width var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-scatter-chart__point--active{fill-opacity:1;stroke:var(--tx-scatter-chart-color);stroke-width:var(--tx-chart-scatter-active-stroke-width);paint-order:stroke}:host([data-styled]) .tx-scatter-chart__trend{stroke-width:var(--tx-chart-scatter-trend-width);stroke-dasharray:var(--tx-chart-scatter-trend-dash);stroke-linecap:round;transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-scatter-chart__guide{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled].tx-scatter-chart--bubble) .tx-scatter-chart__point:not(.tx-scatter-chart__point--active){fill-opacity:var(--tx-chart-scatter-bubble-fill-opacity)}:host([data-styled].tx-scatter-chart--focused) .tx-scatter-chart__point:not(.tx-scatter-chart__point--focused),:host([data-styled].tx-scatter-chart--focused) .tx-scatter-chart__trend:not(.tx-scatter-chart__trend--focused){opacity:var(--tx-chart-scatter-dimmed-opacity)}:host([data-styled].tx-scatter-chart--morph) .tx-scatter-chart__point{transition:opacity var(--tx-chart-motion-hover-duration) ease,fill-opacity var(--tx-chart-motion-hover-duration) ease,stroke var(--tx-chart-motion-hover-duration) ease,stroke-width var(--tx-chart-motion-hover-duration) ease,cx var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),cy var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),r var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-scatter-chart--entering) .tx-scatter-chart__point{animation:tx-scatter-chart-pop var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-scatter-chart-order, 0) * var(--tx-chart-motion-stagger) * .5)}:host([data-styled].tx-scatter-chart--entering) .tx-scatter-chart__trend{animation:tx-scatter-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-scatter-chart-pop{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes tx-scatter-chart-fade{0%,50%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-scatter-chart__point,:host([data-styled]) .tx-scatter-chart__trend{transition:none;animation:none}}\n"]
895
+ }]
896
+ }],
897
+ ctorParameters: () => [],
898
+ propDecorators: {
899
+ series: [{
900
+ type: i0.Input,
901
+ args: [{
902
+ isSignal: true,
903
+ alias: "series",
904
+ required: false
905
+ }]
906
+ }],
907
+ xType: [{
908
+ type: i0.Input,
909
+ args: [{
910
+ isSignal: true,
911
+ alias: "xType",
912
+ required: false
913
+ }]
914
+ }],
915
+ annotations: [{
916
+ type: i0.Input,
917
+ args: [{
918
+ isSignal: true,
919
+ alias: "annotations",
920
+ required: false
921
+ }]
922
+ }],
923
+ height: [{
924
+ type: i0.Input,
925
+ args: [{
926
+ isSignal: true,
927
+ alias: "height",
928
+ required: false
929
+ }]
930
+ }],
931
+ trendLine: [{
932
+ type: i0.Input,
933
+ args: [{
934
+ isSignal: true,
935
+ alias: "trendLine",
936
+ required: false
937
+ }]
938
+ }],
939
+ showLegend: [{
940
+ type: i0.Input,
941
+ args: [{
942
+ isSignal: true,
943
+ alias: "showLegend",
944
+ required: false
945
+ }]
946
+ }],
947
+ legendPosition: [{
948
+ type: i0.Input,
949
+ args: [{
950
+ isSignal: true,
951
+ alias: "legendPosition",
952
+ required: false
953
+ }]
954
+ }],
955
+ legendAlign: [{
956
+ type: i0.Input,
957
+ args: [{
958
+ isSignal: true,
959
+ alias: "legendAlign",
960
+ required: false
961
+ }]
962
+ }],
963
+ legendVariant: [{
964
+ type: i0.Input,
965
+ args: [{
966
+ isSignal: true,
967
+ alias: "legendVariant",
968
+ required: false
969
+ }]
970
+ }],
971
+ showTooltip: [{
972
+ type: i0.Input,
973
+ args: [{
974
+ isSignal: true,
975
+ alias: "showTooltip",
976
+ required: false
977
+ }]
978
+ }],
979
+ xValueFormat: [{
980
+ type: i0.Input,
981
+ args: [{
982
+ isSignal: true,
983
+ alias: "xValueFormat",
984
+ required: false
985
+ }]
986
+ }],
987
+ valueFormat: [{
988
+ type: i0.Input,
989
+ args: [{
990
+ isSignal: true,
991
+ alias: "valueFormat",
992
+ required: false
993
+ }]
994
+ }],
995
+ sizeFormat: [{
996
+ type: i0.Input,
997
+ args: [{
998
+ isSignal: true,
999
+ alias: "sizeFormat",
1000
+ required: false
1001
+ }]
1002
+ }],
1003
+ yScale: [{
1004
+ type: i0.Input,
1005
+ args: [{
1006
+ isSignal: true,
1007
+ alias: "yScale",
1008
+ required: false
1009
+ }]
1010
+ }],
1011
+ xMin: [{
1012
+ type: i0.Input,
1013
+ args: [{
1014
+ isSignal: true,
1015
+ alias: "xMin",
1016
+ required: false
1017
+ }]
1018
+ }],
1019
+ xMax: [{
1020
+ type: i0.Input,
1021
+ args: [{
1022
+ isSignal: true,
1023
+ alias: "xMax",
1024
+ required: false
1025
+ }]
1026
+ }],
1027
+ yMin: [{
1028
+ type: i0.Input,
1029
+ args: [{
1030
+ isSignal: true,
1031
+ alias: "yMin",
1032
+ required: false
1033
+ }]
1034
+ }],
1035
+ yMax: [{
1036
+ type: i0.Input,
1037
+ args: [{
1038
+ isSignal: true,
1039
+ alias: "yMax",
1040
+ required: false
1041
+ }]
1042
+ }],
1043
+ xAxisTitle: [{
1044
+ type: i0.Input,
1045
+ args: [{
1046
+ isSignal: true,
1047
+ alias: "xAxisTitle",
1048
+ required: false
1049
+ }]
1050
+ }],
1051
+ yAxisTitle: [{
1052
+ type: i0.Input,
1053
+ args: [{
1054
+ isSignal: true,
1055
+ alias: "yAxisTitle",
1056
+ required: false
1057
+ }]
1058
+ }],
1059
+ sizeLabel: [{
1060
+ type: i0.Input,
1061
+ args: [{
1062
+ isSignal: true,
1063
+ alias: "sizeLabel",
1064
+ required: false
1065
+ }]
1066
+ }],
1067
+ grid: [{
1068
+ type: i0.Input,
1069
+ args: [{
1070
+ isSignal: true,
1071
+ alias: "grid",
1072
+ required: false
1073
+ }]
1074
+ }],
1075
+ xAxisPosition: [{
1076
+ type: i0.Input,
1077
+ args: [{
1078
+ isSignal: true,
1079
+ alias: "xAxisPosition",
1080
+ required: false
1081
+ }]
1082
+ }],
1083
+ yAxisPosition: [{
1084
+ type: i0.Input,
1085
+ args: [{
1086
+ isSignal: true,
1087
+ alias: "yAxisPosition",
1088
+ required: false
1089
+ }]
1090
+ }],
1091
+ toolbar: [{
1092
+ type: i0.Input,
1093
+ args: [{
1094
+ isSignal: true,
1095
+ alias: "toolbar",
1096
+ required: false
1097
+ }]
1098
+ }],
1099
+ loading: [{
1100
+ type: i0.Input,
1101
+ args: [{
1102
+ isSignal: true,
1103
+ alias: "loading",
1104
+ required: false
1105
+ }]
1106
+ }],
1107
+ ariaLabel: [{
1108
+ type: i0.Input,
1109
+ args: [{
1110
+ isSignal: true,
1111
+ alias: "ariaLabel",
1112
+ required: false
1113
+ }]
1114
+ }],
1115
+ dt: [{
1116
+ type: i0.Input,
1117
+ args: [{
1118
+ isSignal: true,
1119
+ alias: "dt",
1120
+ required: false
1121
+ }]
1122
+ }],
1123
+ pt: [{
1124
+ type: i0.Input,
1125
+ args: [{
1126
+ isSignal: true,
1127
+ alias: "pt",
1128
+ required: false
1129
+ }]
1130
+ }],
1131
+ ptOptions: [{
1132
+ type: i0.Input,
1133
+ args: [{
1134
+ isSignal: true,
1135
+ alias: "ptOptions",
1136
+ required: false
1137
+ }]
1138
+ }],
1139
+ unstyled: [{
1140
+ type: i0.Input,
1141
+ args: [{
1142
+ isSignal: true,
1143
+ alias: "unstyled",
1144
+ required: false
1145
+ }]
1146
+ }],
1147
+ seriesToggle: [{
1148
+ type: i0.Output,
1149
+ args: ["seriesToggle"]
1150
+ }],
1151
+ pointClick: [{
1152
+ type: i0.Output,
1153
+ args: ["pointClick"]
1154
+ }],
1155
+ legendTemplate: [{
1156
+ type: i0.ContentChild,
1157
+ args: [i0.forwardRef(() => TxChartLegendTemplate), { isSignal: true }]
1158
+ }],
1159
+ tooltipTemplate: [{
1160
+ type: i0.ContentChild,
1161
+ args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
1162
+ }],
1163
+ frame: [{
1164
+ type: i0.ViewChild,
1165
+ args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
1166
+ }]
1167
+ }
1168
+ });
1169
+ function padRange([from, to], pad) {
1170
+ return [from >= 0 ? Math.max(0, from - pad) : from - pad, to <= 0 ? Math.min(0, to + pad) : to + pad];
1171
+ }
1172
+ export { TxScatterChart, bubbleRadius, linearTrend, nearestDot, scatterData };
1173
+
1174
+ //# sourceMappingURL=tectra-ng-charts-scatter.mjs.map