@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,1059 @@
1
+ import { TX_CHART_LEGEND_ROW, TX_CHART_LEGEND_SIDE, TX_FULL_CIRCLE, TxChartFrame, TxChartLegendTemplate, TxChartTooltipTemplate, arcBounds, arcBounds as arcBounds$1, arcPath, arcPath as arcPath$1, chartHeightValue, chartNumberFormatter, chartSummary, injectChartEntrance, maxCornerRadius, numberFormat, parseRatio, polar, polar as polar$1, readTokenNumber, seriesColor, textWidth, toRadians, toRadians as toRadians$1, toggleKey } from "@tectra-ng/charts/core";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, Directive, ElementRef, Pipe, TemplateRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, linkedSignal, output, signal, viewChild } from "@angular/core";
4
+ import { NgTemplateOutlet } from "@angular/common";
5
+ import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
6
+ import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
7
+ import { optionalBoolean } from "@tectra-ng/core/utils";
8
+ import { toStyleObject } from "@tectra-ng/themes";
9
+ const round = (value) => Math.round(value * 100) / 100;
10
+ function pieAngles(values, startAngle = 0, endAngle = 360) {
11
+ const start = toRadians$1(startAngle);
12
+ const span = toRadians$1(Math.min(360, Math.max(0, endAngle - startAngle)));
13
+ const total = values.reduce((sum, value) => sum + (value > 0 ? value : 0), 0);
14
+ let cursor = start;
15
+ return values.map((raw, index) => {
16
+ const value = raw > 0 ? raw : 0;
17
+ const sweep = total ? value / total * span : 0;
18
+ const arc = {
19
+ start: cursor,
20
+ end: cursor + sweep,
21
+ value,
22
+ index
23
+ };
24
+ cursor += sweep;
25
+ return arc;
26
+ });
27
+ }
28
+ function fitPie(width, height, startAngle = 0, endAngle = 360, padding = 4) {
29
+ const start = toRadians$1(startAngle);
30
+ const end = toRadians$1(Math.max(startAngle, Math.min(startAngle + 360, endAngle)));
31
+ const bounds = arcBounds$1(start, end);
32
+ const boxWidth = bounds.maxX - bounds.minX || 1;
33
+ const boxHeight = bounds.maxY - bounds.minY || 1;
34
+ const radius = Math.max(0, Math.min((width - padding * 2) / boxWidth, (height - padding * 2) / boxHeight));
35
+ return {
36
+ cx: width / 2 - (bounds.minX + bounds.maxX) / 2 * radius,
37
+ cy: height / 2 - (bounds.minY + bounds.maxY) / 2 * radius,
38
+ radius
39
+ };
40
+ }
41
+ function pieArcs(values, options) {
42
+ const fit = fitPie(options.width, options.height, options.startAngle ?? 0, options.endAngle ?? 360, options.padding ?? 4);
43
+ const inner = fit.radius * Math.min(.95, Math.max(0, options.donutSize ?? 0));
44
+ const total = values.reduce((sum, value) => sum + (value > 0 ? value : 0), 0);
45
+ return {
46
+ fit,
47
+ inner,
48
+ arcs: pieAngles(values, options.startAngle ?? 0, options.endAngle ?? 360).map((angle) => {
49
+ const middle = (angle.start + angle.end) / 2;
50
+ const labelRadius = inner > 0 ? (inner + fit.radius) / 2 : fit.radius * .62;
51
+ const label = polar$1(fit.cx, fit.cy, labelRadius, middle);
52
+ return {
53
+ index: angle.index,
54
+ value: angle.value,
55
+ percent: total ? angle.value / total * 100 : 0,
56
+ start: angle.start,
57
+ end: angle.end,
58
+ path: arcPath$1(fit.cx, fit.cy, inner, fit.radius, angle.start, angle.end, options.cornerRadius ?? 0),
59
+ labelX: round(label.x),
60
+ labelY: round(label.y),
61
+ middle
62
+ };
63
+ })
64
+ };
65
+ }
66
+ function arcAt(arcs, fit, inner, x, y) {
67
+ const dx = x - fit.cx;
68
+ const dy = y - fit.cy;
69
+ const distance = Math.hypot(dx, dy);
70
+ if (distance > fit.radius + 2 || distance < inner - 2) return -1;
71
+ let angle = Math.atan2(dx, -dy);
72
+ const first = arcs.find((arc) => arc.end > arc.start)?.start ?? 0;
73
+ while (angle < first) angle += TX_FULL_CIRCLE;
74
+ while (angle >= first + TX_FULL_CIRCLE) angle -= TX_FULL_CIRCLE;
75
+ return arcs.find((arc) => arc.end > arc.start && angle >= arc.start && angle < arc.end)?.index ?? -1;
76
+ }
77
+ function pieLegend(data) {
78
+ if (!data) return [];
79
+ const total = data.series.reduce((sum, value) => sum + (value > 0 ? value : 0), 0);
80
+ return data.series.map((value, index) => ({
81
+ label: data.labels[index] ?? "",
82
+ value,
83
+ percent: total ? Math.max(0, value) / total * 100 : 0,
84
+ color: seriesColor(data.colors?.[index], index)
85
+ }));
86
+ }
87
+ var TxPieLegendPipe = class TxPieLegendPipe {
88
+ transform(data) {
89
+ return pieLegend(data);
90
+ }
91
+ static ɵfac = i0.ɵɵngDeclareFactory({
92
+ minVersion: "12.0.0",
93
+ version: "22.2.3",
94
+ ngImport: i0,
95
+ type: TxPieLegendPipe,
96
+ deps: [],
97
+ target: i0.ɵɵFactoryTarget.Pipe
98
+ });
99
+ static ɵpipe = i0.ɵɵngDeclarePipe({
100
+ minVersion: "14.0.0",
101
+ version: "22.2.3",
102
+ ngImport: i0,
103
+ type: TxPieLegendPipe,
104
+ isStandalone: true,
105
+ name: "txPieLegend"
106
+ });
107
+ };
108
+ i0.ɵɵngDeclareClassMetadata({
109
+ minVersion: "12.0.0",
110
+ version: "22.2.3",
111
+ ngImport: i0,
112
+ type: TxPieLegendPipe,
113
+ decorators: [{
114
+ type: Pipe,
115
+ args: [{ name: "txPieLegend" }]
116
+ }]
117
+ });
118
+ var TxPieCenter = class TxPieCenter {
119
+ template = inject(TemplateRef);
120
+ static ngTemplateContextGuard(_directive, context) {
121
+ return !!context;
122
+ }
123
+ static ɵfac = i0.ɵɵngDeclareFactory({
124
+ minVersion: "12.0.0",
125
+ version: "22.2.3",
126
+ ngImport: i0,
127
+ type: TxPieCenter,
128
+ deps: [],
129
+ target: i0.ɵɵFactoryTarget.Directive
130
+ });
131
+ static ɵdir = i0.ɵɵngDeclareDirective({
132
+ minVersion: "14.0.0",
133
+ version: "22.2.3",
134
+ type: TxPieCenter,
135
+ isStandalone: true,
136
+ selector: "ng-template[txPieCenter]",
137
+ ngImport: i0
138
+ });
139
+ };
140
+ i0.ɵɵngDeclareClassMetadata({
141
+ minVersion: "12.0.0",
142
+ version: "22.2.3",
143
+ ngImport: i0,
144
+ type: TxPieCenter,
145
+ decorators: [{
146
+ type: Directive,
147
+ args: [{ selector: "ng-template[txPieCenter]" }]
148
+ }]
149
+ });
150
+ const MIN_LABEL_ANGLE = 10 * Math.PI / 180;
151
+ const LEGEND_ITEM_WIDTH = 34;
152
+ const DEFAULT_SEGMENT_RADIUS = 4;
153
+ const STAT_ITEM_WIDTH = 116;
154
+ const STAT_ROW = 66;
155
+ const LEGEND_LINE = 25;
156
+ const LEGEND_ROW_GAP = 3;
157
+ const LEGEND_GAP = 10.5;
158
+ var TxPieChart = class TxPieChart {
159
+ locale = inject(TxLocaleService);
160
+ host = inject(ElementRef);
161
+ translations = injectTranslations();
162
+ pieData = input.required(...ngDevMode ? [{ debugName: "pieData" }] : /* istanbul ignore next */ []);
163
+ chartWidth = input(200, ...ngDevMode ? [{ debugName: "chartWidth" }] : /* istanbul ignore next */ []);
164
+ chartHeight = input(400, ...ngDevMode ? [{ debugName: "chartHeight" }] : /* istanbul ignore next */ []);
165
+ showLegend = input(true, {
166
+ ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
167
+ transform: booleanAttribute
168
+ });
169
+ legendPosition = input("bottom", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
170
+ legendAlign = input("center", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
171
+ legendValues = input(false, {
172
+ ...ngDevMode ? { debugName: "legendValues" } : /* istanbul ignore next */ {},
173
+ transform: booleanAttribute
174
+ });
175
+ legendVariant = input("dot", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
176
+ showDataLabels = input(true, {
177
+ ...ngDevMode ? { debugName: "showDataLabels" } : /* istanbul ignore next */ {},
178
+ transform: booleanAttribute
179
+ });
180
+ totalLabel = input("", ...ngDevMode ? [{ debugName: "totalLabel" }] : /* istanbul ignore next */ []);
181
+ totalFormatter = input(null, ...ngDevMode ? [{ debugName: "totalFormatter" }] : /* istanbul ignore next */ []);
182
+ tooltipFormatter = input(null, ...ngDevMode ? [{ debugName: "tooltipFormatter" }] : /* istanbul ignore next */ []);
183
+ showTooltip = input(true, {
184
+ ...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
185
+ transform: booleanAttribute
186
+ });
187
+ valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
188
+ donutSize = input("65%", ...ngDevMode ? [{ debugName: "donutSize" }] : /* istanbul ignore next */ []);
189
+ segmentGap = input(2, ...ngDevMode ? [{ debugName: "segmentGap" }] : /* istanbul ignore next */ []);
190
+ segmentRadius = input(void 0, ...ngDevMode ? [{ debugName: "segmentRadius" }] : /* istanbul ignore next */ []);
191
+ startAngle = input(0, ...ngDevMode ? [{ debugName: "startAngle" }] : /* istanbul ignore next */ []);
192
+ endAngle = input(360, ...ngDevMode ? [{ debugName: "endAngle" }] : /* istanbul ignore next */ []);
193
+ toolbar = input(true, {
194
+ ...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
195
+ transform: booleanAttribute
196
+ });
197
+ loading = input(false, {
198
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
199
+ transform: booleanAttribute
200
+ });
201
+ ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
202
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
203
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
204
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
205
+ unstyled = input(void 0, {
206
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
207
+ transform: optionalBoolean
208
+ });
209
+ segmentClick = output();
210
+ segmentToggle = output();
211
+ centerTemplate = contentChild(TxPieCenter, ...ngDevMode ? [{ debugName: "centerTemplate" }] : /* istanbul ignore next */ []);
212
+ legendTemplate = contentChild(TxChartLegendTemplate, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
213
+ tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
214
+ frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
215
+ isUnstyled = injectUnstyled(this.unstyled);
216
+ passThrough = injectPassThrough("pieChart", this, this.pt, this.ptOptions);
217
+ tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
218
+ hostStyle = computed(() => ({
219
+ ...this.tokenStyle(),
220
+ width: this.cssSize(this.chartWidth()),
221
+ height: this.cssSize(this.chartHeight()),
222
+ ...this.passThrough().root?.style
223
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
224
+ entrance = injectChartEntrance();
225
+ morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
226
+ hidden = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
227
+ hovered = signal(null, ...ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []);
228
+ tokenRadius = signal(DEFAULT_SEGMENT_RADIUS, ...ngDevMode ? [{ debugName: "tokenRadius" }] : /* istanbul ignore next */ []);
229
+ keyboard = signal(false, ...ngDevMode ? [{ debugName: "keyboard" }] : /* istanbul ignore next */ []);
230
+ fromLegend = signal(false, ...ngDevMode ? [{ debugName: "fromLegend" }] : /* istanbul ignore next */ []);
231
+ intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
232
+ values = computed(() => this.pieData()?.series ?? [], ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
233
+ labels = computed(() => this.values().map((_, index) => this.pieData()?.labels[index] ?? ""), ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
234
+ keys = computed(() => this.labels().map((label, index) => `${index}:${label}`), ...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
235
+ colors = computed(() => this.values().map((_, index) => seriesColor(this.pieData()?.colors?.[index], index)), ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
236
+ total = computed(() => this.values().reduce((sum, value, index) => sum + (value > 0 && !this.hidden().has(this.keys()[index]) ? value : 0), 0), ...ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []);
237
+ isEmpty = computed(() => !this.values().length || this.values().every((value) => !(value > 0)), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
238
+ legendShown = computed(() => this.showLegend() && this.values().length > 0, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
239
+ sideLegend = computed(() => this.legendPosition() === "left" || this.legendPosition() === "right", ...ngDevMode ? [{ debugName: "sideLegend" }] : /* istanbul ignore next */ []);
240
+ size = linkedSignal(() => {
241
+ const width = typeof this.chartWidth() === "number" ? this.chartWidth() : 200;
242
+ return {
243
+ width: this.legendShown() && this.sideLegend() ? Math.max(80, width - TX_CHART_LEGEND_SIDE) : width,
244
+ height: width
245
+ };
246
+ }, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
247
+ plotHeight = computed(() => {
248
+ const width = this.size().width;
249
+ const height = this.chartHeight();
250
+ if (typeof height === "string" && !/px$/.test(height.trim())) return Math.round(width);
251
+ const toolbarRow = this.toolbar() && !(this.legendShown() && this.legendPosition() === "top") ? TX_CHART_LEGEND_ROW : 0;
252
+ const available = chartHeightValue(height) - (this.legendShown() && !this.sideLegend() ? this.legendReserve() : 0) - toolbarRow;
253
+ return Math.max(40, Math.round(Math.min(width, available)));
254
+ }, ...ngDevMode ? [{ debugName: "plotHeight" }] : /* istanbul ignore next */ []);
255
+ legendReserve = computed(() => {
256
+ const width = Math.max(1, this.size().width);
257
+ const items = this.legendItems();
258
+ if (this.legendVariant() === "stat") {
259
+ const perRow = Math.max(1, Math.floor(width / STAT_ITEM_WIDTH));
260
+ return Math.ceil(items.length / perRow) * STAT_ROW + 7;
261
+ }
262
+ if (this.legendValues()) return items.length * 22 + 8;
263
+ let rows = 1;
264
+ let line = 0;
265
+ for (const item of items) {
266
+ const next = textWidth(item.label, 12.25) + LEGEND_ITEM_WIDTH + (this.legendVariant() === "pill" ? 12 : 0);
267
+ if (line && line + next > width) {
268
+ rows += 1;
269
+ line = 0;
270
+ }
271
+ line += next;
272
+ }
273
+ return rows * LEGEND_LINE + (rows - 1) * LEGEND_ROW_GAP + LEGEND_GAP;
274
+ }, ...ngDevMode ? [{ debugName: "legendReserve" }] : /* istanbul ignore next */ []);
275
+ inner = computed(() => Math.min(.95, Math.max(0, parseRatio(this.donutSize(), .65))), ...ngDevMode ? [{ debugName: "inner" }] : /* istanbul ignore next */ []);
276
+ geometry = computed(() => pieArcs(this.values().map((value, index) => this.hidden().has(this.keys()[index]) ? 0 : value), {
277
+ width: this.size().width,
278
+ height: this.plotHeight(),
279
+ startAngle: this.startAngle(),
280
+ endAngle: this.endAngle(),
281
+ donutSize: this.inner(),
282
+ padding: Math.max(8, this.segmentGap() + 2),
283
+ cornerRadius: this.segmentRadius() ?? this.tokenRadius()
284
+ }), ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
285
+ valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
286
+ percentFormatter = computed(() => {
287
+ const format = chartNumberFormatter(this.intl(), "percent");
288
+ return (value) => format(value);
289
+ }, ...ngDevMode ? [{ debugName: "percentFormatter" }] : /* istanbul ignore next */ []);
290
+ dataLabelFormatter = computed(() => {
291
+ const format = numberFormat(this.intl(), {
292
+ style: "percent",
293
+ minimumFractionDigits: 1,
294
+ maximumFractionDigits: 1
295
+ });
296
+ return (percent) => format.format(percent / 100);
297
+ }, ...ngDevMode ? [{ debugName: "dataLabelFormatter" }] : /* istanbul ignore next */ []);
298
+ segments = computed(() => {
299
+ const { arcs } = this.geometry();
300
+ const labelFormat = this.dataLabelFormatter();
301
+ return arcs.filter((arc) => arc.end > arc.start).map((arc) => ({
302
+ ...arc,
303
+ key: this.keys()[arc.index],
304
+ color: this.colors()[arc.index],
305
+ ux: Math.round(Math.sin(arc.middle) * 1e3) / 1e3,
306
+ uy: Math.round(-Math.cos(arc.middle) * 1e3) / 1e3,
307
+ label: this.showDataLabels() && arc.end - arc.start >= MIN_LABEL_ANGLE ? labelFormat(arc.percent) : null
308
+ }));
309
+ }, ...ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []);
310
+ center = computed(() => {
311
+ const index = this.hovered();
312
+ const format = this.totalFormatter() ?? this.valueFormatter();
313
+ if (index !== null && this.values()[index] !== void 0) {
314
+ const raw = this.values()[index];
315
+ return {
316
+ label: this.labels()[index],
317
+ value: format(raw),
318
+ raw,
319
+ total: this.total(),
320
+ hovered: true,
321
+ index,
322
+ color: this.colors()[index]
323
+ };
324
+ }
325
+ if (!this.totalLabel()) return null;
326
+ return {
327
+ label: this.totalLabel(),
328
+ value: format(this.total()),
329
+ raw: this.total(),
330
+ total: this.total(),
331
+ hovered: false,
332
+ index: -1,
333
+ color: null
334
+ };
335
+ }, ...ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []);
336
+ centerBox = computed(() => {
337
+ const { fit, inner } = this.geometry();
338
+ const side = inner * Math.SQRT2 * .92;
339
+ return {
340
+ x: fit.cx - side / 2,
341
+ y: fit.cy - side / 2,
342
+ size: Math.max(0, side),
343
+ cx: fit.cx,
344
+ cy: fit.cy
345
+ };
346
+ }, ...ngDevMode ? [{ debugName: "centerBox" }] : /* istanbul ignore next */ []);
347
+ centerFont = computed(() => {
348
+ const inner = this.geometry().inner;
349
+ return {
350
+ name: Math.max(10, Math.min(12, inner * .17)),
351
+ value: Math.max(13, Math.min(22, inner * .3))
352
+ };
353
+ }, ...ngDevMode ? [{ debugName: "centerFont" }] : /* istanbul ignore next */ []);
354
+ legendItems = computed(() => {
355
+ const total = this.total();
356
+ const format = this.valueFormatter();
357
+ const percent = this.percentFormatter();
358
+ return this.values().map((value, index) => ({
359
+ key: this.keys()[index],
360
+ label: this.labels()[index],
361
+ color: this.colors()[index],
362
+ hidden: this.hidden().has(this.keys()[index]),
363
+ ...this.legendVariant() === "stat" ? {
364
+ value: format(value),
365
+ caption: percent(total && !this.hidden().has(this.keys()[index]) ? Number((Math.max(0, value) / total * 100).toFixed(1)) : 0)
366
+ } : this.legendValues() ? {
367
+ value: format(value),
368
+ percent: percent(total && !this.hidden().has(this.keys()[index]) ? Number((Math.max(0, value) / total * 100).toFixed(1)) : 0)
369
+ } : {}
370
+ }));
371
+ }, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
372
+ tooltip = computed(() => {
373
+ const index = this.hovered();
374
+ if (index === null || !this.showTooltip() || this.isEmpty() || this.fromLegend() || this.legendVariant() === "stat") return null;
375
+ const raw = this.values()[index];
376
+ const custom = this.tooltipFormatter();
377
+ const value = custom ? custom(raw, {
378
+ seriesIndex: index,
379
+ dataPointIndex: index
380
+ }) : this.valueFormatter()(raw);
381
+ const { arcs, fit } = this.geometry();
382
+ const arc = arcs[index];
383
+ const sin = Math.sin(arc.middle);
384
+ const cos = Math.cos(arc.middle);
385
+ const placement = Math.abs(sin) >= Math.SQRT1_2 ? sin > 0 ? "right" : "left" : cos > 0 ? "top" : "bottom";
386
+ const reach = fit.radius + 4;
387
+ const share = this.percentFormatter()(Number(arc.percent.toFixed(1)));
388
+ return {
389
+ title: "",
390
+ rows: [{
391
+ label: this.labels()[index],
392
+ value,
393
+ share,
394
+ color: this.colors()[index],
395
+ raw,
396
+ seriesIndex: index,
397
+ active: true
398
+ }],
399
+ index,
400
+ x: fit.cx + sin * reach,
401
+ y: fit.cy - cos * reach,
402
+ placement
403
+ };
404
+ }, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
405
+ summary = computed(() => {
406
+ const t = this.translations();
407
+ const values = this.values();
408
+ const format = this.valueFormatter();
409
+ const total = values.reduce((sum, value) => sum + (value > 0 ? value : 0), 0);
410
+ const withTotal = `${chartSummary(t, this.intl(), this.inner() > 0 ? t.chartDonut : t.chartPie, 1, values.length, null)}, ${t.chartTotal.toLocaleLowerCase(this.intl())} ${format(total)}`;
411
+ return this.ariaLabel() ? `${this.ariaLabel()}. ${withTotal}` : withTotal;
412
+ }, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
413
+ dataTable = computed(() => {
414
+ const t = this.translations();
415
+ const format = this.valueFormatter();
416
+ const percent = this.percentFormatter();
417
+ const total = this.values().reduce((sum, value) => sum + (value > 0 ? value : 0), 0);
418
+ return {
419
+ columns: [{
420
+ key: "value",
421
+ label: t.chartValue
422
+ }, {
423
+ key: "share",
424
+ label: t.chartShare
425
+ }],
426
+ rows: this.values().map((value, index) => ({
427
+ label: this.labels()[index],
428
+ cells: [format(value), percent(total ? Number((Math.max(0, value) / total * 100).toFixed(1)) : 0)]
429
+ }))
430
+ };
431
+ }, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
432
+ constructor() {
433
+ afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
434
+ afterRenderEffect(() => {
435
+ this.dt();
436
+ const next = this.isUnstyled() ? 0 : readTokenNumber(this.host.nativeElement, "--tx-chart-pie-segment-radius", DEFAULT_SEGMENT_RADIUS);
437
+ if (next !== this.tokenRadius()) this.tokenRadius.set(next);
438
+ });
439
+ }
440
+ onPointer(event) {
441
+ if (event.type === "leave") {
442
+ this.hovered.set(null);
443
+ return;
444
+ }
445
+ const { arcs, fit, inner } = this.geometry();
446
+ const index = arcAt(arcs, fit, inner, event.x, event.y);
447
+ this.keyboard.set(false);
448
+ this.fromLegend.set(false);
449
+ this.hovered.set(index >= 0 ? index : null);
450
+ if (event.type === "click" && index >= 0) this.segmentClick.emit({
451
+ index,
452
+ label: this.labels()[index],
453
+ value: this.values()[index],
454
+ percent: arcs[index].percent
455
+ });
456
+ }
457
+ onNavigate(event) {
458
+ if (event.key === "Escape") {
459
+ this.hovered.set(null);
460
+ return;
461
+ }
462
+ const visible = this.segments().map((segment) => segment.index);
463
+ if (!visible.length) return;
464
+ const current = this.hovered();
465
+ const at = current === null ? -1 : visible.indexOf(current);
466
+ const forward = event.key === "ArrowRight" || event.key === "ArrowDown";
467
+ const index = visible[event.key === "Home" ? 0 : event.key === "End" ? visible.length - 1 : at < 0 ? forward ? 0 : visible.length - 1 : (at + (forward ? 1 : -1) + visible.length) % visible.length];
468
+ this.keyboard.set(true);
469
+ this.fromLegend.set(false);
470
+ this.hovered.set(index);
471
+ const arc = this.geometry().arcs[index];
472
+ this.frame()?.announce(`${this.labels()[index]}: ${this.valueFormatter()(this.values()[index])}, ${this.percentFormatter()(Number(arc.percent.toFixed(1)))}`);
473
+ }
474
+ onLegendToggle(key) {
475
+ const index = this.keys().indexOf(key);
476
+ this.hidden.update((keys) => toggleKey(keys, key));
477
+ this.hovered.set(null);
478
+ this.segmentToggle.emit({
479
+ index,
480
+ label: this.labels()[index] ?? "",
481
+ hidden: this.hidden().has(key)
482
+ });
483
+ }
484
+ onLegendHover(key) {
485
+ const index = key === null ? -1 : this.keys().indexOf(key);
486
+ this.fromLegend.set(index >= 0);
487
+ this.hovered.set(index >= 0 && !this.hidden().has(key ?? "") ? index : null);
488
+ }
489
+ cssSize(value) {
490
+ return typeof value === "number" ? `${value}px` : value;
491
+ }
492
+ static ɵfac = i0.ɵɵngDeclareFactory({
493
+ minVersion: "12.0.0",
494
+ version: "22.2.3",
495
+ ngImport: i0,
496
+ type: TxPieChart,
497
+ deps: [],
498
+ target: i0.ɵɵFactoryTarget.Component
499
+ });
500
+ static ɵcmp = i0.ɵɵngDeclareComponent({
501
+ minVersion: "17.0.0",
502
+ version: "22.2.3",
503
+ type: TxPieChart,
504
+ isStandalone: true,
505
+ selector: "tx-pie-chart",
506
+ inputs: {
507
+ pieData: {
508
+ classPropertyName: "pieData",
509
+ publicName: "pieData",
510
+ isSignal: true,
511
+ isRequired: true,
512
+ transformFunction: null
513
+ },
514
+ chartWidth: {
515
+ classPropertyName: "chartWidth",
516
+ publicName: "chartWidth",
517
+ isSignal: true,
518
+ isRequired: false,
519
+ transformFunction: null
520
+ },
521
+ chartHeight: {
522
+ classPropertyName: "chartHeight",
523
+ publicName: "chartHeight",
524
+ isSignal: true,
525
+ isRequired: false,
526
+ transformFunction: null
527
+ },
528
+ showLegend: {
529
+ classPropertyName: "showLegend",
530
+ publicName: "showLegend",
531
+ isSignal: true,
532
+ isRequired: false,
533
+ transformFunction: null
534
+ },
535
+ legendPosition: {
536
+ classPropertyName: "legendPosition",
537
+ publicName: "legendPosition",
538
+ isSignal: true,
539
+ isRequired: false,
540
+ transformFunction: null
541
+ },
542
+ legendAlign: {
543
+ classPropertyName: "legendAlign",
544
+ publicName: "legendAlign",
545
+ isSignal: true,
546
+ isRequired: false,
547
+ transformFunction: null
548
+ },
549
+ legendValues: {
550
+ classPropertyName: "legendValues",
551
+ publicName: "legendValues",
552
+ isSignal: true,
553
+ isRequired: false,
554
+ transformFunction: null
555
+ },
556
+ legendVariant: {
557
+ classPropertyName: "legendVariant",
558
+ publicName: "legendVariant",
559
+ isSignal: true,
560
+ isRequired: false,
561
+ transformFunction: null
562
+ },
563
+ showDataLabels: {
564
+ classPropertyName: "showDataLabels",
565
+ publicName: "showDataLabels",
566
+ isSignal: true,
567
+ isRequired: false,
568
+ transformFunction: null
569
+ },
570
+ totalLabel: {
571
+ classPropertyName: "totalLabel",
572
+ publicName: "totalLabel",
573
+ isSignal: true,
574
+ isRequired: false,
575
+ transformFunction: null
576
+ },
577
+ totalFormatter: {
578
+ classPropertyName: "totalFormatter",
579
+ publicName: "totalFormatter",
580
+ isSignal: true,
581
+ isRequired: false,
582
+ transformFunction: null
583
+ },
584
+ tooltipFormatter: {
585
+ classPropertyName: "tooltipFormatter",
586
+ publicName: "tooltipFormatter",
587
+ isSignal: true,
588
+ isRequired: false,
589
+ transformFunction: null
590
+ },
591
+ showTooltip: {
592
+ classPropertyName: "showTooltip",
593
+ publicName: "showTooltip",
594
+ isSignal: true,
595
+ isRequired: false,
596
+ transformFunction: null
597
+ },
598
+ valueFormat: {
599
+ classPropertyName: "valueFormat",
600
+ publicName: "valueFormat",
601
+ isSignal: true,
602
+ isRequired: false,
603
+ transformFunction: null
604
+ },
605
+ donutSize: {
606
+ classPropertyName: "donutSize",
607
+ publicName: "donutSize",
608
+ isSignal: true,
609
+ isRequired: false,
610
+ transformFunction: null
611
+ },
612
+ segmentGap: {
613
+ classPropertyName: "segmentGap",
614
+ publicName: "segmentGap",
615
+ isSignal: true,
616
+ isRequired: false,
617
+ transformFunction: null
618
+ },
619
+ segmentRadius: {
620
+ classPropertyName: "segmentRadius",
621
+ publicName: "segmentRadius",
622
+ isSignal: true,
623
+ isRequired: false,
624
+ transformFunction: null
625
+ },
626
+ startAngle: {
627
+ classPropertyName: "startAngle",
628
+ publicName: "startAngle",
629
+ isSignal: true,
630
+ isRequired: false,
631
+ transformFunction: null
632
+ },
633
+ endAngle: {
634
+ classPropertyName: "endAngle",
635
+ publicName: "endAngle",
636
+ isSignal: true,
637
+ isRequired: false,
638
+ transformFunction: null
639
+ },
640
+ toolbar: {
641
+ classPropertyName: "toolbar",
642
+ publicName: "toolbar",
643
+ isSignal: true,
644
+ isRequired: false,
645
+ transformFunction: null
646
+ },
647
+ loading: {
648
+ classPropertyName: "loading",
649
+ publicName: "loading",
650
+ isSignal: true,
651
+ isRequired: false,
652
+ transformFunction: null
653
+ },
654
+ ariaLabel: {
655
+ classPropertyName: "ariaLabel",
656
+ publicName: "ariaLabel",
657
+ isSignal: true,
658
+ isRequired: false,
659
+ transformFunction: null
660
+ },
661
+ dt: {
662
+ classPropertyName: "dt",
663
+ publicName: "dt",
664
+ isSignal: true,
665
+ isRequired: false,
666
+ transformFunction: null
667
+ },
668
+ pt: {
669
+ classPropertyName: "pt",
670
+ publicName: "pt",
671
+ isSignal: true,
672
+ isRequired: false,
673
+ transformFunction: null
674
+ },
675
+ ptOptions: {
676
+ classPropertyName: "ptOptions",
677
+ publicName: "ptOptions",
678
+ isSignal: true,
679
+ isRequired: false,
680
+ transformFunction: null
681
+ },
682
+ unstyled: {
683
+ classPropertyName: "unstyled",
684
+ publicName: "unstyled",
685
+ isSignal: true,
686
+ isRequired: false,
687
+ transformFunction: null
688
+ }
689
+ },
690
+ outputs: {
691
+ segmentClick: "segmentClick",
692
+ segmentToggle: "segmentToggle"
693
+ },
694
+ host: {
695
+ properties: {
696
+ "class": "passThrough().root?.class",
697
+ "style": "hostStyle()",
698
+ "attr.data-styled": "!isUnstyled() || null",
699
+ "class.tx-pie-chart--donut": "inner() > 0",
700
+ "class.tx-pie-chart--entering": "entrance.active()",
701
+ "class.tx-pie-chart--morph": "morph()",
702
+ "class.tx-pie-chart--hovering": "hovered() !== null"
703
+ },
704
+ classAttribute: "tx-pie-chart"
705
+ },
706
+ queries: [
707
+ {
708
+ propertyName: "centerTemplate",
709
+ first: true,
710
+ predicate: TxPieCenter,
711
+ descendants: true,
712
+ isSignal: true
713
+ },
714
+ {
715
+ propertyName: "legendTemplate",
716
+ first: true,
717
+ predicate: TxChartLegendTemplate,
718
+ descendants: true,
719
+ isSignal: true
720
+ },
721
+ {
722
+ propertyName: "tooltipTemplate",
723
+ first: true,
724
+ predicate: TxChartTooltipTemplate,
725
+ descendants: true,
726
+ isSignal: true
727
+ }
728
+ ],
729
+ viewQueries: [{
730
+ propertyName: "frame",
731
+ first: true,
732
+ predicate: TxChartFrame,
733
+ descendants: true,
734
+ isSignal: true
735
+ }],
736
+ ngImport: i0,
737
+ template: "<tx-chart-frame\n height=\"auto\"\n [plotHeight]=\"plotHeight()\"\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-pie\"\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)=\"hovered.set(null)\"\n>\n <svg:g class=\"tx-pie-chart__segments\" [style.transform-origin]=\"geometry().fit.cx + 'px ' + geometry().fit.cy + 'px'\">\n @for (segment of segments(); track segment.key) {\n <svg:path\n class=\"tx-pie-chart__segment\"\n [class.tx-pie-chart__segment--hovered]=\"hovered() === segment.index\"\n [class]=\"passThrough().segment?.class\"\n [style]=\"passThrough().segment?.style\"\n [attr.data-index]=\"segment.index\"\n [attr.d]=\"segment.path\"\n [style.--tx-pie-chart-color]=\"segment.color\"\n [style.stroke-width]=\"segmentGap()\"\n [style.--tx-pie-chart-ux]=\"segment.ux\"\n [style.--tx-pie-chart-uy]=\"segment.uy\"\n />\n }\n </svg:g>\n @if (showDataLabels()) {\n <svg:g class=\"tx-pie-chart__labels\">\n @for (segment of segments(); track segment.key) {\n @if (segment.label) {\n <svg:text\n class=\"tx-pie-chart__label\"\n [class]=\"passThrough().dataLabel?.class\"\n [style]=\"passThrough().dataLabel?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [attr.x]=\"segment.labelX\"\n [attr.y]=\"segment.labelY\"\n >\n {{ segment.label }}\n </svg:text>\n }\n }\n </svg:g>\n }\n @if (inner() > 0) {\n @if (centerTemplate(); as custom) {\n <svg:foreignObject\n class=\"tx-pie-chart__center\"\n [class]=\"passThrough().center?.class\"\n [style]=\"passThrough().center?.style\"\n [attr.x]=\"centerBox().x\"\n [attr.y]=\"centerBox().y\"\n [attr.width]=\"centerBox().size\"\n [attr.height]=\"centerBox().size\"\n >\n <xhtml:div class=\"tx-pie-chart__center-content\">\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: center() ?? { label: '', value: '', raw: total(), total: total(), hovered: false, index: -1, color: null } }\" />\n </xhtml:div>\n </svg:foreignObject>\n } @else if (center(); as data) {\n <svg:g class=\"tx-pie-chart__center\" [class]=\"passThrough().center?.class\" [style]=\"passThrough().center?.style\">\n <svg:text\n class=\"tx-pie-chart__center-value\"\n text-anchor=\"middle\"\n [attr.x]=\"centerBox().cx\"\n [attr.y]=\"centerBox().cy + centerFont().value * 0.32 - centerFont().name * 0.55\"\n [style.font-size.px]=\"centerFont().value\"\n >\n {{ data.value }}\n </svg:text>\n <svg:text\n class=\"tx-pie-chart__center-name\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"centerBox().cx\"\n [attr.y]=\"centerBox().cy + centerFont().value * 0.32 - centerFont().name * 0.55 + 6\"\n [style.font-size.px]=\"centerFont().name\"\n >\n {{ data.label }}\n </svg:text>\n </svg:g>\n }\n }\n</tx-chart-frame>\n",
738
+ styles: [":host{display:block;max-width:100%;min-width:0}.tx-pie-chart__segments{transform-box:view-box}.tx-pie-chart__segment{fill:var(--tx-pie-chart-color)}.tx-pie-chart__label,.tx-pie-chart__center{pointer-events:none}.tx-pie-chart__center-content{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}:host([data-styled]) .tx-pie-chart__segment{stroke:var(--tx-chart-pie-segment-gap);stroke-linejoin:round;transition:fill var(--tx-chart-motion-hover-duration) ease,transform var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing)}:host([data-styled]) .tx-pie-chart__segment--hovered{transform:translate(calc(var(--tx-pie-chart-ux, 0) * var(--tx-chart-pie-hover-offset)),calc(var(--tx-pie-chart-uy, 0) * var(--tx-chart-pie-hover-offset)))}:host([data-styled]) .tx-pie-chart__label{fill:var(--tx-chart-pie-label-color);font-size:var(--tx-chart-pie-label-font-size);font-weight:var(--tx-chart-pie-label-font-weight);filter:var(--tx-chart-pie-label-shadow);transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-pie-chart__center-name{fill:var(--tx-chart-pie-name-color);font-weight:var(--tx-chart-pie-name-font-weight)}:host([data-styled]) .tx-pie-chart__center-name--total{fill:var(--tx-chart-pie-total-label-color)}:host([data-styled]) .tx-pie-chart__center-value{fill:var(--tx-chart-pie-value-color);font-weight:var(--tx-chart-pie-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-pie-chart__center-content{color:var(--tx-chart-pie-value-color)}:host([data-styled].tx-pie-chart--hovering) .tx-pie-chart__segment:not(.tx-pie-chart__segment--hovered){fill:color-mix(in oklab,var(--tx-pie-chart-color) var(--tx-chart-pie-dimmed-strength),var(--tx-chart-pie-dimmed-base))}:host([data-styled].tx-pie-chart--hovering) .tx-pie-chart__label{opacity:0}:host([data-styled].tx-pie-chart--morph) .tx-pie-chart__segment{transition:fill var(--tx-chart-motion-hover-duration) ease,transform var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__segments{animation:tx-pie-chart-enter var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__labels,:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__center{animation:tx-pie-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-pie-chart-enter{0%{opacity:0;transform:rotate(-90deg) scale(.6)}to{opacity:1;transform:none}}@keyframes tx-pie-chart-fade{0%,60%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-pie-chart__segment,:host([data-styled]) .tx-pie-chart__segments,:host([data-styled]) .tx-pie-chart__labels,:host([data-styled]) .tx-pie-chart__center{transition:none;animation:none}}\n"],
739
+ dependencies: [{
740
+ kind: "component",
741
+ type: TxChartFrame,
742
+ selector: "tx-chart-frame",
743
+ inputs: [
744
+ "height",
745
+ "size",
746
+ "legendItems",
747
+ "showLegend",
748
+ "legendPosition",
749
+ "legendAlign",
750
+ "legendVariant",
751
+ "legendToggle",
752
+ "legendTemplate",
753
+ "empty",
754
+ "loading",
755
+ "emptyIcon",
756
+ "summary",
757
+ "table",
758
+ "tooltip",
759
+ "tooltipTemplate",
760
+ "tooltipPlacement",
761
+ "panelStyle",
762
+ "parts",
763
+ "styled",
764
+ "interactive",
765
+ "actionKeys",
766
+ "zoomable",
767
+ "zoomedIn",
768
+ "plotHeight",
769
+ "toolbar",
770
+ "exportName"
771
+ ],
772
+ outputs: [
773
+ "sizeChange",
774
+ "pointer",
775
+ "navigate",
776
+ "legendToggled",
777
+ "legendHovered",
778
+ "tooltipClosed",
779
+ "zoomed",
780
+ "panned",
781
+ "zoomReset"
782
+ ]
783
+ }, {
784
+ kind: "directive",
785
+ type: NgTemplateOutlet,
786
+ selector: "[ngTemplateOutlet]",
787
+ inputs: [
788
+ "ngTemplateOutletContext",
789
+ "ngTemplateOutlet",
790
+ "ngTemplateOutletInjector"
791
+ ]
792
+ }],
793
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
794
+ });
795
+ };
796
+ i0.ɵɵngDeclareClassMetadata({
797
+ minVersion: "12.0.0",
798
+ version: "22.2.3",
799
+ ngImport: i0,
800
+ type: TxPieChart,
801
+ decorators: [{
802
+ type: Component,
803
+ args: [{
804
+ selector: "tx-pie-chart",
805
+ imports: [TxChartFrame, NgTemplateOutlet],
806
+ changeDetection: ChangeDetectionStrategy.OnPush,
807
+ host: {
808
+ class: "tx-pie-chart",
809
+ "[class]": "passThrough().root?.class",
810
+ "[style]": "hostStyle()",
811
+ "[attr.data-styled]": "!isUnstyled() || null",
812
+ "[class.tx-pie-chart--donut]": "inner() > 0",
813
+ "[class.tx-pie-chart--entering]": "entrance.active()",
814
+ "[class.tx-pie-chart--morph]": "morph()",
815
+ "[class.tx-pie-chart--hovering]": "hovered() !== null"
816
+ },
817
+ template: "<tx-chart-frame\n height=\"auto\"\n [plotHeight]=\"plotHeight()\"\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-pie\"\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)=\"hovered.set(null)\"\n>\n <svg:g class=\"tx-pie-chart__segments\" [style.transform-origin]=\"geometry().fit.cx + 'px ' + geometry().fit.cy + 'px'\">\n @for (segment of segments(); track segment.key) {\n <svg:path\n class=\"tx-pie-chart__segment\"\n [class.tx-pie-chart__segment--hovered]=\"hovered() === segment.index\"\n [class]=\"passThrough().segment?.class\"\n [style]=\"passThrough().segment?.style\"\n [attr.data-index]=\"segment.index\"\n [attr.d]=\"segment.path\"\n [style.--tx-pie-chart-color]=\"segment.color\"\n [style.stroke-width]=\"segmentGap()\"\n [style.--tx-pie-chart-ux]=\"segment.ux\"\n [style.--tx-pie-chart-uy]=\"segment.uy\"\n />\n }\n </svg:g>\n @if (showDataLabels()) {\n <svg:g class=\"tx-pie-chart__labels\">\n @for (segment of segments(); track segment.key) {\n @if (segment.label) {\n <svg:text\n class=\"tx-pie-chart__label\"\n [class]=\"passThrough().dataLabel?.class\"\n [style]=\"passThrough().dataLabel?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [attr.x]=\"segment.labelX\"\n [attr.y]=\"segment.labelY\"\n >\n {{ segment.label }}\n </svg:text>\n }\n }\n </svg:g>\n }\n @if (inner() > 0) {\n @if (centerTemplate(); as custom) {\n <svg:foreignObject\n class=\"tx-pie-chart__center\"\n [class]=\"passThrough().center?.class\"\n [style]=\"passThrough().center?.style\"\n [attr.x]=\"centerBox().x\"\n [attr.y]=\"centerBox().y\"\n [attr.width]=\"centerBox().size\"\n [attr.height]=\"centerBox().size\"\n >\n <xhtml:div class=\"tx-pie-chart__center-content\">\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"{ $implicit: center() ?? { label: '', value: '', raw: total(), total: total(), hovered: false, index: -1, color: null } }\" />\n </xhtml:div>\n </svg:foreignObject>\n } @else if (center(); as data) {\n <svg:g class=\"tx-pie-chart__center\" [class]=\"passThrough().center?.class\" [style]=\"passThrough().center?.style\">\n <svg:text\n class=\"tx-pie-chart__center-value\"\n text-anchor=\"middle\"\n [attr.x]=\"centerBox().cx\"\n [attr.y]=\"centerBox().cy + centerFont().value * 0.32 - centerFont().name * 0.55\"\n [style.font-size.px]=\"centerFont().value\"\n >\n {{ data.value }}\n </svg:text>\n <svg:text\n class=\"tx-pie-chart__center-name\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"centerBox().cx\"\n [attr.y]=\"centerBox().cy + centerFont().value * 0.32 - centerFont().name * 0.55 + 6\"\n [style.font-size.px]=\"centerFont().name\"\n >\n {{ data.label }}\n </svg:text>\n </svg:g>\n }\n }\n</tx-chart-frame>\n",
818
+ styles: [":host{display:block;max-width:100%;min-width:0}.tx-pie-chart__segments{transform-box:view-box}.tx-pie-chart__segment{fill:var(--tx-pie-chart-color)}.tx-pie-chart__label,.tx-pie-chart__center{pointer-events:none}.tx-pie-chart__center-content{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}:host([data-styled]) .tx-pie-chart__segment{stroke:var(--tx-chart-pie-segment-gap);stroke-linejoin:round;transition:fill var(--tx-chart-motion-hover-duration) ease,transform var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing)}:host([data-styled]) .tx-pie-chart__segment--hovered{transform:translate(calc(var(--tx-pie-chart-ux, 0) * var(--tx-chart-pie-hover-offset)),calc(var(--tx-pie-chart-uy, 0) * var(--tx-chart-pie-hover-offset)))}:host([data-styled]) .tx-pie-chart__label{fill:var(--tx-chart-pie-label-color);font-size:var(--tx-chart-pie-label-font-size);font-weight:var(--tx-chart-pie-label-font-weight);filter:var(--tx-chart-pie-label-shadow);transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-pie-chart__center-name{fill:var(--tx-chart-pie-name-color);font-weight:var(--tx-chart-pie-name-font-weight)}:host([data-styled]) .tx-pie-chart__center-name--total{fill:var(--tx-chart-pie-total-label-color)}:host([data-styled]) .tx-pie-chart__center-value{fill:var(--tx-chart-pie-value-color);font-weight:var(--tx-chart-pie-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-pie-chart__center-content{color:var(--tx-chart-pie-value-color)}:host([data-styled].tx-pie-chart--hovering) .tx-pie-chart__segment:not(.tx-pie-chart__segment--hovered){fill:color-mix(in oklab,var(--tx-pie-chart-color) var(--tx-chart-pie-dimmed-strength),var(--tx-chart-pie-dimmed-base))}:host([data-styled].tx-pie-chart--hovering) .tx-pie-chart__label{opacity:0}:host([data-styled].tx-pie-chart--morph) .tx-pie-chart__segment{transition:fill var(--tx-chart-motion-hover-duration) ease,transform var(--tx-chart-motion-hover-duration) var(--tx-chart-motion-easing),d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__segments{animation:tx-pie-chart-enter var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__labels,:host([data-styled].tx-pie-chart--entering) .tx-pie-chart__center{animation:tx-pie-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-pie-chart-enter{0%{opacity:0;transform:rotate(-90deg) scale(.6)}to{opacity:1;transform:none}}@keyframes tx-pie-chart-fade{0%,60%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-pie-chart__segment,:host([data-styled]) .tx-pie-chart__segments,:host([data-styled]) .tx-pie-chart__labels,:host([data-styled]) .tx-pie-chart__center{transition:none;animation:none}}\n"]
819
+ }]
820
+ }],
821
+ ctorParameters: () => [],
822
+ propDecorators: {
823
+ pieData: [{
824
+ type: i0.Input,
825
+ args: [{
826
+ isSignal: true,
827
+ alias: "pieData",
828
+ required: true
829
+ }]
830
+ }],
831
+ chartWidth: [{
832
+ type: i0.Input,
833
+ args: [{
834
+ isSignal: true,
835
+ alias: "chartWidth",
836
+ required: false
837
+ }]
838
+ }],
839
+ chartHeight: [{
840
+ type: i0.Input,
841
+ args: [{
842
+ isSignal: true,
843
+ alias: "chartHeight",
844
+ required: false
845
+ }]
846
+ }],
847
+ showLegend: [{
848
+ type: i0.Input,
849
+ args: [{
850
+ isSignal: true,
851
+ alias: "showLegend",
852
+ required: false
853
+ }]
854
+ }],
855
+ legendPosition: [{
856
+ type: i0.Input,
857
+ args: [{
858
+ isSignal: true,
859
+ alias: "legendPosition",
860
+ required: false
861
+ }]
862
+ }],
863
+ legendAlign: [{
864
+ type: i0.Input,
865
+ args: [{
866
+ isSignal: true,
867
+ alias: "legendAlign",
868
+ required: false
869
+ }]
870
+ }],
871
+ legendValues: [{
872
+ type: i0.Input,
873
+ args: [{
874
+ isSignal: true,
875
+ alias: "legendValues",
876
+ required: false
877
+ }]
878
+ }],
879
+ legendVariant: [{
880
+ type: i0.Input,
881
+ args: [{
882
+ isSignal: true,
883
+ alias: "legendVariant",
884
+ required: false
885
+ }]
886
+ }],
887
+ showDataLabels: [{
888
+ type: i0.Input,
889
+ args: [{
890
+ isSignal: true,
891
+ alias: "showDataLabels",
892
+ required: false
893
+ }]
894
+ }],
895
+ totalLabel: [{
896
+ type: i0.Input,
897
+ args: [{
898
+ isSignal: true,
899
+ alias: "totalLabel",
900
+ required: false
901
+ }]
902
+ }],
903
+ totalFormatter: [{
904
+ type: i0.Input,
905
+ args: [{
906
+ isSignal: true,
907
+ alias: "totalFormatter",
908
+ required: false
909
+ }]
910
+ }],
911
+ tooltipFormatter: [{
912
+ type: i0.Input,
913
+ args: [{
914
+ isSignal: true,
915
+ alias: "tooltipFormatter",
916
+ required: false
917
+ }]
918
+ }],
919
+ showTooltip: [{
920
+ type: i0.Input,
921
+ args: [{
922
+ isSignal: true,
923
+ alias: "showTooltip",
924
+ required: false
925
+ }]
926
+ }],
927
+ valueFormat: [{
928
+ type: i0.Input,
929
+ args: [{
930
+ isSignal: true,
931
+ alias: "valueFormat",
932
+ required: false
933
+ }]
934
+ }],
935
+ donutSize: [{
936
+ type: i0.Input,
937
+ args: [{
938
+ isSignal: true,
939
+ alias: "donutSize",
940
+ required: false
941
+ }]
942
+ }],
943
+ segmentGap: [{
944
+ type: i0.Input,
945
+ args: [{
946
+ isSignal: true,
947
+ alias: "segmentGap",
948
+ required: false
949
+ }]
950
+ }],
951
+ segmentRadius: [{
952
+ type: i0.Input,
953
+ args: [{
954
+ isSignal: true,
955
+ alias: "segmentRadius",
956
+ required: false
957
+ }]
958
+ }],
959
+ startAngle: [{
960
+ type: i0.Input,
961
+ args: [{
962
+ isSignal: true,
963
+ alias: "startAngle",
964
+ required: false
965
+ }]
966
+ }],
967
+ endAngle: [{
968
+ type: i0.Input,
969
+ args: [{
970
+ isSignal: true,
971
+ alias: "endAngle",
972
+ required: false
973
+ }]
974
+ }],
975
+ toolbar: [{
976
+ type: i0.Input,
977
+ args: [{
978
+ isSignal: true,
979
+ alias: "toolbar",
980
+ required: false
981
+ }]
982
+ }],
983
+ loading: [{
984
+ type: i0.Input,
985
+ args: [{
986
+ isSignal: true,
987
+ alias: "loading",
988
+ required: false
989
+ }]
990
+ }],
991
+ ariaLabel: [{
992
+ type: i0.Input,
993
+ args: [{
994
+ isSignal: true,
995
+ alias: "ariaLabel",
996
+ required: false
997
+ }]
998
+ }],
999
+ dt: [{
1000
+ type: i0.Input,
1001
+ args: [{
1002
+ isSignal: true,
1003
+ alias: "dt",
1004
+ required: false
1005
+ }]
1006
+ }],
1007
+ pt: [{
1008
+ type: i0.Input,
1009
+ args: [{
1010
+ isSignal: true,
1011
+ alias: "pt",
1012
+ required: false
1013
+ }]
1014
+ }],
1015
+ ptOptions: [{
1016
+ type: i0.Input,
1017
+ args: [{
1018
+ isSignal: true,
1019
+ alias: "ptOptions",
1020
+ required: false
1021
+ }]
1022
+ }],
1023
+ unstyled: [{
1024
+ type: i0.Input,
1025
+ args: [{
1026
+ isSignal: true,
1027
+ alias: "unstyled",
1028
+ required: false
1029
+ }]
1030
+ }],
1031
+ segmentClick: [{
1032
+ type: i0.Output,
1033
+ args: ["segmentClick"]
1034
+ }],
1035
+ segmentToggle: [{
1036
+ type: i0.Output,
1037
+ args: ["segmentToggle"]
1038
+ }],
1039
+ centerTemplate: [{
1040
+ type: i0.ContentChild,
1041
+ args: [i0.forwardRef(() => TxPieCenter), { isSignal: true }]
1042
+ }],
1043
+ legendTemplate: [{
1044
+ type: i0.ContentChild,
1045
+ args: [i0.forwardRef(() => TxChartLegendTemplate), { isSignal: true }]
1046
+ }],
1047
+ tooltipTemplate: [{
1048
+ type: i0.ContentChild,
1049
+ args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
1050
+ }],
1051
+ frame: [{
1052
+ type: i0.ViewChild,
1053
+ args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
1054
+ }]
1055
+ }
1056
+ });
1057
+ export { TxPieCenter, TxPieChart, TxPieLegendPipe, arcAt, arcBounds, arcPath, fitPie, maxCornerRadius, pieAngles, pieArcs, pieLegend, polar, toRadians };
1058
+
1059
+ //# sourceMappingURL=tectra-ng-charts-pie.mjs.map