@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.
- package/LICENSE +21 -0
- package/README.md +44 -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 +73 -0
- package/combo/README.md +83 -0
- package/core/README.md +62 -0
- 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 +1166 -0
- package/fesm2022/tectra-ng-charts-column.mjs.map +1 -0
- 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 +3679 -0
- package/fesm2022/tectra-ng-charts-core.mjs.map +1 -0
- 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 +1541 -0
- package/fesm2022/tectra-ng-charts-line.mjs.map +1 -0
- 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 +1059 -0
- package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -0
- 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/fesm2022/tectra-ng-charts.mjs +4 -0
- package/fesm2022/tectra-ng-charts.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 +86 -0
- package/org-chart/README.md +57 -0
- package/package.json +173 -4
- package/pie/README.md +66 -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 +951 -0
- package/types/tectra-ng-charts-column.d.ts.map +1 -0
- 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 +859 -0
- package/types/tectra-ng-charts-core.d.ts.map +1 -0
- 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 +1023 -0
- package/types/tectra-ng-charts-line.d.ts.map +1 -0
- 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 +983 -0
- package/types/tectra-ng-charts-pie.d.ts.map +1 -0
- 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/types/tectra-ng-charts.d.ts +2 -0
- package/types/tectra-ng-charts.d.ts.map +1 -0
- package/waterfall/README.md +60 -0
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, inject, input, linkedSignal, signal } from "@angular/core";
|
|
3
|
+
import { TxChartFrame, arcBounds, arcSpan, chartNumberFormatter, initialChartSize, injectChartEntrance, linearTicks, polar, readTokenNumber, strokeArc, textWidth, tickFormatter } from "@tectra-ng/charts/core";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { TxLocaleService, formatMessage, injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
7
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
8
|
+
function gaugeRatio(value, min, max) {
|
|
9
|
+
if (value === null || !Number.isFinite(value) || !(max > min)) return 0;
|
|
10
|
+
return Math.max(0, Math.min(1, (value - min) / (max - min)));
|
|
11
|
+
}
|
|
12
|
+
function gaugeAngle(value, min, max, start, end) {
|
|
13
|
+
return start + (end - start) * gaugeRatio(value, min, max);
|
|
14
|
+
}
|
|
15
|
+
function gaugeNeedle(cx, cy, length, width) {
|
|
16
|
+
const half = width / 2;
|
|
17
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
18
|
+
return `M${round(cx - half)},${round(cy)}L${round(cx - 1)},${round(cy - length)}L${round(cx + 1)},${round(cy - length)}L${round(cx + half)},${round(cy)}Z`;
|
|
19
|
+
}
|
|
20
|
+
const DEFAULTS = {
|
|
21
|
+
thickness: .16,
|
|
22
|
+
bandGap: 2,
|
|
23
|
+
needleWidth: 6,
|
|
24
|
+
hubRadius: 6,
|
|
25
|
+
tickLength: 6,
|
|
26
|
+
tickFontSize: 11
|
|
27
|
+
};
|
|
28
|
+
const PADDING = 6;
|
|
29
|
+
const TICK_GAP = 4;
|
|
30
|
+
const MIN_RADIUS = 8;
|
|
31
|
+
const VALUE_GAP = 8;
|
|
32
|
+
const LABEL_GAP = 6;
|
|
33
|
+
var TxGauge = class TxGauge {
|
|
34
|
+
locale = inject(TxLocaleService);
|
|
35
|
+
host = inject(ElementRef);
|
|
36
|
+
translations = injectTranslations();
|
|
37
|
+
value = input(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
38
|
+
min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
|
|
39
|
+
max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
|
|
40
|
+
bands = input([], ...ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []);
|
|
41
|
+
needle = input(void 0, {
|
|
42
|
+
...ngDevMode ? { debugName: "needle" } : /* istanbul ignore next */ {},
|
|
43
|
+
transform: optionalBoolean
|
|
44
|
+
});
|
|
45
|
+
tone = input("primary", ...ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []);
|
|
46
|
+
color = input(void 0, ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
47
|
+
startAngle = input(-120, ...ngDevMode ? [{ debugName: "startAngle" }] : /* istanbul ignore next */ []);
|
|
48
|
+
endAngle = input(120, ...ngDevMode ? [{ debugName: "endAngle" }] : /* istanbul ignore next */ []);
|
|
49
|
+
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
50
|
+
valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
51
|
+
ticks = input(5, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
52
|
+
showTicks = input(true, {
|
|
53
|
+
...ngDevMode ? { debugName: "showTicks" } : /* istanbul ignore next */ {},
|
|
54
|
+
transform: booleanAttribute
|
|
55
|
+
});
|
|
56
|
+
showValue = input(true, {
|
|
57
|
+
...ngDevMode ? { debugName: "showValue" } : /* istanbul ignore next */ {},
|
|
58
|
+
transform: booleanAttribute
|
|
59
|
+
});
|
|
60
|
+
height = input(220, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
61
|
+
toolbar = input(false, {
|
|
62
|
+
...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
|
|
63
|
+
transform: booleanAttribute
|
|
64
|
+
});
|
|
65
|
+
loading = input(false, {
|
|
66
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
67
|
+
transform: booleanAttribute
|
|
68
|
+
});
|
|
69
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
70
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
71
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
72
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
73
|
+
unstyled = input(void 0, {
|
|
74
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
75
|
+
transform: optionalBoolean
|
|
76
|
+
});
|
|
77
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
78
|
+
passThrough = injectPassThrough("gauge", this, this.pt, this.ptOptions);
|
|
79
|
+
tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
|
|
80
|
+
hostStyle = computed(() => ({
|
|
81
|
+
...this.tokenStyle(),
|
|
82
|
+
...this.passThrough().root?.style
|
|
83
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
84
|
+
entrance = injectChartEntrance();
|
|
85
|
+
morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
|
|
86
|
+
geometry = signal(DEFAULTS, ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
|
|
87
|
+
intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
|
|
88
|
+
size = linkedSignal(() => initialChartSize(this.height(), null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
89
|
+
bandList = computed(() => this.bands() ?? [], ...ngDevMode ? [{ debugName: "bandList" }] : /* istanbul ignore next */ []);
|
|
90
|
+
hasNeedle = computed(() => this.needle() ?? this.bandList().length > 0, ...ngDevMode ? [{ debugName: "hasNeedle" }] : /* istanbul ignore next */ []);
|
|
91
|
+
isEmpty = computed(() => {
|
|
92
|
+
const value = this.value();
|
|
93
|
+
return value === null || value === void 0 || !Number.isFinite(value) || !(this.max() > this.min());
|
|
94
|
+
}, ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
95
|
+
span = computed(() => arcSpan(this.startAngle(), this.endAngle()), ...ngDevMode ? [{ debugName: "span" }] : /* istanbul ignore next */ []);
|
|
96
|
+
tickValues = computed(() => this.showTicks() ? linearTicks(this.min(), this.max(), Math.max(1, this.ticks())) : [], ...ngDevMode ? [{ debugName: "tickValues" }] : /* istanbul ignore next */ []);
|
|
97
|
+
tickFormat = computed(() => tickFormatter(this.intl(), this.tickValues(), this.valueFormat()), ...ngDevMode ? [{ debugName: "tickFormat" }] : /* istanbul ignore next */ []);
|
|
98
|
+
tickRoom = computed(() => {
|
|
99
|
+
const values = this.tickValues();
|
|
100
|
+
if (!values.length) return 0;
|
|
101
|
+
const { tickLength, tickFontSize } = this.geometry();
|
|
102
|
+
const widest = Math.max(...values.map((value) => textWidth(this.tickFormat()(value), tickFontSize)));
|
|
103
|
+
return TICK_GAP + tickLength + TICK_GAP + Math.max(widest, tickFontSize);
|
|
104
|
+
}, ...ngDevMode ? [{ debugName: "tickRoom" }] : /* istanbul ignore next */ []);
|
|
105
|
+
fit = computed(() => {
|
|
106
|
+
const { width, height } = this.size();
|
|
107
|
+
const [start, end] = this.span();
|
|
108
|
+
const bounds = arcBounds(start, end);
|
|
109
|
+
const room = this.tickRoom();
|
|
110
|
+
const below = (radius) => Math.max(bounds.maxY * (radius + room), this.textBelow(radius));
|
|
111
|
+
const fits = (radius) => (bounds.maxX - bounds.minX) * (radius + room) <= width - 12 && -bounds.minY * (radius + room) + below(radius) <= height - 12;
|
|
112
|
+
let low = MIN_RADIUS;
|
|
113
|
+
let high = Math.max(MIN_RADIUS, Math.min(width, height));
|
|
114
|
+
for (let step = 0; step < 24; step++) {
|
|
115
|
+
const middle = (low + high) / 2;
|
|
116
|
+
if (fits(middle)) low = middle;
|
|
117
|
+
else high = middle;
|
|
118
|
+
}
|
|
119
|
+
const top = -bounds.minY * (low + room);
|
|
120
|
+
const used = top + below(low);
|
|
121
|
+
return {
|
|
122
|
+
cx: width / 2 - (bounds.minX + bounds.maxX) / 2 * (low + room),
|
|
123
|
+
cy: PADDING + (height - 12 - used) / 2 + top,
|
|
124
|
+
radius: low
|
|
125
|
+
};
|
|
126
|
+
}, ...ngDevMode ? [{ debugName: "fit" }] : /* istanbul ignore next */ []);
|
|
127
|
+
width = computed(() => Math.max(2, this.fit().radius * this.geometry().thickness), ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
128
|
+
arcRadius = computed(() => this.fit().radius - this.width() / 2, ...ngDevMode ? [{ debugName: "arcRadius" }] : /* istanbul ignore next */ []);
|
|
129
|
+
angle = computed(() => gaugeAngle(this.value() ?? null, this.min(), this.max(), this.span()[0], this.span()[1]), ...ngDevMode ? [{ debugName: "angle" }] : /* istanbul ignore next */ []);
|
|
130
|
+
track = computed(() => {
|
|
131
|
+
const fit = this.fit();
|
|
132
|
+
const [start, end] = this.span();
|
|
133
|
+
return strokeArc(fit.cx, fit.cy, this.arcRadius(), start, end);
|
|
134
|
+
}, ...ngDevMode ? [{ debugName: "track" }] : /* istanbul ignore next */ []);
|
|
135
|
+
progress = computed(() => {
|
|
136
|
+
if (this.hasNeedle() || this.isEmpty()) return "";
|
|
137
|
+
const fit = this.fit();
|
|
138
|
+
const start = this.span()[0];
|
|
139
|
+
const angle = this.angle();
|
|
140
|
+
return angle > start ? strokeArc(fit.cx, fit.cy, this.arcRadius(), start, Math.max(start + .001, angle)) : "";
|
|
141
|
+
}, ...ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []);
|
|
142
|
+
progressColor = computed(() => this.color() ?? `var(--tx-chart-gauge-${this.tone()}-color)`, ...ngDevMode ? [{ debugName: "progressColor" }] : /* istanbul ignore next */ []);
|
|
143
|
+
bandArcs = computed(() => {
|
|
144
|
+
const fit = this.fit();
|
|
145
|
+
const [start, end] = this.span();
|
|
146
|
+
const radius = this.arcRadius();
|
|
147
|
+
const gap = this.bandList().length > 1 ? this.geometry().bandGap / Math.max(1, radius) / 2 : 0;
|
|
148
|
+
return this.bandList().flatMap((band, index) => {
|
|
149
|
+
const from = gaugeAngle(Math.min(band.from, band.to), this.min(), this.max(), start, end);
|
|
150
|
+
const to = gaugeAngle(Math.max(band.from, band.to), this.min(), this.max(), start, end);
|
|
151
|
+
const a = from > start + 1e-6 ? from + gap : from;
|
|
152
|
+
const b = to < end - 1e-6 ? to - gap : to;
|
|
153
|
+
if (b <= a) return [];
|
|
154
|
+
return [{
|
|
155
|
+
key: `${index}:${band.from}:${band.to}`,
|
|
156
|
+
path: strokeArc(fit.cx, fit.cy, radius, a, b),
|
|
157
|
+
color: band.color ?? `var(--tx-chart-gauge-${band.tone ?? "neutral"}-color)`,
|
|
158
|
+
label: band.label ?? null
|
|
159
|
+
}];
|
|
160
|
+
});
|
|
161
|
+
}, ...ngDevMode ? [{ debugName: "bandArcs" }] : /* istanbul ignore next */ []);
|
|
162
|
+
tickMarks = computed(() => {
|
|
163
|
+
const fit = this.fit();
|
|
164
|
+
const [start, end] = this.span();
|
|
165
|
+
const { tickLength, tickFontSize } = this.geometry();
|
|
166
|
+
const outer = fit.radius + TICK_GAP;
|
|
167
|
+
const format = this.tickFormat();
|
|
168
|
+
return this.tickValues().map((value) => {
|
|
169
|
+
const angle = gaugeAngle(value, this.min(), this.max(), start, end);
|
|
170
|
+
const from = polar(fit.cx, fit.cy, outer, angle);
|
|
171
|
+
const to = polar(fit.cx, fit.cy, outer + tickLength, angle);
|
|
172
|
+
const sin = Math.sin(angle);
|
|
173
|
+
const cos = Math.cos(angle);
|
|
174
|
+
const text = polar(fit.cx, fit.cy, outer + tickLength + TICK_GAP + (Math.abs(cos) > .3 ? tickFontSize * .5 * Math.abs(cos) : 0), angle);
|
|
175
|
+
return {
|
|
176
|
+
value,
|
|
177
|
+
x1: from.x,
|
|
178
|
+
y1: from.y,
|
|
179
|
+
x2: to.x,
|
|
180
|
+
y2: to.y,
|
|
181
|
+
labelX: text.x,
|
|
182
|
+
labelY: text.y,
|
|
183
|
+
label: format(value),
|
|
184
|
+
anchor: sin > .3 ? "start" : sin < -.3 ? "end" : "middle"
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}, ...ngDevMode ? [{ debugName: "tickMarks" }] : /* istanbul ignore next */ []);
|
|
188
|
+
needlePath = computed(() => {
|
|
189
|
+
const fit = this.fit();
|
|
190
|
+
const length = fit.radius - this.width() * .5;
|
|
191
|
+
return gaugeNeedle(fit.cx, fit.cy, length, this.geometry().needleWidth);
|
|
192
|
+
}, ...ngDevMode ? [{ debugName: "needlePath" }] : /* istanbul ignore next */ []);
|
|
193
|
+
needleRotation = computed(() => `${this.angle() * 180 / Math.PI}deg`, ...ngDevMode ? [{ debugName: "needleRotation" }] : /* istanbul ignore next */ []);
|
|
194
|
+
startRotation = computed(() => `${this.startAngle()}deg`, ...ngDevMode ? [{ debugName: "startRotation" }] : /* istanbul ignore next */ []);
|
|
195
|
+
formatted = computed(() => {
|
|
196
|
+
const value = this.value();
|
|
197
|
+
return value === null || value === void 0 || !Number.isFinite(value) ? "—" : chartNumberFormatter(this.intl(), this.valueFormat())(value);
|
|
198
|
+
}, ...ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []);
|
|
199
|
+
valueFont = computed(() => this.fontsFor(this.fit().radius), ...ngDevMode ? [{ debugName: "valueFont" }] : /* istanbul ignore next */ []);
|
|
200
|
+
valueY = computed(() => this.fit().cy + this.valueOffset(this.fit().radius), ...ngDevMode ? [{ debugName: "valueY" }] : /* istanbul ignore next */ []);
|
|
201
|
+
summary = computed(() => {
|
|
202
|
+
const t = this.translations();
|
|
203
|
+
const format = chartNumberFormatter(this.intl(), this.valueFormat());
|
|
204
|
+
const band = this.bandList().find((item) => {
|
|
205
|
+
const value = this.value();
|
|
206
|
+
return value !== null && value !== void 0 && value >= Math.min(item.from, item.to) && value <= Math.max(item.from, item.to);
|
|
207
|
+
});
|
|
208
|
+
return `${[
|
|
209
|
+
this.ariaLabel(),
|
|
210
|
+
t.chartGauge,
|
|
211
|
+
this.label()
|
|
212
|
+
].filter(Boolean).join(", ")}: ${formatMessage(t.chartGaugeValue, {
|
|
213
|
+
value: this.formatted(),
|
|
214
|
+
min: format(this.min()),
|
|
215
|
+
max: format(this.max())
|
|
216
|
+
}, this.intl())}${band?.label ? `, ${band.label}` : ""}`;
|
|
217
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
218
|
+
constructor() {
|
|
219
|
+
afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
|
|
220
|
+
afterRenderEffect(() => {
|
|
221
|
+
this.dt();
|
|
222
|
+
this.readGeometry();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
fontsFor(radius) {
|
|
226
|
+
return {
|
|
227
|
+
value: Math.max(14, Math.min(34, radius * .24)),
|
|
228
|
+
label: Math.max(10, Math.min(14, radius * .1))
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
valueOffset(radius) {
|
|
232
|
+
const font = this.fontsFor(radius).value;
|
|
233
|
+
return this.hasNeedle() ? this.geometry().hubRadius + VALUE_GAP + font * .8 : font * .3;
|
|
234
|
+
}
|
|
235
|
+
textBelow(radius) {
|
|
236
|
+
if (!this.showValue()) return this.hasNeedle() ? this.geometry().hubRadius : 0;
|
|
237
|
+
const fonts = this.fontsFor(radius);
|
|
238
|
+
return this.valueOffset(radius) + (this.label() ? LABEL_GAP + fonts.label * 1.25 : fonts.value * .25);
|
|
239
|
+
}
|
|
240
|
+
readGeometry() {
|
|
241
|
+
const element = this.host.nativeElement;
|
|
242
|
+
const next = {
|
|
243
|
+
thickness: readTokenNumber(element, "--tx-chart-gauge-thickness", DEFAULTS.thickness),
|
|
244
|
+
bandGap: readTokenNumber(element, "--tx-chart-gauge-band-gap", DEFAULTS.bandGap),
|
|
245
|
+
needleWidth: readTokenNumber(element, "--tx-chart-gauge-needle-width", DEFAULTS.needleWidth),
|
|
246
|
+
hubRadius: readTokenNumber(element, "--tx-chart-gauge-hub-radius", DEFAULTS.hubRadius),
|
|
247
|
+
tickLength: readTokenNumber(element, "--tx-chart-gauge-tick-length", DEFAULTS.tickLength),
|
|
248
|
+
tickFontSize: readTokenNumber(element, "--tx-chart-gauge-tick-label-font-size", DEFAULTS.tickFontSize)
|
|
249
|
+
};
|
|
250
|
+
const current = this.geometry();
|
|
251
|
+
if (Object.keys(next).some((key) => next[key] !== current[key])) this.geometry.set(next);
|
|
252
|
+
}
|
|
253
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
254
|
+
minVersion: "12.0.0",
|
|
255
|
+
version: "22.2.3",
|
|
256
|
+
ngImport: i0,
|
|
257
|
+
type: TxGauge,
|
|
258
|
+
deps: [],
|
|
259
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
260
|
+
});
|
|
261
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
262
|
+
minVersion: "17.0.0",
|
|
263
|
+
version: "22.2.3",
|
|
264
|
+
type: TxGauge,
|
|
265
|
+
isStandalone: true,
|
|
266
|
+
selector: "tx-gauge",
|
|
267
|
+
inputs: {
|
|
268
|
+
value: {
|
|
269
|
+
classPropertyName: "value",
|
|
270
|
+
publicName: "value",
|
|
271
|
+
isSignal: true,
|
|
272
|
+
isRequired: false,
|
|
273
|
+
transformFunction: null
|
|
274
|
+
},
|
|
275
|
+
min: {
|
|
276
|
+
classPropertyName: "min",
|
|
277
|
+
publicName: "min",
|
|
278
|
+
isSignal: true,
|
|
279
|
+
isRequired: false,
|
|
280
|
+
transformFunction: null
|
|
281
|
+
},
|
|
282
|
+
max: {
|
|
283
|
+
classPropertyName: "max",
|
|
284
|
+
publicName: "max",
|
|
285
|
+
isSignal: true,
|
|
286
|
+
isRequired: false,
|
|
287
|
+
transformFunction: null
|
|
288
|
+
},
|
|
289
|
+
bands: {
|
|
290
|
+
classPropertyName: "bands",
|
|
291
|
+
publicName: "bands",
|
|
292
|
+
isSignal: true,
|
|
293
|
+
isRequired: false,
|
|
294
|
+
transformFunction: null
|
|
295
|
+
},
|
|
296
|
+
needle: {
|
|
297
|
+
classPropertyName: "needle",
|
|
298
|
+
publicName: "needle",
|
|
299
|
+
isSignal: true,
|
|
300
|
+
isRequired: false,
|
|
301
|
+
transformFunction: null
|
|
302
|
+
},
|
|
303
|
+
tone: {
|
|
304
|
+
classPropertyName: "tone",
|
|
305
|
+
publicName: "tone",
|
|
306
|
+
isSignal: true,
|
|
307
|
+
isRequired: false,
|
|
308
|
+
transformFunction: null
|
|
309
|
+
},
|
|
310
|
+
color: {
|
|
311
|
+
classPropertyName: "color",
|
|
312
|
+
publicName: "color",
|
|
313
|
+
isSignal: true,
|
|
314
|
+
isRequired: false,
|
|
315
|
+
transformFunction: null
|
|
316
|
+
},
|
|
317
|
+
startAngle: {
|
|
318
|
+
classPropertyName: "startAngle",
|
|
319
|
+
publicName: "startAngle",
|
|
320
|
+
isSignal: true,
|
|
321
|
+
isRequired: false,
|
|
322
|
+
transformFunction: null
|
|
323
|
+
},
|
|
324
|
+
endAngle: {
|
|
325
|
+
classPropertyName: "endAngle",
|
|
326
|
+
publicName: "endAngle",
|
|
327
|
+
isSignal: true,
|
|
328
|
+
isRequired: false,
|
|
329
|
+
transformFunction: null
|
|
330
|
+
},
|
|
331
|
+
label: {
|
|
332
|
+
classPropertyName: "label",
|
|
333
|
+
publicName: "label",
|
|
334
|
+
isSignal: true,
|
|
335
|
+
isRequired: false,
|
|
336
|
+
transformFunction: null
|
|
337
|
+
},
|
|
338
|
+
valueFormat: {
|
|
339
|
+
classPropertyName: "valueFormat",
|
|
340
|
+
publicName: "valueFormat",
|
|
341
|
+
isSignal: true,
|
|
342
|
+
isRequired: false,
|
|
343
|
+
transformFunction: null
|
|
344
|
+
},
|
|
345
|
+
ticks: {
|
|
346
|
+
classPropertyName: "ticks",
|
|
347
|
+
publicName: "ticks",
|
|
348
|
+
isSignal: true,
|
|
349
|
+
isRequired: false,
|
|
350
|
+
transformFunction: null
|
|
351
|
+
},
|
|
352
|
+
showTicks: {
|
|
353
|
+
classPropertyName: "showTicks",
|
|
354
|
+
publicName: "showTicks",
|
|
355
|
+
isSignal: true,
|
|
356
|
+
isRequired: false,
|
|
357
|
+
transformFunction: null
|
|
358
|
+
},
|
|
359
|
+
showValue: {
|
|
360
|
+
classPropertyName: "showValue",
|
|
361
|
+
publicName: "showValue",
|
|
362
|
+
isSignal: true,
|
|
363
|
+
isRequired: false,
|
|
364
|
+
transformFunction: null
|
|
365
|
+
},
|
|
366
|
+
height: {
|
|
367
|
+
classPropertyName: "height",
|
|
368
|
+
publicName: "height",
|
|
369
|
+
isSignal: true,
|
|
370
|
+
isRequired: false,
|
|
371
|
+
transformFunction: null
|
|
372
|
+
},
|
|
373
|
+
toolbar: {
|
|
374
|
+
classPropertyName: "toolbar",
|
|
375
|
+
publicName: "toolbar",
|
|
376
|
+
isSignal: true,
|
|
377
|
+
isRequired: false,
|
|
378
|
+
transformFunction: null
|
|
379
|
+
},
|
|
380
|
+
loading: {
|
|
381
|
+
classPropertyName: "loading",
|
|
382
|
+
publicName: "loading",
|
|
383
|
+
isSignal: true,
|
|
384
|
+
isRequired: false,
|
|
385
|
+
transformFunction: null
|
|
386
|
+
},
|
|
387
|
+
ariaLabel: {
|
|
388
|
+
classPropertyName: "ariaLabel",
|
|
389
|
+
publicName: "ariaLabel",
|
|
390
|
+
isSignal: true,
|
|
391
|
+
isRequired: false,
|
|
392
|
+
transformFunction: null
|
|
393
|
+
},
|
|
394
|
+
dt: {
|
|
395
|
+
classPropertyName: "dt",
|
|
396
|
+
publicName: "dt",
|
|
397
|
+
isSignal: true,
|
|
398
|
+
isRequired: false,
|
|
399
|
+
transformFunction: null
|
|
400
|
+
},
|
|
401
|
+
pt: {
|
|
402
|
+
classPropertyName: "pt",
|
|
403
|
+
publicName: "pt",
|
|
404
|
+
isSignal: true,
|
|
405
|
+
isRequired: false,
|
|
406
|
+
transformFunction: null
|
|
407
|
+
},
|
|
408
|
+
ptOptions: {
|
|
409
|
+
classPropertyName: "ptOptions",
|
|
410
|
+
publicName: "ptOptions",
|
|
411
|
+
isSignal: true,
|
|
412
|
+
isRequired: false,
|
|
413
|
+
transformFunction: null
|
|
414
|
+
},
|
|
415
|
+
unstyled: {
|
|
416
|
+
classPropertyName: "unstyled",
|
|
417
|
+
publicName: "unstyled",
|
|
418
|
+
isSignal: true,
|
|
419
|
+
isRequired: false,
|
|
420
|
+
transformFunction: null
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
host: {
|
|
424
|
+
properties: {
|
|
425
|
+
"class": "passThrough().root?.class",
|
|
426
|
+
"style": "hostStyle()",
|
|
427
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
428
|
+
"attr.data-mode": "hasNeedle() ? \"needle\" : \"progress\"",
|
|
429
|
+
"class.tx-gauge--fill": "typeof height() === \"string\"",
|
|
430
|
+
"class.tx-gauge--entering": "entrance.active()",
|
|
431
|
+
"class.tx-gauge--morph": "morph()"
|
|
432
|
+
},
|
|
433
|
+
classAttribute: "tx-gauge"
|
|
434
|
+
},
|
|
435
|
+
ngImport: i0,
|
|
436
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [interactive]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel() || label()\"\n emptyIcon=\"chart-pie\"\n [summary]=\"summary()\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n>\n <svg:path class=\"tx-gauge__track\" [class]=\"passThrough().track?.class\" [style]=\"passThrough().track?.style\" [attr.d]=\"track()\" [style.stroke-width.px]=\"width()\" />\n @for (band of bandArcs(); track band.key) {\n <svg:path\n class=\"tx-gauge__band\"\n [class]=\"passThrough().band?.class\"\n [style]=\"passThrough().band?.style\"\n [attr.d]=\"band.path\"\n [style.stroke]=\"band.color\"\n [style.stroke-width.px]=\"width()\"\n />\n }\n @if (progress()) {\n <svg:path\n class=\"tx-gauge__progress\"\n [class]=\"passThrough().progress?.class\"\n [style]=\"passThrough().progress?.style\"\n [attr.d]=\"progress()\"\n pathLength=\"1\"\n [style.stroke]=\"progressColor()\"\n [style.stroke-width.px]=\"width()\"\n />\n }\n @for (tick of tickMarks(); track tick.value) {\n <svg:g class=\"tx-gauge__tick\" [class]=\"passThrough().tick?.class\" [style]=\"passThrough().tick?.style\">\n <svg:line class=\"tx-gauge__tick-line\" [attr.x1]=\"tick.x1\" [attr.y1]=\"tick.y1\" [attr.x2]=\"tick.x2\" [attr.y2]=\"tick.y2\" />\n <svg:text class=\"tx-gauge__tick-label\" [attr.x]=\"tick.labelX\" [attr.y]=\"tick.labelY\" [attr.text-anchor]=\"tick.anchor\" dominant-baseline=\"middle\">{{ tick.label }}</svg:text>\n </svg:g>\n }\n @if (hasNeedle()) {\n <svg:g\n class=\"tx-gauge__needle\"\n [class]=\"passThrough().needle?.class\"\n [style]=\"passThrough().needle?.style\"\n [style.transform-origin]=\"fit().cx + 'px ' + fit().cy + 'px'\"\n [style.transform]=\"'rotate(' + needleRotation() + ')'\"\n [style.--tx-gauge-start]=\"startRotation()\"\n [style.--tx-gauge-angle]=\"needleRotation()\"\n >\n <svg:path class=\"tx-gauge__needle-body\" [attr.d]=\"needlePath()\" />\n <svg:circle class=\"tx-gauge__hub\" [attr.cx]=\"fit().cx\" [attr.cy]=\"fit().cy\" [attr.r]=\"geometry().hubRadius\" />\n </svg:g>\n }\n @if (showValue()) {\n <svg:text\n class=\"tx-gauge__value\"\n [class]=\"passThrough().value?.class\"\n [style]=\"passThrough().value?.style\"\n text-anchor=\"middle\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"valueY()\"\n [style.font-size.px]=\"valueFont().value\"\n >\n {{ formatted() }}\n </svg:text>\n @if (label()) {\n <svg:text\n class=\"tx-gauge__label\"\n [class]=\"passThrough().label?.class\"\n [style]=\"passThrough().label?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"valueY() + 6\"\n [style.font-size.px]=\"valueFont().label\"\n >\n {{ label() }}\n </svg:text>\n }\n }\n</tx-chart-frame>\n",
|
|
437
|
+
styles: [":host{display:block;min-width:0}:host(.tx-gauge--fill){height:100%}.tx-gauge__track,.tx-gauge__band,.tx-gauge__progress{fill:none}.tx-gauge__track{stroke:currentColor;stroke-opacity:.12;stroke-linecap:round}.tx-gauge__progress{stroke-linecap:round}:host([data-mode=needle]) .tx-gauge__track{stroke-linecap:butt}.tx-gauge__tick-line{stroke:currentColor}.tx-gauge__needle{transform-box:view-box}.tx-gauge__needle-body,.tx-gauge__hub{fill:currentColor}:host([data-styled]) .tx-gauge__track{stroke:var(--tx-chart-gauge-track-color);stroke-opacity:1}:host([data-styled]) .tx-gauge__tick-line{stroke:var(--tx-chart-gauge-tick-color)}:host([data-styled]) .tx-gauge__tick-label{fill:var(--tx-chart-gauge-tick-label-color);font-size:var(--tx-chart-gauge-tick-label-font-size);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-gauge__needle-body{fill:var(--tx-chart-gauge-needle-color)}:host([data-styled]) .tx-gauge__hub{fill:var(--tx-chart-gauge-hub-color);stroke:var(--tx-chart-gauge-needle-color);stroke-width:var(--tx-chart-gauge-hub-stroke-width)}:host([data-styled]) .tx-gauge__value{fill:var(--tx-chart-gauge-value-color);font-weight:var(--tx-chart-gauge-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-gauge__label{fill:var(--tx-chart-gauge-label-color);font-weight:var(--tx-chart-gauge-label-font-weight)}:host([data-styled].tx-gauge--morph) .tx-gauge__progress{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-gauge--morph) .tx-gauge__needle{transition:transform var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-gauge--entering) .tx-gauge__progress{stroke-dasharray:1 1;animation:tx-gauge-draw var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}:host([data-styled].tx-gauge--entering) .tx-gauge__needle{animation:tx-gauge-swing var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}@keyframes tx-gauge-draw{0%{stroke-dashoffset:1}to{stroke-dashoffset:0}}@keyframes tx-gauge-swing{0%{transform:rotate(var(--tx-gauge-start))}to{transform:rotate(var(--tx-gauge-angle))}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-gauge__progress,:host([data-styled]) .tx-gauge__needle{transition:none;animation:none}}\n"],
|
|
438
|
+
dependencies: [{
|
|
439
|
+
kind: "component",
|
|
440
|
+
type: TxChartFrame,
|
|
441
|
+
selector: "tx-chart-frame",
|
|
442
|
+
inputs: [
|
|
443
|
+
"height",
|
|
444
|
+
"size",
|
|
445
|
+
"legendItems",
|
|
446
|
+
"showLegend",
|
|
447
|
+
"legendPosition",
|
|
448
|
+
"legendAlign",
|
|
449
|
+
"legendVariant",
|
|
450
|
+
"legendToggle",
|
|
451
|
+
"legendTemplate",
|
|
452
|
+
"empty",
|
|
453
|
+
"loading",
|
|
454
|
+
"emptyIcon",
|
|
455
|
+
"summary",
|
|
456
|
+
"table",
|
|
457
|
+
"tooltip",
|
|
458
|
+
"tooltipTemplate",
|
|
459
|
+
"tooltipPlacement",
|
|
460
|
+
"panelStyle",
|
|
461
|
+
"parts",
|
|
462
|
+
"styled",
|
|
463
|
+
"interactive",
|
|
464
|
+
"actionKeys",
|
|
465
|
+
"zoomable",
|
|
466
|
+
"zoomedIn",
|
|
467
|
+
"plotHeight",
|
|
468
|
+
"toolbar",
|
|
469
|
+
"exportName"
|
|
470
|
+
],
|
|
471
|
+
outputs: [
|
|
472
|
+
"sizeChange",
|
|
473
|
+
"pointer",
|
|
474
|
+
"navigate",
|
|
475
|
+
"legendToggled",
|
|
476
|
+
"legendHovered",
|
|
477
|
+
"tooltipClosed",
|
|
478
|
+
"zoomed",
|
|
479
|
+
"panned",
|
|
480
|
+
"zoomReset"
|
|
481
|
+
]
|
|
482
|
+
}],
|
|
483
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
487
|
+
minVersion: "12.0.0",
|
|
488
|
+
version: "22.2.3",
|
|
489
|
+
ngImport: i0,
|
|
490
|
+
type: TxGauge,
|
|
491
|
+
decorators: [{
|
|
492
|
+
type: Component,
|
|
493
|
+
args: [{
|
|
494
|
+
selector: "tx-gauge",
|
|
495
|
+
imports: [TxChartFrame],
|
|
496
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
497
|
+
host: {
|
|
498
|
+
class: "tx-gauge",
|
|
499
|
+
"[class]": "passThrough().root?.class",
|
|
500
|
+
"[style]": "hostStyle()",
|
|
501
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
502
|
+
"[attr.data-mode]": "hasNeedle() ? \"needle\" : \"progress\"",
|
|
503
|
+
"[class.tx-gauge--fill]": "typeof height() === \"string\"",
|
|
504
|
+
"[class.tx-gauge--entering]": "entrance.active()",
|
|
505
|
+
"[class.tx-gauge--morph]": "morph()"
|
|
506
|
+
},
|
|
507
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [interactive]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel() || label()\"\n emptyIcon=\"chart-pie\"\n [summary]=\"summary()\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n>\n <svg:path class=\"tx-gauge__track\" [class]=\"passThrough().track?.class\" [style]=\"passThrough().track?.style\" [attr.d]=\"track()\" [style.stroke-width.px]=\"width()\" />\n @for (band of bandArcs(); track band.key) {\n <svg:path\n class=\"tx-gauge__band\"\n [class]=\"passThrough().band?.class\"\n [style]=\"passThrough().band?.style\"\n [attr.d]=\"band.path\"\n [style.stroke]=\"band.color\"\n [style.stroke-width.px]=\"width()\"\n />\n }\n @if (progress()) {\n <svg:path\n class=\"tx-gauge__progress\"\n [class]=\"passThrough().progress?.class\"\n [style]=\"passThrough().progress?.style\"\n [attr.d]=\"progress()\"\n pathLength=\"1\"\n [style.stroke]=\"progressColor()\"\n [style.stroke-width.px]=\"width()\"\n />\n }\n @for (tick of tickMarks(); track tick.value) {\n <svg:g class=\"tx-gauge__tick\" [class]=\"passThrough().tick?.class\" [style]=\"passThrough().tick?.style\">\n <svg:line class=\"tx-gauge__tick-line\" [attr.x1]=\"tick.x1\" [attr.y1]=\"tick.y1\" [attr.x2]=\"tick.x2\" [attr.y2]=\"tick.y2\" />\n <svg:text class=\"tx-gauge__tick-label\" [attr.x]=\"tick.labelX\" [attr.y]=\"tick.labelY\" [attr.text-anchor]=\"tick.anchor\" dominant-baseline=\"middle\">{{ tick.label }}</svg:text>\n </svg:g>\n }\n @if (hasNeedle()) {\n <svg:g\n class=\"tx-gauge__needle\"\n [class]=\"passThrough().needle?.class\"\n [style]=\"passThrough().needle?.style\"\n [style.transform-origin]=\"fit().cx + 'px ' + fit().cy + 'px'\"\n [style.transform]=\"'rotate(' + needleRotation() + ')'\"\n [style.--tx-gauge-start]=\"startRotation()\"\n [style.--tx-gauge-angle]=\"needleRotation()\"\n >\n <svg:path class=\"tx-gauge__needle-body\" [attr.d]=\"needlePath()\" />\n <svg:circle class=\"tx-gauge__hub\" [attr.cx]=\"fit().cx\" [attr.cy]=\"fit().cy\" [attr.r]=\"geometry().hubRadius\" />\n </svg:g>\n }\n @if (showValue()) {\n <svg:text\n class=\"tx-gauge__value\"\n [class]=\"passThrough().value?.class\"\n [style]=\"passThrough().value?.style\"\n text-anchor=\"middle\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"valueY()\"\n [style.font-size.px]=\"valueFont().value\"\n >\n {{ formatted() }}\n </svg:text>\n @if (label()) {\n <svg:text\n class=\"tx-gauge__label\"\n [class]=\"passThrough().label?.class\"\n [style]=\"passThrough().label?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"hanging\"\n [attr.x]=\"fit().cx\"\n [attr.y]=\"valueY() + 6\"\n [style.font-size.px]=\"valueFont().label\"\n >\n {{ label() }}\n </svg:text>\n }\n }\n</tx-chart-frame>\n",
|
|
508
|
+
styles: [":host{display:block;min-width:0}:host(.tx-gauge--fill){height:100%}.tx-gauge__track,.tx-gauge__band,.tx-gauge__progress{fill:none}.tx-gauge__track{stroke:currentColor;stroke-opacity:.12;stroke-linecap:round}.tx-gauge__progress{stroke-linecap:round}:host([data-mode=needle]) .tx-gauge__track{stroke-linecap:butt}.tx-gauge__tick-line{stroke:currentColor}.tx-gauge__needle{transform-box:view-box}.tx-gauge__needle-body,.tx-gauge__hub{fill:currentColor}:host([data-styled]) .tx-gauge__track{stroke:var(--tx-chart-gauge-track-color);stroke-opacity:1}:host([data-styled]) .tx-gauge__tick-line{stroke:var(--tx-chart-gauge-tick-color)}:host([data-styled]) .tx-gauge__tick-label{fill:var(--tx-chart-gauge-tick-label-color);font-size:var(--tx-chart-gauge-tick-label-font-size);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-gauge__needle-body{fill:var(--tx-chart-gauge-needle-color)}:host([data-styled]) .tx-gauge__hub{fill:var(--tx-chart-gauge-hub-color);stroke:var(--tx-chart-gauge-needle-color);stroke-width:var(--tx-chart-gauge-hub-stroke-width)}:host([data-styled]) .tx-gauge__value{fill:var(--tx-chart-gauge-value-color);font-weight:var(--tx-chart-gauge-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-gauge__label{fill:var(--tx-chart-gauge-label-color);font-weight:var(--tx-chart-gauge-label-font-weight)}:host([data-styled].tx-gauge--morph) .tx-gauge__progress{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-gauge--morph) .tx-gauge__needle{transition:transform var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-gauge--entering) .tx-gauge__progress{stroke-dasharray:1 1;animation:tx-gauge-draw var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}:host([data-styled].tx-gauge--entering) .tx-gauge__needle{animation:tx-gauge-swing var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both}@keyframes tx-gauge-draw{0%{stroke-dashoffset:1}to{stroke-dashoffset:0}}@keyframes tx-gauge-swing{0%{transform:rotate(var(--tx-gauge-start))}to{transform:rotate(var(--tx-gauge-angle))}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-gauge__progress,:host([data-styled]) .tx-gauge__needle{transition:none;animation:none}}\n"]
|
|
509
|
+
}]
|
|
510
|
+
}],
|
|
511
|
+
ctorParameters: () => [],
|
|
512
|
+
propDecorators: {
|
|
513
|
+
value: [{
|
|
514
|
+
type: i0.Input,
|
|
515
|
+
args: [{
|
|
516
|
+
isSignal: true,
|
|
517
|
+
alias: "value",
|
|
518
|
+
required: false
|
|
519
|
+
}]
|
|
520
|
+
}],
|
|
521
|
+
min: [{
|
|
522
|
+
type: i0.Input,
|
|
523
|
+
args: [{
|
|
524
|
+
isSignal: true,
|
|
525
|
+
alias: "min",
|
|
526
|
+
required: false
|
|
527
|
+
}]
|
|
528
|
+
}],
|
|
529
|
+
max: [{
|
|
530
|
+
type: i0.Input,
|
|
531
|
+
args: [{
|
|
532
|
+
isSignal: true,
|
|
533
|
+
alias: "max",
|
|
534
|
+
required: false
|
|
535
|
+
}]
|
|
536
|
+
}],
|
|
537
|
+
bands: [{
|
|
538
|
+
type: i0.Input,
|
|
539
|
+
args: [{
|
|
540
|
+
isSignal: true,
|
|
541
|
+
alias: "bands",
|
|
542
|
+
required: false
|
|
543
|
+
}]
|
|
544
|
+
}],
|
|
545
|
+
needle: [{
|
|
546
|
+
type: i0.Input,
|
|
547
|
+
args: [{
|
|
548
|
+
isSignal: true,
|
|
549
|
+
alias: "needle",
|
|
550
|
+
required: false
|
|
551
|
+
}]
|
|
552
|
+
}],
|
|
553
|
+
tone: [{
|
|
554
|
+
type: i0.Input,
|
|
555
|
+
args: [{
|
|
556
|
+
isSignal: true,
|
|
557
|
+
alias: "tone",
|
|
558
|
+
required: false
|
|
559
|
+
}]
|
|
560
|
+
}],
|
|
561
|
+
color: [{
|
|
562
|
+
type: i0.Input,
|
|
563
|
+
args: [{
|
|
564
|
+
isSignal: true,
|
|
565
|
+
alias: "color",
|
|
566
|
+
required: false
|
|
567
|
+
}]
|
|
568
|
+
}],
|
|
569
|
+
startAngle: [{
|
|
570
|
+
type: i0.Input,
|
|
571
|
+
args: [{
|
|
572
|
+
isSignal: true,
|
|
573
|
+
alias: "startAngle",
|
|
574
|
+
required: false
|
|
575
|
+
}]
|
|
576
|
+
}],
|
|
577
|
+
endAngle: [{
|
|
578
|
+
type: i0.Input,
|
|
579
|
+
args: [{
|
|
580
|
+
isSignal: true,
|
|
581
|
+
alias: "endAngle",
|
|
582
|
+
required: false
|
|
583
|
+
}]
|
|
584
|
+
}],
|
|
585
|
+
label: [{
|
|
586
|
+
type: i0.Input,
|
|
587
|
+
args: [{
|
|
588
|
+
isSignal: true,
|
|
589
|
+
alias: "label",
|
|
590
|
+
required: false
|
|
591
|
+
}]
|
|
592
|
+
}],
|
|
593
|
+
valueFormat: [{
|
|
594
|
+
type: i0.Input,
|
|
595
|
+
args: [{
|
|
596
|
+
isSignal: true,
|
|
597
|
+
alias: "valueFormat",
|
|
598
|
+
required: false
|
|
599
|
+
}]
|
|
600
|
+
}],
|
|
601
|
+
ticks: [{
|
|
602
|
+
type: i0.Input,
|
|
603
|
+
args: [{
|
|
604
|
+
isSignal: true,
|
|
605
|
+
alias: "ticks",
|
|
606
|
+
required: false
|
|
607
|
+
}]
|
|
608
|
+
}],
|
|
609
|
+
showTicks: [{
|
|
610
|
+
type: i0.Input,
|
|
611
|
+
args: [{
|
|
612
|
+
isSignal: true,
|
|
613
|
+
alias: "showTicks",
|
|
614
|
+
required: false
|
|
615
|
+
}]
|
|
616
|
+
}],
|
|
617
|
+
showValue: [{
|
|
618
|
+
type: i0.Input,
|
|
619
|
+
args: [{
|
|
620
|
+
isSignal: true,
|
|
621
|
+
alias: "showValue",
|
|
622
|
+
required: false
|
|
623
|
+
}]
|
|
624
|
+
}],
|
|
625
|
+
height: [{
|
|
626
|
+
type: i0.Input,
|
|
627
|
+
args: [{
|
|
628
|
+
isSignal: true,
|
|
629
|
+
alias: "height",
|
|
630
|
+
required: false
|
|
631
|
+
}]
|
|
632
|
+
}],
|
|
633
|
+
toolbar: [{
|
|
634
|
+
type: i0.Input,
|
|
635
|
+
args: [{
|
|
636
|
+
isSignal: true,
|
|
637
|
+
alias: "toolbar",
|
|
638
|
+
required: false
|
|
639
|
+
}]
|
|
640
|
+
}],
|
|
641
|
+
loading: [{
|
|
642
|
+
type: i0.Input,
|
|
643
|
+
args: [{
|
|
644
|
+
isSignal: true,
|
|
645
|
+
alias: "loading",
|
|
646
|
+
required: false
|
|
647
|
+
}]
|
|
648
|
+
}],
|
|
649
|
+
ariaLabel: [{
|
|
650
|
+
type: i0.Input,
|
|
651
|
+
args: [{
|
|
652
|
+
isSignal: true,
|
|
653
|
+
alias: "ariaLabel",
|
|
654
|
+
required: false
|
|
655
|
+
}]
|
|
656
|
+
}],
|
|
657
|
+
dt: [{
|
|
658
|
+
type: i0.Input,
|
|
659
|
+
args: [{
|
|
660
|
+
isSignal: true,
|
|
661
|
+
alias: "dt",
|
|
662
|
+
required: false
|
|
663
|
+
}]
|
|
664
|
+
}],
|
|
665
|
+
pt: [{
|
|
666
|
+
type: i0.Input,
|
|
667
|
+
args: [{
|
|
668
|
+
isSignal: true,
|
|
669
|
+
alias: "pt",
|
|
670
|
+
required: false
|
|
671
|
+
}]
|
|
672
|
+
}],
|
|
673
|
+
ptOptions: [{
|
|
674
|
+
type: i0.Input,
|
|
675
|
+
args: [{
|
|
676
|
+
isSignal: true,
|
|
677
|
+
alias: "ptOptions",
|
|
678
|
+
required: false
|
|
679
|
+
}]
|
|
680
|
+
}],
|
|
681
|
+
unstyled: [{
|
|
682
|
+
type: i0.Input,
|
|
683
|
+
args: [{
|
|
684
|
+
isSignal: true,
|
|
685
|
+
alias: "unstyled",
|
|
686
|
+
required: false
|
|
687
|
+
}]
|
|
688
|
+
}]
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
export { TxGauge, gaugeAngle, gaugeNeedle, gaugeRatio };
|
|
692
|
+
|
|
693
|
+
//# sourceMappingURL=tectra-ng-charts-gauge.mjs.map
|