@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.
- package/README.md +21 -1
- package/bar-list/README.md +30 -0
- package/boxplot/README.md +62 -0
- package/bullet/README.md +53 -0
- package/candlestick/README.md +57 -0
- package/column/README.md +4 -2
- package/combo/README.md +83 -0
- package/core/README.md +3 -1
- package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
- package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
- package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
- package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
- package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-column.mjs +149 -66
- package/fesm2022/tectra-ng-charts-column.mjs.map +1 -1
- package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
- package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-core.mjs +1334 -49
- package/fesm2022/tectra-ng-charts-core.mjs.map +1 -1
- package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
- package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
- package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
- package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
- package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-line.mjs +527 -67
- package/fesm2022/tectra-ng-charts-line.mjs.map +1 -1
- package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
- package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-pie.mjs +47 -86
- package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -1
- package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
- package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
- package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
- package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
- package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
- package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
- package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
- package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
- package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
- package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
- package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
- package/funnel/README.md +53 -0
- package/gantt/README.md +53 -0
- package/gauge/README.md +41 -0
- package/heatmap/README.md +47 -0
- package/line/README.md +13 -2
- package/org-chart/README.md +57 -0
- package/package.json +114 -6
- package/pie/README.md +1 -0
- package/radar/README.md +64 -0
- package/radial-bar/README.md +62 -0
- package/range-area/README.md +66 -0
- package/rank-line/README.md +51 -0
- package/sankey/README.md +52 -0
- package/scatter/README.md +71 -0
- package/segmented-bar/README.md +35 -0
- package/sunburst/README.md +55 -0
- package/treemap/README.md +47 -0
- package/types/tectra-ng-charts-bar-list.d.ts +724 -0
- package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
- package/types/tectra-ng-charts-boxplot.d.ts +882 -0
- package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
- package/types/tectra-ng-charts-bullet.d.ts +833 -0
- package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
- package/types/tectra-ng-charts-candlestick.d.ts +854 -0
- package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
- package/types/tectra-ng-charts-column.d.ts +486 -3
- package/types/tectra-ng-charts-column.d.ts.map +1 -1
- package/types/tectra-ng-charts-combo.d.ts +987 -0
- package/types/tectra-ng-charts-combo.d.ts.map +1 -0
- package/types/tectra-ng-charts-core.d.ts +266 -5
- package/types/tectra-ng-charts-core.d.ts.map +1 -1
- package/types/tectra-ng-charts-funnel.d.ts +857 -0
- package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
- package/types/tectra-ng-charts-gantt.d.ts +884 -0
- package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
- package/types/tectra-ng-charts-gauge.d.ts +859 -0
- package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
- package/types/tectra-ng-charts-heatmap.d.ts +914 -0
- package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
- package/types/tectra-ng-charts-line.d.ts +556 -2
- package/types/tectra-ng-charts-line.d.ts.map +1 -1
- package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
- package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
- package/types/tectra-ng-charts-pie.d.ts +477 -14
- package/types/tectra-ng-charts-pie.d.ts.map +1 -1
- package/types/tectra-ng-charts-radar.d.ts +903 -0
- package/types/tectra-ng-charts-radar.d.ts.map +1 -0
- package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
- package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
- package/types/tectra-ng-charts-range-area.d.ts +897 -0
- package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
- package/types/tectra-ng-charts-rank-line.d.ts +839 -0
- package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
- package/types/tectra-ng-charts-sankey.d.ts +866 -0
- package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
- package/types/tectra-ng-charts-scatter.d.ts +987 -0
- package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
- package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
- package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
- package/types/tectra-ng-charts-sunburst.d.ts +864 -0
- package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
- package/types/tectra-ng-charts-treemap.d.ts +847 -0
- package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
- package/types/tectra-ng-charts-waterfall.d.ts +869 -0
- package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
- package/waterfall/README.md +60 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, linkedSignal, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { TxChartFrame, TxChartLegendTemplate, TxChartTooltipTemplate, angleFrom, arcSpan, chartNumberFormatter, chartSummary, fitArc, initialChartSize, injectChartEntrance, parseRatio, polar, readTokenNumber, seriesColor, strokeArc, toggleKey } from "@tectra-ng/charts/core";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
7
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
8
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
9
|
+
function radialRings(count, outer, inner, thickness) {
|
|
10
|
+
if (!count) return [];
|
|
11
|
+
const slot = Math.max(1, (outer - inner) / count);
|
|
12
|
+
const width = Math.max(1, slot * Math.min(1, Math.max(.05, thickness)));
|
|
13
|
+
return Array.from({ length: count }, (_, index) => ({
|
|
14
|
+
radius: round(outer - slot * index - width / 2),
|
|
15
|
+
width: round(width)
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function radialShare(value, max) {
|
|
19
|
+
if (value === null || !Number.isFinite(value) || !(max > 0)) return 0;
|
|
20
|
+
return Math.max(0, Math.min(1, value / max));
|
|
21
|
+
}
|
|
22
|
+
const DEFAULT_THICKNESS = .62;
|
|
23
|
+
const PADDING = 6;
|
|
24
|
+
const HIT_SLACK = 3;
|
|
25
|
+
var TxRadialBar = class TxRadialBar {
|
|
26
|
+
locale = inject(TxLocaleService);
|
|
27
|
+
host = inject(ElementRef);
|
|
28
|
+
translations = injectTranslations();
|
|
29
|
+
items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
30
|
+
max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
|
|
31
|
+
height = input(300, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
32
|
+
startAngle = input(0, ...ngDevMode ? [{ debugName: "startAngle" }] : /* istanbul ignore next */ []);
|
|
33
|
+
endAngle = input(360, ...ngDevMode ? [{ debugName: "endAngle" }] : /* istanbul ignore next */ []);
|
|
34
|
+
hole = input("35%", ...ngDevMode ? [{ debugName: "hole" }] : /* istanbul ignore next */ []);
|
|
35
|
+
track = input(true, {
|
|
36
|
+
...ngDevMode ? { debugName: "track" } : /* istanbul ignore next */ {},
|
|
37
|
+
transform: booleanAttribute
|
|
38
|
+
});
|
|
39
|
+
centerValue = input("percent", ...ngDevMode ? [{ debugName: "centerValue" }] : /* istanbul ignore next */ []);
|
|
40
|
+
totalLabel = input("", ...ngDevMode ? [{ debugName: "totalLabel" }] : /* istanbul ignore next */ []);
|
|
41
|
+
showLegend = input(true, {
|
|
42
|
+
...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
|
|
43
|
+
transform: booleanAttribute
|
|
44
|
+
});
|
|
45
|
+
legendPosition = input("bottom", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
|
|
46
|
+
legendAlign = input("center", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
|
|
47
|
+
legendVariant = input("dot", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
|
|
48
|
+
legendValues = input(false, {
|
|
49
|
+
...ngDevMode ? { debugName: "legendValues" } : /* istanbul ignore next */ {},
|
|
50
|
+
transform: booleanAttribute
|
|
51
|
+
});
|
|
52
|
+
showTooltip = input(true, {
|
|
53
|
+
...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
|
|
54
|
+
transform: booleanAttribute
|
|
55
|
+
});
|
|
56
|
+
valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
57
|
+
toolbar = input(false, {
|
|
58
|
+
...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
|
|
59
|
+
transform: booleanAttribute
|
|
60
|
+
});
|
|
61
|
+
loading = input(false, {
|
|
62
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
63
|
+
transform: booleanAttribute
|
|
64
|
+
});
|
|
65
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
66
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
67
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
68
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
69
|
+
unstyled = input(void 0, {
|
|
70
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
71
|
+
transform: optionalBoolean
|
|
72
|
+
});
|
|
73
|
+
barClick = output();
|
|
74
|
+
barToggle = output();
|
|
75
|
+
legendTemplate = contentChild(TxChartLegendTemplate, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
|
|
76
|
+
tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
|
|
77
|
+
frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
|
|
78
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
79
|
+
passThrough = injectPassThrough("radialBar", this, this.pt, this.ptOptions);
|
|
80
|
+
tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
|
|
81
|
+
hostStyle = computed(() => ({
|
|
82
|
+
...this.tokenStyle(),
|
|
83
|
+
...this.passThrough().root?.style
|
|
84
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
85
|
+
entrance = injectChartEntrance();
|
|
86
|
+
morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
|
|
87
|
+
hidden = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
|
|
88
|
+
hovered = signal(null, ...ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []);
|
|
89
|
+
fromLegend = signal(false, ...ngDevMode ? [{ debugName: "fromLegend" }] : /* istanbul ignore next */ []);
|
|
90
|
+
thickness = signal(DEFAULT_THICKNESS, ...ngDevMode ? [{ debugName: "thickness" }] : /* istanbul ignore next */ []);
|
|
91
|
+
intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
|
|
92
|
+
list = computed(() => this.items() ?? [], ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
|
|
93
|
+
keys = computed(() => this.list().map((item, index) => `${index}:${item.label}`), ...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
|
|
94
|
+
visibleIndexes = computed(() => this.keys().flatMap((key, index) => this.hidden().has(key) ? [] : [index]), ...ngDevMode ? [{ debugName: "visibleIndexes" }] : /* istanbul ignore next */ []);
|
|
95
|
+
isEmpty = computed(() => !this.list().some((item) => item.value !== null && Number.isFinite(item.value)), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
96
|
+
legendShown = computed(() => this.showLegend() && this.list().length > 1, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
|
|
97
|
+
size = linkedSignal(() => initialChartSize(this.height(), this.legendShown() ? this.legendPosition() : null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
98
|
+
span = computed(() => arcSpan(this.startAngle(), this.endAngle()), ...ngDevMode ? [{ debugName: "span" }] : /* istanbul ignore next */ []);
|
|
99
|
+
fit = computed(() => fitArc(this.size().width, this.size().height, this.startAngle(), this.endAngle(), PADDING), ...ngDevMode ? [{ debugName: "fit" }] : /* istanbul ignore next */ []);
|
|
100
|
+
inner = computed(() => this.fit().radius * Math.min(.9, Math.max(0, parseRatio(this.hole(), .35))), ...ngDevMode ? [{ debugName: "inner" }] : /* istanbul ignore next */ []);
|
|
101
|
+
valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
|
|
102
|
+
percentFormatter = computed(() => chartNumberFormatter(this.intl(), "percent"), ...ngDevMode ? [{ debugName: "percentFormatter" }] : /* istanbul ignore next */ []);
|
|
103
|
+
rings = computed(() => {
|
|
104
|
+
const fit = this.fit();
|
|
105
|
+
const [start, end] = this.span();
|
|
106
|
+
const visible = this.visibleIndexes();
|
|
107
|
+
const slots = radialRings(visible.length, fit.radius, this.inner(), this.thickness());
|
|
108
|
+
return visible.map((index, slot) => {
|
|
109
|
+
const item = this.list()[index];
|
|
110
|
+
const max = item.max ?? this.max();
|
|
111
|
+
const share = radialShare(item.value, max);
|
|
112
|
+
const { radius, width } = slots[slot];
|
|
113
|
+
const barEnd = start + (end - start) * share;
|
|
114
|
+
return {
|
|
115
|
+
index,
|
|
116
|
+
key: this.keys()[index],
|
|
117
|
+
label: item.label,
|
|
118
|
+
value: item.value ?? 0,
|
|
119
|
+
max,
|
|
120
|
+
share,
|
|
121
|
+
color: seriesColor(item.color, index),
|
|
122
|
+
radius,
|
|
123
|
+
width,
|
|
124
|
+
track: strokeArc(fit.cx, fit.cy, radius, start, end),
|
|
125
|
+
bar: share > 0 ? strokeArc(fit.cx, fit.cy, radius, start, Math.max(start + .001, barEnd)) : "",
|
|
126
|
+
start,
|
|
127
|
+
end: barEnd
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}, ...ngDevMode ? [{ debugName: "rings" }] : /* istanbul ignore next */ []);
|
|
131
|
+
center = computed(() => {
|
|
132
|
+
const index = this.hovered();
|
|
133
|
+
const rings = this.rings();
|
|
134
|
+
const ring = rings.find((item) => item.index === index) ?? (rings.length === 1 ? rings[0] : null);
|
|
135
|
+
if (ring) return {
|
|
136
|
+
label: ring.label,
|
|
137
|
+
value: this.centerText(ring),
|
|
138
|
+
index: ring.index,
|
|
139
|
+
color: ring.color
|
|
140
|
+
};
|
|
141
|
+
if (!this.totalLabel() || !rings.length) return null;
|
|
142
|
+
const average = rings.reduce((sum, item) => sum + item.share, 0) / rings.length;
|
|
143
|
+
return {
|
|
144
|
+
label: this.totalLabel(),
|
|
145
|
+
value: this.percentFormatter()(Number((average * 100).toFixed(1))),
|
|
146
|
+
index: -1,
|
|
147
|
+
color: null
|
|
148
|
+
};
|
|
149
|
+
}, ...ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []);
|
|
150
|
+
centerFont = computed(() => {
|
|
151
|
+
const inner = Math.max(this.inner(), this.fit().radius * .25);
|
|
152
|
+
return {
|
|
153
|
+
value: Math.max(13, Math.min(28, inner * .42)),
|
|
154
|
+
label: Math.max(10, Math.min(13, inner * .2))
|
|
155
|
+
};
|
|
156
|
+
}, ...ngDevMode ? [{ debugName: "centerFont" }] : /* istanbul ignore next */ []);
|
|
157
|
+
legendItems = computed(() => this.list().map((item, index) => {
|
|
158
|
+
const share = radialShare(item.value, item.max ?? this.max());
|
|
159
|
+
const value = item.value === null ? "—" : this.valueFormatter()(item.value);
|
|
160
|
+
const percent = this.percentFormatter()(Number((share * 100).toFixed(1)));
|
|
161
|
+
return {
|
|
162
|
+
key: this.keys()[index],
|
|
163
|
+
label: item.label,
|
|
164
|
+
color: seriesColor(item.color, index),
|
|
165
|
+
hidden: this.hidden().has(this.keys()[index]),
|
|
166
|
+
...this.legendVariant() === "stat" ? {
|
|
167
|
+
value,
|
|
168
|
+
caption: percent
|
|
169
|
+
} : this.legendValues() ? {
|
|
170
|
+
value,
|
|
171
|
+
percent
|
|
172
|
+
} : {}
|
|
173
|
+
};
|
|
174
|
+
}), ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
|
|
175
|
+
tooltip = computed(() => {
|
|
176
|
+
const index = this.hovered();
|
|
177
|
+
if (index === null || !this.showTooltip() || this.fromLegend() || this.legendVariant() === "stat") return null;
|
|
178
|
+
const ring = this.rings().find((item) => item.index === index);
|
|
179
|
+
if (!ring) return null;
|
|
180
|
+
const fit = this.fit();
|
|
181
|
+
const at = polar(fit.cx, fit.cy, ring.radius + ring.width / 2 + 2, ring.end);
|
|
182
|
+
const sin = Math.sin(ring.end);
|
|
183
|
+
const cos = Math.cos(ring.end);
|
|
184
|
+
const placement = Math.abs(sin) >= Math.SQRT1_2 ? sin > 0 ? "right" : "left" : cos > 0 ? "top" : "bottom";
|
|
185
|
+
const item = this.list()[index];
|
|
186
|
+
return {
|
|
187
|
+
title: "",
|
|
188
|
+
rows: [{
|
|
189
|
+
label: ring.label,
|
|
190
|
+
value: item.value === null ? "—" : this.valueFormatter()(item.value),
|
|
191
|
+
share: this.percentFormatter()(Number((ring.share * 100).toFixed(1))),
|
|
192
|
+
color: ring.color,
|
|
193
|
+
raw: item.value,
|
|
194
|
+
seriesIndex: index,
|
|
195
|
+
active: true
|
|
196
|
+
}],
|
|
197
|
+
index,
|
|
198
|
+
x: at.x,
|
|
199
|
+
y: at.y,
|
|
200
|
+
placement
|
|
201
|
+
};
|
|
202
|
+
}, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
203
|
+
summary = computed(() => {
|
|
204
|
+
const t = this.translations();
|
|
205
|
+
const parts = this.list().map((item) => `${item.label} ${this.percentFormatter()(Number((radialShare(item.value, item.max ?? this.max()) * 100).toFixed(1)))}`);
|
|
206
|
+
const text = `${chartSummary(t, this.intl(), t.chartRadialBar, 1, this.list().length, null)}: ${parts.join(", ")}`;
|
|
207
|
+
return this.ariaLabel() ? `${this.ariaLabel()}. ${text}` : text;
|
|
208
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
209
|
+
dataTable = computed(() => {
|
|
210
|
+
const t = this.translations();
|
|
211
|
+
return {
|
|
212
|
+
columns: [{
|
|
213
|
+
key: "value",
|
|
214
|
+
label: t.chartValue
|
|
215
|
+
}, {
|
|
216
|
+
key: "share",
|
|
217
|
+
label: t.chartShare
|
|
218
|
+
}],
|
|
219
|
+
rows: this.list().map((item) => ({
|
|
220
|
+
label: item.label,
|
|
221
|
+
cells: [item.value === null ? "—" : this.valueFormatter()(item.value), this.percentFormatter()(Number((radialShare(item.value, item.max ?? this.max()) * 100).toFixed(1)))]
|
|
222
|
+
}))
|
|
223
|
+
};
|
|
224
|
+
}, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
|
|
225
|
+
constructor() {
|
|
226
|
+
afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
|
|
227
|
+
afterRenderEffect(() => {
|
|
228
|
+
this.dt();
|
|
229
|
+
const next = readTokenNumber(this.host.nativeElement, "--tx-chart-radial-bar-thickness", DEFAULT_THICKNESS);
|
|
230
|
+
if (next !== this.thickness()) this.thickness.set(next);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
onPointer(event) {
|
|
234
|
+
if (event.type === "leave") {
|
|
235
|
+
this.hovered.set(null);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const index = this.ringAt(event.x, event.y);
|
|
239
|
+
this.fromLegend.set(false);
|
|
240
|
+
this.hovered.set(index);
|
|
241
|
+
if (event.type === "click" && index !== null) this.barClick.emit(this.event(index));
|
|
242
|
+
}
|
|
243
|
+
onNavigate(event) {
|
|
244
|
+
if (event.key === "Escape") {
|
|
245
|
+
this.hovered.set(null);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const visible = this.visibleIndexes();
|
|
249
|
+
if (!visible.length) return;
|
|
250
|
+
const current = this.hovered();
|
|
251
|
+
const at = current === null ? -1 : visible.indexOf(current);
|
|
252
|
+
const forward = event.key === "ArrowRight" || event.key === "ArrowDown";
|
|
253
|
+
if (![
|
|
254
|
+
"ArrowRight",
|
|
255
|
+
"ArrowDown",
|
|
256
|
+
"ArrowLeft",
|
|
257
|
+
"ArrowUp",
|
|
258
|
+
"Home",
|
|
259
|
+
"End"
|
|
260
|
+
].includes(event.key)) return;
|
|
261
|
+
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];
|
|
262
|
+
this.fromLegend.set(false);
|
|
263
|
+
this.hovered.set(index);
|
|
264
|
+
const item = this.list()[index];
|
|
265
|
+
const share = radialShare(item.value, item.max ?? this.max());
|
|
266
|
+
this.frame()?.announce(`${item.label}: ${item.value === null ? "—" : this.valueFormatter()(item.value)}, ${this.percentFormatter()(Number((share * 100).toFixed(1)))}`);
|
|
267
|
+
}
|
|
268
|
+
onLegendToggle(key) {
|
|
269
|
+
const index = this.keys().indexOf(key);
|
|
270
|
+
this.hidden.update((keys) => toggleKey(keys, key));
|
|
271
|
+
this.hovered.set(null);
|
|
272
|
+
this.barToggle.emit({
|
|
273
|
+
index,
|
|
274
|
+
label: this.list()[index]?.label ?? "",
|
|
275
|
+
hidden: this.hidden().has(key)
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
onLegendHover(key) {
|
|
279
|
+
const index = key === null ? -1 : this.keys().indexOf(key);
|
|
280
|
+
this.fromLegend.set(index >= 0);
|
|
281
|
+
this.hovered.set(index >= 0 && !this.hidden().has(key ?? "") ? index : null);
|
|
282
|
+
}
|
|
283
|
+
centerText(ring) {
|
|
284
|
+
return this.centerValue() === "value" ? this.valueFormatter()(ring.value) : this.percentFormatter()(Number((ring.share * 100).toFixed(1)));
|
|
285
|
+
}
|
|
286
|
+
event(index) {
|
|
287
|
+
const item = this.list()[index];
|
|
288
|
+
return {
|
|
289
|
+
index,
|
|
290
|
+
label: item.label,
|
|
291
|
+
value: item.value,
|
|
292
|
+
share: radialShare(item.value, item.max ?? this.max())
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
ringAt(x, y) {
|
|
296
|
+
const fit = this.fit();
|
|
297
|
+
const [start, end] = this.span();
|
|
298
|
+
const distance = Math.hypot(x - fit.cx, y - fit.cy);
|
|
299
|
+
if (end - start < Math.PI * 2 - 1e-6 && angleFrom(x, y, fit.cx, fit.cy, start) > end + .05) return null;
|
|
300
|
+
const ring = this.rings().find((item) => Math.abs(distance - item.radius) <= item.width / 2 + HIT_SLACK);
|
|
301
|
+
return ring ? ring.index : null;
|
|
302
|
+
}
|
|
303
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
304
|
+
minVersion: "12.0.0",
|
|
305
|
+
version: "22.2.3",
|
|
306
|
+
ngImport: i0,
|
|
307
|
+
type: TxRadialBar,
|
|
308
|
+
deps: [],
|
|
309
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
310
|
+
});
|
|
311
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
312
|
+
minVersion: "17.0.0",
|
|
313
|
+
version: "22.2.3",
|
|
314
|
+
type: TxRadialBar,
|
|
315
|
+
isStandalone: true,
|
|
316
|
+
selector: "tx-radial-bar",
|
|
317
|
+
inputs: {
|
|
318
|
+
items: {
|
|
319
|
+
classPropertyName: "items",
|
|
320
|
+
publicName: "items",
|
|
321
|
+
isSignal: true,
|
|
322
|
+
isRequired: false,
|
|
323
|
+
transformFunction: null
|
|
324
|
+
},
|
|
325
|
+
max: {
|
|
326
|
+
classPropertyName: "max",
|
|
327
|
+
publicName: "max",
|
|
328
|
+
isSignal: true,
|
|
329
|
+
isRequired: false,
|
|
330
|
+
transformFunction: null
|
|
331
|
+
},
|
|
332
|
+
height: {
|
|
333
|
+
classPropertyName: "height",
|
|
334
|
+
publicName: "height",
|
|
335
|
+
isSignal: true,
|
|
336
|
+
isRequired: false,
|
|
337
|
+
transformFunction: null
|
|
338
|
+
},
|
|
339
|
+
startAngle: {
|
|
340
|
+
classPropertyName: "startAngle",
|
|
341
|
+
publicName: "startAngle",
|
|
342
|
+
isSignal: true,
|
|
343
|
+
isRequired: false,
|
|
344
|
+
transformFunction: null
|
|
345
|
+
},
|
|
346
|
+
endAngle: {
|
|
347
|
+
classPropertyName: "endAngle",
|
|
348
|
+
publicName: "endAngle",
|
|
349
|
+
isSignal: true,
|
|
350
|
+
isRequired: false,
|
|
351
|
+
transformFunction: null
|
|
352
|
+
},
|
|
353
|
+
hole: {
|
|
354
|
+
classPropertyName: "hole",
|
|
355
|
+
publicName: "hole",
|
|
356
|
+
isSignal: true,
|
|
357
|
+
isRequired: false,
|
|
358
|
+
transformFunction: null
|
|
359
|
+
},
|
|
360
|
+
track: {
|
|
361
|
+
classPropertyName: "track",
|
|
362
|
+
publicName: "track",
|
|
363
|
+
isSignal: true,
|
|
364
|
+
isRequired: false,
|
|
365
|
+
transformFunction: null
|
|
366
|
+
},
|
|
367
|
+
centerValue: {
|
|
368
|
+
classPropertyName: "centerValue",
|
|
369
|
+
publicName: "centerValue",
|
|
370
|
+
isSignal: true,
|
|
371
|
+
isRequired: false,
|
|
372
|
+
transformFunction: null
|
|
373
|
+
},
|
|
374
|
+
totalLabel: {
|
|
375
|
+
classPropertyName: "totalLabel",
|
|
376
|
+
publicName: "totalLabel",
|
|
377
|
+
isSignal: true,
|
|
378
|
+
isRequired: false,
|
|
379
|
+
transformFunction: null
|
|
380
|
+
},
|
|
381
|
+
showLegend: {
|
|
382
|
+
classPropertyName: "showLegend",
|
|
383
|
+
publicName: "showLegend",
|
|
384
|
+
isSignal: true,
|
|
385
|
+
isRequired: false,
|
|
386
|
+
transformFunction: null
|
|
387
|
+
},
|
|
388
|
+
legendPosition: {
|
|
389
|
+
classPropertyName: "legendPosition",
|
|
390
|
+
publicName: "legendPosition",
|
|
391
|
+
isSignal: true,
|
|
392
|
+
isRequired: false,
|
|
393
|
+
transformFunction: null
|
|
394
|
+
},
|
|
395
|
+
legendAlign: {
|
|
396
|
+
classPropertyName: "legendAlign",
|
|
397
|
+
publicName: "legendAlign",
|
|
398
|
+
isSignal: true,
|
|
399
|
+
isRequired: false,
|
|
400
|
+
transformFunction: null
|
|
401
|
+
},
|
|
402
|
+
legendVariant: {
|
|
403
|
+
classPropertyName: "legendVariant",
|
|
404
|
+
publicName: "legendVariant",
|
|
405
|
+
isSignal: true,
|
|
406
|
+
isRequired: false,
|
|
407
|
+
transformFunction: null
|
|
408
|
+
},
|
|
409
|
+
legendValues: {
|
|
410
|
+
classPropertyName: "legendValues",
|
|
411
|
+
publicName: "legendValues",
|
|
412
|
+
isSignal: true,
|
|
413
|
+
isRequired: false,
|
|
414
|
+
transformFunction: null
|
|
415
|
+
},
|
|
416
|
+
showTooltip: {
|
|
417
|
+
classPropertyName: "showTooltip",
|
|
418
|
+
publicName: "showTooltip",
|
|
419
|
+
isSignal: true,
|
|
420
|
+
isRequired: false,
|
|
421
|
+
transformFunction: null
|
|
422
|
+
},
|
|
423
|
+
valueFormat: {
|
|
424
|
+
classPropertyName: "valueFormat",
|
|
425
|
+
publicName: "valueFormat",
|
|
426
|
+
isSignal: true,
|
|
427
|
+
isRequired: false,
|
|
428
|
+
transformFunction: null
|
|
429
|
+
},
|
|
430
|
+
toolbar: {
|
|
431
|
+
classPropertyName: "toolbar",
|
|
432
|
+
publicName: "toolbar",
|
|
433
|
+
isSignal: true,
|
|
434
|
+
isRequired: false,
|
|
435
|
+
transformFunction: null
|
|
436
|
+
},
|
|
437
|
+
loading: {
|
|
438
|
+
classPropertyName: "loading",
|
|
439
|
+
publicName: "loading",
|
|
440
|
+
isSignal: true,
|
|
441
|
+
isRequired: false,
|
|
442
|
+
transformFunction: null
|
|
443
|
+
},
|
|
444
|
+
ariaLabel: {
|
|
445
|
+
classPropertyName: "ariaLabel",
|
|
446
|
+
publicName: "ariaLabel",
|
|
447
|
+
isSignal: true,
|
|
448
|
+
isRequired: false,
|
|
449
|
+
transformFunction: null
|
|
450
|
+
},
|
|
451
|
+
dt: {
|
|
452
|
+
classPropertyName: "dt",
|
|
453
|
+
publicName: "dt",
|
|
454
|
+
isSignal: true,
|
|
455
|
+
isRequired: false,
|
|
456
|
+
transformFunction: null
|
|
457
|
+
},
|
|
458
|
+
pt: {
|
|
459
|
+
classPropertyName: "pt",
|
|
460
|
+
publicName: "pt",
|
|
461
|
+
isSignal: true,
|
|
462
|
+
isRequired: false,
|
|
463
|
+
transformFunction: null
|
|
464
|
+
},
|
|
465
|
+
ptOptions: {
|
|
466
|
+
classPropertyName: "ptOptions",
|
|
467
|
+
publicName: "ptOptions",
|
|
468
|
+
isSignal: true,
|
|
469
|
+
isRequired: false,
|
|
470
|
+
transformFunction: null
|
|
471
|
+
},
|
|
472
|
+
unstyled: {
|
|
473
|
+
classPropertyName: "unstyled",
|
|
474
|
+
publicName: "unstyled",
|
|
475
|
+
isSignal: true,
|
|
476
|
+
isRequired: false,
|
|
477
|
+
transformFunction: null
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
outputs: {
|
|
481
|
+
barClick: "barClick",
|
|
482
|
+
barToggle: "barToggle"
|
|
483
|
+
},
|
|
484
|
+
host: {
|
|
485
|
+
properties: {
|
|
486
|
+
"class": "passThrough().root?.class",
|
|
487
|
+
"style": "hostStyle()",
|
|
488
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
489
|
+
"class.tx-radial-bar--fill": "typeof height() === \"string\"",
|
|
490
|
+
"class.tx-radial-bar--entering": "entrance.active()",
|
|
491
|
+
"class.tx-radial-bar--morph": "morph()",
|
|
492
|
+
"class.tx-radial-bar--hovering": "hovered() !== null"
|
|
493
|
+
},
|
|
494
|
+
classAttribute: "tx-radial-bar"
|
|
495
|
+
},
|
|
496
|
+
queries: [{
|
|
497
|
+
propertyName: "legendTemplate",
|
|
498
|
+
first: true,
|
|
499
|
+
predicate: TxChartLegendTemplate,
|
|
500
|
+
descendants: true,
|
|
501
|
+
isSignal: true
|
|
502
|
+
}, {
|
|
503
|
+
propertyName: "tooltipTemplate",
|
|
504
|
+
first: true,
|
|
505
|
+
predicate: TxChartTooltipTemplate,
|
|
506
|
+
descendants: true,
|
|
507
|
+
isSignal: true
|
|
508
|
+
}],
|
|
509
|
+
viewQueries: [{
|
|
510
|
+
propertyName: "frame",
|
|
511
|
+
first: true,
|
|
512
|
+
predicate: TxChartFrame,
|
|
513
|
+
descendants: true,
|
|
514
|
+
isSignal: true
|
|
515
|
+
}],
|
|
516
|
+
ngImport: i0,
|
|
517
|
+
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-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 @for (ring of rings(); track ring.key) {\n <svg:g\n class=\"tx-radial-bar__ring\"\n [class.tx-radial-bar__ring--hovered]=\"hovered() === ring.index\"\n [attr.data-index]=\"ring.index\"\n [style.--tx-radial-bar-color]=\"ring.color\"\n [style.--tx-radial-bar-order]=\"ring.index\"\n >\n @if (track()) {\n <svg:path\n class=\"tx-radial-bar__track\"\n [class]=\"passThrough().track?.class\"\n [style]=\"passThrough().track?.style\"\n [attr.d]=\"ring.track\"\n [style.stroke-width.px]=\"ring.width\"\n />\n }\n @if (ring.bar) {\n <svg:path\n class=\"tx-radial-bar__bar\"\n [class]=\"passThrough().bar?.class\"\n [style]=\"passThrough().bar?.style\"\n [attr.d]=\"ring.bar\"\n pathLength=\"1\"\n [style.stroke-width.px]=\"ring.width\"\n />\n }\n </svg:g>\n }\n @if (center(); as data) {\n <svg:g class=\"tx-radial-bar__center\" [class]=\"passThrough().center?.class\" [style]=\"passThrough().center?.style\">\n <svg:text\n class=\"tx-radial-bar__center-value\"\n text-anchor=\"middle\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"fit().cy + centerFont().value * 0.3 - (data.label ? centerFont().label * 0.6 : 0)\"\n [style.font-size.px]=\"centerFont().value\"\n >\n {{ data.value }}\n </svg:text>\n @if (data.label) {\n <svg:text\n class=\"tx-radial-bar__center-label\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"fit().cy + centerFont().value * 0.3 - centerFont().label * 0.6 + 6\"\n [style.font-size.px]=\"centerFont().label\"\n >\n {{ data.label }}\n </svg:text>\n }\n </svg:g>\n }\n</tx-chart-frame>\n",
|
|
518
|
+
styles: [":host{display:block;min-width:0}:host(.tx-radial-bar--fill){height:100%}.tx-radial-bar__track,.tx-radial-bar__bar{fill:none}.tx-radial-bar__track{stroke:currentColor;stroke-opacity:.12}.tx-radial-bar__bar{stroke:var(--tx-radial-bar-color);stroke-linecap:round}.tx-radial-bar__center{pointer-events:none}:host([data-styled]) .tx-radial-bar__track{stroke:var(--tx-chart-radial-bar-track-color);stroke-opacity:1}:host([data-styled]) .tx-radial-bar__ring{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-radial-bar__center-value{fill:var(--tx-chart-radial-bar-value-color);font-weight:var(--tx-chart-radial-bar-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-radial-bar__center-label{fill:var(--tx-chart-radial-bar-label-color);font-weight:var(--tx-chart-radial-bar-label-font-weight)}:host([data-styled].tx-radial-bar--hovering) .tx-radial-bar__ring:not(.tx-radial-bar__ring--hovered){opacity:var(--tx-chart-radial-bar-dimmed-opacity)}:host([data-styled].tx-radial-bar--morph) .tx-radial-bar__bar{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-radial-bar--entering) .tx-radial-bar__bar{stroke-dasharray:1 1;animation:tx-radial-bar-draw var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-radial-bar-order, 0) * var(--tx-chart-motion-stagger) * 2)}@keyframes tx-radial-bar-draw{0%{stroke-dashoffset:1}to{stroke-dashoffset:0}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-radial-bar__ring,:host([data-styled]) .tx-radial-bar__bar{transition:none;animation:none}}\n"],
|
|
519
|
+
dependencies: [{
|
|
520
|
+
kind: "component",
|
|
521
|
+
type: TxChartFrame,
|
|
522
|
+
selector: "tx-chart-frame",
|
|
523
|
+
inputs: [
|
|
524
|
+
"height",
|
|
525
|
+
"size",
|
|
526
|
+
"legendItems",
|
|
527
|
+
"showLegend",
|
|
528
|
+
"legendPosition",
|
|
529
|
+
"legendAlign",
|
|
530
|
+
"legendVariant",
|
|
531
|
+
"legendToggle",
|
|
532
|
+
"legendTemplate",
|
|
533
|
+
"empty",
|
|
534
|
+
"loading",
|
|
535
|
+
"emptyIcon",
|
|
536
|
+
"summary",
|
|
537
|
+
"table",
|
|
538
|
+
"tooltip",
|
|
539
|
+
"tooltipTemplate",
|
|
540
|
+
"tooltipPlacement",
|
|
541
|
+
"panelStyle",
|
|
542
|
+
"parts",
|
|
543
|
+
"styled",
|
|
544
|
+
"interactive",
|
|
545
|
+
"actionKeys",
|
|
546
|
+
"zoomable",
|
|
547
|
+
"zoomedIn",
|
|
548
|
+
"plotHeight",
|
|
549
|
+
"toolbar",
|
|
550
|
+
"exportName"
|
|
551
|
+
],
|
|
552
|
+
outputs: [
|
|
553
|
+
"sizeChange",
|
|
554
|
+
"pointer",
|
|
555
|
+
"navigate",
|
|
556
|
+
"legendToggled",
|
|
557
|
+
"legendHovered",
|
|
558
|
+
"tooltipClosed",
|
|
559
|
+
"zoomed",
|
|
560
|
+
"panned",
|
|
561
|
+
"zoomReset"
|
|
562
|
+
]
|
|
563
|
+
}],
|
|
564
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
565
|
+
});
|
|
566
|
+
};
|
|
567
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
568
|
+
minVersion: "12.0.0",
|
|
569
|
+
version: "22.2.3",
|
|
570
|
+
ngImport: i0,
|
|
571
|
+
type: TxRadialBar,
|
|
572
|
+
decorators: [{
|
|
573
|
+
type: Component,
|
|
574
|
+
args: [{
|
|
575
|
+
selector: "tx-radial-bar",
|
|
576
|
+
imports: [TxChartFrame],
|
|
577
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
578
|
+
host: {
|
|
579
|
+
class: "tx-radial-bar",
|
|
580
|
+
"[class]": "passThrough().root?.class",
|
|
581
|
+
"[style]": "hostStyle()",
|
|
582
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
583
|
+
"[class.tx-radial-bar--fill]": "typeof height() === \"string\"",
|
|
584
|
+
"[class.tx-radial-bar--entering]": "entrance.active()",
|
|
585
|
+
"[class.tx-radial-bar--morph]": "morph()",
|
|
586
|
+
"[class.tx-radial-bar--hovering]": "hovered() !== null"
|
|
587
|
+
},
|
|
588
|
+
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-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 @for (ring of rings(); track ring.key) {\n <svg:g\n class=\"tx-radial-bar__ring\"\n [class.tx-radial-bar__ring--hovered]=\"hovered() === ring.index\"\n [attr.data-index]=\"ring.index\"\n [style.--tx-radial-bar-color]=\"ring.color\"\n [style.--tx-radial-bar-order]=\"ring.index\"\n >\n @if (track()) {\n <svg:path\n class=\"tx-radial-bar__track\"\n [class]=\"passThrough().track?.class\"\n [style]=\"passThrough().track?.style\"\n [attr.d]=\"ring.track\"\n [style.stroke-width.px]=\"ring.width\"\n />\n }\n @if (ring.bar) {\n <svg:path\n class=\"tx-radial-bar__bar\"\n [class]=\"passThrough().bar?.class\"\n [style]=\"passThrough().bar?.style\"\n [attr.d]=\"ring.bar\"\n pathLength=\"1\"\n [style.stroke-width.px]=\"ring.width\"\n />\n }\n </svg:g>\n }\n @if (center(); as data) {\n <svg:g class=\"tx-radial-bar__center\" [class]=\"passThrough().center?.class\" [style]=\"passThrough().center?.style\">\n <svg:text\n class=\"tx-radial-bar__center-value\"\n text-anchor=\"middle\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"fit().cy + centerFont().value * 0.3 - (data.label ? centerFont().label * 0.6 : 0)\"\n [style.font-size.px]=\"centerFont().value\"\n >\n {{ data.value }}\n </svg:text>\n @if (data.label) {\n <svg:text\n class=\"tx-radial-bar__center-label\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"fit().cy + centerFont().value * 0.3 - centerFont().label * 0.6 + 6\"\n [style.font-size.px]=\"centerFont().label\"\n >\n {{ data.label }}\n </svg:text>\n }\n </svg:g>\n }\n</tx-chart-frame>\n",
|
|
589
|
+
styles: [":host{display:block;min-width:0}:host(.tx-radial-bar--fill){height:100%}.tx-radial-bar__track,.tx-radial-bar__bar{fill:none}.tx-radial-bar__track{stroke:currentColor;stroke-opacity:.12}.tx-radial-bar__bar{stroke:var(--tx-radial-bar-color);stroke-linecap:round}.tx-radial-bar__center{pointer-events:none}:host([data-styled]) .tx-radial-bar__track{stroke:var(--tx-chart-radial-bar-track-color);stroke-opacity:1}:host([data-styled]) .tx-radial-bar__ring{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-radial-bar__center-value{fill:var(--tx-chart-radial-bar-value-color);font-weight:var(--tx-chart-radial-bar-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-radial-bar__center-label{fill:var(--tx-chart-radial-bar-label-color);font-weight:var(--tx-chart-radial-bar-label-font-weight)}:host([data-styled].tx-radial-bar--hovering) .tx-radial-bar__ring:not(.tx-radial-bar__ring--hovered){opacity:var(--tx-chart-radial-bar-dimmed-opacity)}:host([data-styled].tx-radial-bar--morph) .tx-radial-bar__bar{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-radial-bar--entering) .tx-radial-bar__bar{stroke-dasharray:1 1;animation:tx-radial-bar-draw var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-radial-bar-order, 0) * var(--tx-chart-motion-stagger) * 2)}@keyframes tx-radial-bar-draw{0%{stroke-dashoffset:1}to{stroke-dashoffset:0}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-radial-bar__ring,:host([data-styled]) .tx-radial-bar__bar{transition:none;animation:none}}\n"]
|
|
590
|
+
}]
|
|
591
|
+
}],
|
|
592
|
+
ctorParameters: () => [],
|
|
593
|
+
propDecorators: {
|
|
594
|
+
items: [{
|
|
595
|
+
type: i0.Input,
|
|
596
|
+
args: [{
|
|
597
|
+
isSignal: true,
|
|
598
|
+
alias: "items",
|
|
599
|
+
required: false
|
|
600
|
+
}]
|
|
601
|
+
}],
|
|
602
|
+
max: [{
|
|
603
|
+
type: i0.Input,
|
|
604
|
+
args: [{
|
|
605
|
+
isSignal: true,
|
|
606
|
+
alias: "max",
|
|
607
|
+
required: false
|
|
608
|
+
}]
|
|
609
|
+
}],
|
|
610
|
+
height: [{
|
|
611
|
+
type: i0.Input,
|
|
612
|
+
args: [{
|
|
613
|
+
isSignal: true,
|
|
614
|
+
alias: "height",
|
|
615
|
+
required: false
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
startAngle: [{
|
|
619
|
+
type: i0.Input,
|
|
620
|
+
args: [{
|
|
621
|
+
isSignal: true,
|
|
622
|
+
alias: "startAngle",
|
|
623
|
+
required: false
|
|
624
|
+
}]
|
|
625
|
+
}],
|
|
626
|
+
endAngle: [{
|
|
627
|
+
type: i0.Input,
|
|
628
|
+
args: [{
|
|
629
|
+
isSignal: true,
|
|
630
|
+
alias: "endAngle",
|
|
631
|
+
required: false
|
|
632
|
+
}]
|
|
633
|
+
}],
|
|
634
|
+
hole: [{
|
|
635
|
+
type: i0.Input,
|
|
636
|
+
args: [{
|
|
637
|
+
isSignal: true,
|
|
638
|
+
alias: "hole",
|
|
639
|
+
required: false
|
|
640
|
+
}]
|
|
641
|
+
}],
|
|
642
|
+
track: [{
|
|
643
|
+
type: i0.Input,
|
|
644
|
+
args: [{
|
|
645
|
+
isSignal: true,
|
|
646
|
+
alias: "track",
|
|
647
|
+
required: false
|
|
648
|
+
}]
|
|
649
|
+
}],
|
|
650
|
+
centerValue: [{
|
|
651
|
+
type: i0.Input,
|
|
652
|
+
args: [{
|
|
653
|
+
isSignal: true,
|
|
654
|
+
alias: "centerValue",
|
|
655
|
+
required: false
|
|
656
|
+
}]
|
|
657
|
+
}],
|
|
658
|
+
totalLabel: [{
|
|
659
|
+
type: i0.Input,
|
|
660
|
+
args: [{
|
|
661
|
+
isSignal: true,
|
|
662
|
+
alias: "totalLabel",
|
|
663
|
+
required: false
|
|
664
|
+
}]
|
|
665
|
+
}],
|
|
666
|
+
showLegend: [{
|
|
667
|
+
type: i0.Input,
|
|
668
|
+
args: [{
|
|
669
|
+
isSignal: true,
|
|
670
|
+
alias: "showLegend",
|
|
671
|
+
required: false
|
|
672
|
+
}]
|
|
673
|
+
}],
|
|
674
|
+
legendPosition: [{
|
|
675
|
+
type: i0.Input,
|
|
676
|
+
args: [{
|
|
677
|
+
isSignal: true,
|
|
678
|
+
alias: "legendPosition",
|
|
679
|
+
required: false
|
|
680
|
+
}]
|
|
681
|
+
}],
|
|
682
|
+
legendAlign: [{
|
|
683
|
+
type: i0.Input,
|
|
684
|
+
args: [{
|
|
685
|
+
isSignal: true,
|
|
686
|
+
alias: "legendAlign",
|
|
687
|
+
required: false
|
|
688
|
+
}]
|
|
689
|
+
}],
|
|
690
|
+
legendVariant: [{
|
|
691
|
+
type: i0.Input,
|
|
692
|
+
args: [{
|
|
693
|
+
isSignal: true,
|
|
694
|
+
alias: "legendVariant",
|
|
695
|
+
required: false
|
|
696
|
+
}]
|
|
697
|
+
}],
|
|
698
|
+
legendValues: [{
|
|
699
|
+
type: i0.Input,
|
|
700
|
+
args: [{
|
|
701
|
+
isSignal: true,
|
|
702
|
+
alias: "legendValues",
|
|
703
|
+
required: false
|
|
704
|
+
}]
|
|
705
|
+
}],
|
|
706
|
+
showTooltip: [{
|
|
707
|
+
type: i0.Input,
|
|
708
|
+
args: [{
|
|
709
|
+
isSignal: true,
|
|
710
|
+
alias: "showTooltip",
|
|
711
|
+
required: false
|
|
712
|
+
}]
|
|
713
|
+
}],
|
|
714
|
+
valueFormat: [{
|
|
715
|
+
type: i0.Input,
|
|
716
|
+
args: [{
|
|
717
|
+
isSignal: true,
|
|
718
|
+
alias: "valueFormat",
|
|
719
|
+
required: false
|
|
720
|
+
}]
|
|
721
|
+
}],
|
|
722
|
+
toolbar: [{
|
|
723
|
+
type: i0.Input,
|
|
724
|
+
args: [{
|
|
725
|
+
isSignal: true,
|
|
726
|
+
alias: "toolbar",
|
|
727
|
+
required: false
|
|
728
|
+
}]
|
|
729
|
+
}],
|
|
730
|
+
loading: [{
|
|
731
|
+
type: i0.Input,
|
|
732
|
+
args: [{
|
|
733
|
+
isSignal: true,
|
|
734
|
+
alias: "loading",
|
|
735
|
+
required: false
|
|
736
|
+
}]
|
|
737
|
+
}],
|
|
738
|
+
ariaLabel: [{
|
|
739
|
+
type: i0.Input,
|
|
740
|
+
args: [{
|
|
741
|
+
isSignal: true,
|
|
742
|
+
alias: "ariaLabel",
|
|
743
|
+
required: false
|
|
744
|
+
}]
|
|
745
|
+
}],
|
|
746
|
+
dt: [{
|
|
747
|
+
type: i0.Input,
|
|
748
|
+
args: [{
|
|
749
|
+
isSignal: true,
|
|
750
|
+
alias: "dt",
|
|
751
|
+
required: false
|
|
752
|
+
}]
|
|
753
|
+
}],
|
|
754
|
+
pt: [{
|
|
755
|
+
type: i0.Input,
|
|
756
|
+
args: [{
|
|
757
|
+
isSignal: true,
|
|
758
|
+
alias: "pt",
|
|
759
|
+
required: false
|
|
760
|
+
}]
|
|
761
|
+
}],
|
|
762
|
+
ptOptions: [{
|
|
763
|
+
type: i0.Input,
|
|
764
|
+
args: [{
|
|
765
|
+
isSignal: true,
|
|
766
|
+
alias: "ptOptions",
|
|
767
|
+
required: false
|
|
768
|
+
}]
|
|
769
|
+
}],
|
|
770
|
+
unstyled: [{
|
|
771
|
+
type: i0.Input,
|
|
772
|
+
args: [{
|
|
773
|
+
isSignal: true,
|
|
774
|
+
alias: "unstyled",
|
|
775
|
+
required: false
|
|
776
|
+
}]
|
|
777
|
+
}],
|
|
778
|
+
barClick: [{
|
|
779
|
+
type: i0.Output,
|
|
780
|
+
args: ["barClick"]
|
|
781
|
+
}],
|
|
782
|
+
barToggle: [{
|
|
783
|
+
type: i0.Output,
|
|
784
|
+
args: ["barToggle"]
|
|
785
|
+
}],
|
|
786
|
+
legendTemplate: [{
|
|
787
|
+
type: i0.ContentChild,
|
|
788
|
+
args: [i0.forwardRef(() => TxChartLegendTemplate), { isSignal: true }]
|
|
789
|
+
}],
|
|
790
|
+
tooltipTemplate: [{
|
|
791
|
+
type: i0.ContentChild,
|
|
792
|
+
args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
|
|
793
|
+
}],
|
|
794
|
+
frame: [{
|
|
795
|
+
type: i0.ViewChild,
|
|
796
|
+
args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
|
|
797
|
+
}]
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
export { TxRadialBar, radialRings, radialShare };
|
|
801
|
+
|
|
802
|
+
//# sourceMappingURL=tectra-ng-charts-radial-bar.mjs.map
|