@tectra-ng/charts 0.1.9 → 0.2.1
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,694 @@
|
|
|
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, TxChartTooltipTemplate, chartNumberFormatter, chartSummary, initialChartSize, injectChartEntrance, readTokenNumber, seriesColor, stepIndex, textWidth, truncateText } 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 funnelBoxes(input) {
|
|
10
|
+
const count = input.values.length;
|
|
11
|
+
if (!count) return [];
|
|
12
|
+
const max = Math.max(0, ...input.values);
|
|
13
|
+
const row = input.height / (count + Math.max(0, count - 1) * input.gapRatio);
|
|
14
|
+
const step = row * (1 + input.gapRatio);
|
|
15
|
+
const center = input.left + input.width / 2;
|
|
16
|
+
return input.values.map((value, index) => {
|
|
17
|
+
const width = max > 0 ? Math.max(input.minWidth, Math.max(0, value) / max * input.width) : input.minWidth;
|
|
18
|
+
return {
|
|
19
|
+
index,
|
|
20
|
+
value,
|
|
21
|
+
x: round(center - width / 2),
|
|
22
|
+
y: round(input.top + index * step),
|
|
23
|
+
width: round(width),
|
|
24
|
+
height: round(row)
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function funnelConnectorPath(upper, lower) {
|
|
29
|
+
const top = upper.y + upper.height;
|
|
30
|
+
return `M${upper.x},${round(top)}L${round(upper.x + upper.width)},${round(top)}L${round(lower.x + lower.width)},${lower.y}L${lower.x},${lower.y}Z`;
|
|
31
|
+
}
|
|
32
|
+
function funnelRate(value, base) {
|
|
33
|
+
return base > 0 ? Math.max(0, value) / base * 100 : 0;
|
|
34
|
+
}
|
|
35
|
+
function funnelIndexAt(boxes, y) {
|
|
36
|
+
if (!boxes.length) return -1;
|
|
37
|
+
const first = boxes[0];
|
|
38
|
+
const last = boxes[boxes.length - 1];
|
|
39
|
+
if (y < first.y || y > last.y + last.height) return -1;
|
|
40
|
+
const step = boxes.length > 1 ? boxes[1].y - first.y : first.height;
|
|
41
|
+
return Math.max(0, Math.min(boxes.length - 1, Math.floor((y - first.y + (step - first.height) / 2) / step)));
|
|
42
|
+
}
|
|
43
|
+
const DEFAULTS = {
|
|
44
|
+
gap: .32,
|
|
45
|
+
labelWidth: .3,
|
|
46
|
+
labelFontSize: 12.25,
|
|
47
|
+
valueFontSize: 12,
|
|
48
|
+
conversionFontSize: 11
|
|
49
|
+
};
|
|
50
|
+
const PADDING = 4;
|
|
51
|
+
const LABEL_PAD = 12;
|
|
52
|
+
const MIN_WIDTH = 4;
|
|
53
|
+
var TxFunnelChart = class TxFunnelChart {
|
|
54
|
+
locale = inject(TxLocaleService);
|
|
55
|
+
host = inject(ElementRef);
|
|
56
|
+
translations = injectTranslations();
|
|
57
|
+
items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
58
|
+
height = input(320, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
59
|
+
colorful = input(false, {
|
|
60
|
+
...ngDevMode ? { debugName: "colorful" } : /* istanbul ignore next */ {},
|
|
61
|
+
transform: booleanAttribute
|
|
62
|
+
});
|
|
63
|
+
showLabels = input(true, {
|
|
64
|
+
...ngDevMode ? { debugName: "showLabels" } : /* istanbul ignore next */ {},
|
|
65
|
+
transform: booleanAttribute
|
|
66
|
+
});
|
|
67
|
+
showValues = input(true, {
|
|
68
|
+
...ngDevMode ? { debugName: "showValues" } : /* istanbul ignore next */ {},
|
|
69
|
+
transform: booleanAttribute
|
|
70
|
+
});
|
|
71
|
+
showConversion = input(true, {
|
|
72
|
+
...ngDevMode ? { debugName: "showConversion" } : /* istanbul ignore next */ {},
|
|
73
|
+
transform: booleanAttribute
|
|
74
|
+
});
|
|
75
|
+
connectors = input(true, {
|
|
76
|
+
...ngDevMode ? { debugName: "connectors" } : /* istanbul ignore next */ {},
|
|
77
|
+
transform: booleanAttribute
|
|
78
|
+
});
|
|
79
|
+
showTooltip = input(true, {
|
|
80
|
+
...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
|
|
81
|
+
transform: booleanAttribute
|
|
82
|
+
});
|
|
83
|
+
valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
84
|
+
toolbar = input(true, {
|
|
85
|
+
...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
|
|
86
|
+
transform: booleanAttribute
|
|
87
|
+
});
|
|
88
|
+
loading = input(false, {
|
|
89
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
90
|
+
transform: booleanAttribute
|
|
91
|
+
});
|
|
92
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
93
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
94
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
95
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
96
|
+
unstyled = input(void 0, {
|
|
97
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
98
|
+
transform: optionalBoolean
|
|
99
|
+
});
|
|
100
|
+
stageClick = output();
|
|
101
|
+
tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
|
|
102
|
+
frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
|
|
103
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
104
|
+
passThrough = injectPassThrough("funnelChart", this, this.pt, this.ptOptions);
|
|
105
|
+
tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
|
|
106
|
+
hostStyle = computed(() => ({
|
|
107
|
+
...this.tokenStyle(),
|
|
108
|
+
...this.passThrough().root?.style
|
|
109
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
110
|
+
entrance = injectChartEntrance();
|
|
111
|
+
morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
|
|
112
|
+
active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
113
|
+
geometry = signal(DEFAULTS, ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
|
|
114
|
+
intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
|
|
115
|
+
list = computed(() => this.items() ?? [], ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
|
|
116
|
+
values = computed(() => this.list().map((item) => item.value !== null && Number.isFinite(item.value) ? Math.max(0, item.value) : 0), ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
|
|
117
|
+
isEmpty = computed(() => !this.values().some((value) => value > 0), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
118
|
+
size = linkedSignal(() => initialChartSize(this.height(), null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
119
|
+
valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
|
|
120
|
+
percentFormatter = computed(() => chartNumberFormatter(this.intl(), "percent"), ...ngDevMode ? [{ debugName: "percentFormatter" }] : /* istanbul ignore next */ []);
|
|
121
|
+
labelColumn = computed(() => {
|
|
122
|
+
if (!this.showLabels()) return 0;
|
|
123
|
+
const { labelWidth, labelFontSize } = this.geometry();
|
|
124
|
+
const widest = Math.max(0, ...this.list().map((item) => textWidth(item.label, labelFontSize)));
|
|
125
|
+
return Math.min(this.size().width * labelWidth, widest + LABEL_PAD);
|
|
126
|
+
}, ...ngDevMode ? [{ debugName: "labelColumn" }] : /* istanbul ignore next */ []);
|
|
127
|
+
stages = computed(() => {
|
|
128
|
+
const { width, height } = this.size();
|
|
129
|
+
const column = this.labelColumn();
|
|
130
|
+
const values = this.values();
|
|
131
|
+
const first = values[0] ?? 0;
|
|
132
|
+
return funnelBoxes({
|
|
133
|
+
values,
|
|
134
|
+
left: column,
|
|
135
|
+
width: Math.max(1, width - column - PADDING),
|
|
136
|
+
top: PADDING,
|
|
137
|
+
height: Math.max(1, height - 8),
|
|
138
|
+
gapRatio: this.geometry().gap,
|
|
139
|
+
minWidth: MIN_WIDTH
|
|
140
|
+
}).map((box, index) => ({
|
|
141
|
+
...box,
|
|
142
|
+
key: `${index}:${this.list()[index].label}`,
|
|
143
|
+
label: this.list()[index].label,
|
|
144
|
+
ofFirst: funnelRate(box.value, first),
|
|
145
|
+
conversion: index ? funnelRate(box.value, values[index - 1]) : null,
|
|
146
|
+
color: this.colorful() ? seriesColor(this.list()[index].color, index) : this.list()[index].color ?? seriesColor(void 0, 0)
|
|
147
|
+
}));
|
|
148
|
+
}, ...ngDevMode ? [{ debugName: "stages" }] : /* istanbul ignore next */ []);
|
|
149
|
+
connectorShapes = computed(() => {
|
|
150
|
+
const stages = this.stages();
|
|
151
|
+
return stages.slice(1).map((stage, index) => {
|
|
152
|
+
const upper = stages[index];
|
|
153
|
+
return {
|
|
154
|
+
key: `${upper.key}>${stage.key}`,
|
|
155
|
+
index: stage.index,
|
|
156
|
+
path: funnelConnectorPath(upper, stage),
|
|
157
|
+
color: upper.color,
|
|
158
|
+
textX: upper.x + upper.width / 2,
|
|
159
|
+
textY: (upper.y + upper.height + stage.y) / 2,
|
|
160
|
+
conversion: stage.conversion ?? 0
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}, ...ngDevMode ? [{ debugName: "connectorShapes" }] : /* istanbul ignore next */ []);
|
|
164
|
+
gapHeight = computed(() => {
|
|
165
|
+
const stages = this.stages();
|
|
166
|
+
return stages.length > 1 ? stages[1].y - stages[0].y - stages[0].height : 0;
|
|
167
|
+
}, ...ngDevMode ? [{ debugName: "gapHeight" }] : /* istanbul ignore next */ []);
|
|
168
|
+
labels = computed(() => {
|
|
169
|
+
const column = this.labelColumn();
|
|
170
|
+
const { labelFontSize, valueFontSize } = this.geometry();
|
|
171
|
+
return this.stages().map((stage) => {
|
|
172
|
+
const value = this.valueFormatter()(stage.value);
|
|
173
|
+
const inside = stage.width >= textWidth(value, valueFontSize) + 12;
|
|
174
|
+
return {
|
|
175
|
+
key: stage.key,
|
|
176
|
+
index: stage.index,
|
|
177
|
+
label: truncateText(stage.label, Math.max(0, column - LABEL_PAD), labelFontSize),
|
|
178
|
+
full: stage.label,
|
|
179
|
+
labelX: 0,
|
|
180
|
+
y: stage.y + stage.height / 2,
|
|
181
|
+
value,
|
|
182
|
+
valueX: inside ? stage.x + stage.width / 2 : stage.x + stage.width + 6,
|
|
183
|
+
inside
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
187
|
+
formatPercent = computed(() => {
|
|
188
|
+
const format = this.percentFormatter();
|
|
189
|
+
return (value) => format(Number(value.toFixed(1)));
|
|
190
|
+
}, ...ngDevMode ? [{ debugName: "formatPercent" }] : /* istanbul ignore next */ []);
|
|
191
|
+
tooltip = computed(() => {
|
|
192
|
+
const index = this.active();
|
|
193
|
+
if (index === null || !this.showTooltip()) return null;
|
|
194
|
+
const stage = this.stages()[index];
|
|
195
|
+
if (!stage) return null;
|
|
196
|
+
const t = this.translations();
|
|
197
|
+
const percent = this.formatPercent();
|
|
198
|
+
return {
|
|
199
|
+
title: "",
|
|
200
|
+
rows: [
|
|
201
|
+
{
|
|
202
|
+
label: stage.label,
|
|
203
|
+
value: this.valueFormatter()(stage.value),
|
|
204
|
+
color: stage.color,
|
|
205
|
+
raw: stage.value,
|
|
206
|
+
seriesIndex: 0,
|
|
207
|
+
active: true
|
|
208
|
+
},
|
|
209
|
+
...index ? [{
|
|
210
|
+
label: t.chartOfFirst,
|
|
211
|
+
value: percent(stage.ofFirst),
|
|
212
|
+
color: "transparent",
|
|
213
|
+
raw: stage.ofFirst,
|
|
214
|
+
seriesIndex: 1
|
|
215
|
+
}] : [],
|
|
216
|
+
...stage.conversion !== null ? [{
|
|
217
|
+
label: t.chartConversion,
|
|
218
|
+
value: percent(stage.conversion),
|
|
219
|
+
color: "transparent",
|
|
220
|
+
raw: stage.conversion,
|
|
221
|
+
seriesIndex: 2
|
|
222
|
+
}] : []
|
|
223
|
+
],
|
|
224
|
+
index,
|
|
225
|
+
x: stage.x + stage.width / 2,
|
|
226
|
+
y: stage.y,
|
|
227
|
+
placement: "top"
|
|
228
|
+
};
|
|
229
|
+
}, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
230
|
+
summary = computed(() => {
|
|
231
|
+
const t = this.translations();
|
|
232
|
+
const stages = this.stages();
|
|
233
|
+
const last = stages[stages.length - 1];
|
|
234
|
+
const text = chartSummary(t, this.intl(), t.chartFunnel, 1, stages.length, null);
|
|
235
|
+
const rate = last && stages.length > 1 ? `, ${t.chartConversion.toLocaleLowerCase(this.intl())} ${this.formatPercent()(last.ofFirst)}` : "";
|
|
236
|
+
return this.ariaLabel() ? `${this.ariaLabel()}. ${text}${rate}` : `${text}${rate}`;
|
|
237
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
238
|
+
dataTable = computed(() => {
|
|
239
|
+
const t = this.translations();
|
|
240
|
+
const percent = this.formatPercent();
|
|
241
|
+
return {
|
|
242
|
+
columns: [
|
|
243
|
+
{
|
|
244
|
+
key: "value",
|
|
245
|
+
label: t.chartValue
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "first",
|
|
249
|
+
label: t.chartOfFirst
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
key: "conversion",
|
|
253
|
+
label: t.chartConversion
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
rows: this.stages().map((stage) => ({
|
|
257
|
+
label: stage.label,
|
|
258
|
+
cells: [
|
|
259
|
+
this.valueFormatter()(stage.value),
|
|
260
|
+
percent(stage.ofFirst),
|
|
261
|
+
stage.conversion === null ? "—" : percent(stage.conversion)
|
|
262
|
+
]
|
|
263
|
+
}))
|
|
264
|
+
};
|
|
265
|
+
}, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
|
|
266
|
+
constructor() {
|
|
267
|
+
afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
|
|
268
|
+
afterRenderEffect(() => {
|
|
269
|
+
this.dt();
|
|
270
|
+
this.readGeometry();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
onPointer(event) {
|
|
274
|
+
if (event.type === "leave") {
|
|
275
|
+
this.active.set(null);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const index = funnelIndexAt(this.stages(), event.y);
|
|
279
|
+
this.active.set(index >= 0 ? index : null);
|
|
280
|
+
if (event.type === "click" && index >= 0) {
|
|
281
|
+
const stage = this.stages()[index];
|
|
282
|
+
this.stageClick.emit({
|
|
283
|
+
index,
|
|
284
|
+
label: stage.label,
|
|
285
|
+
value: stage.value,
|
|
286
|
+
ofFirst: stage.ofFirst,
|
|
287
|
+
conversion: stage.conversion
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
onNavigate(event) {
|
|
292
|
+
if (event.key === "Escape") {
|
|
293
|
+
this.active.set(null);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const key = event.key === "ArrowDown" ? "ArrowRight" : event.key === "ArrowUp" ? "ArrowLeft" : event.key;
|
|
297
|
+
const index = stepIndex(key, this.active() ?? -1, this.stages().length);
|
|
298
|
+
if (index < 0) return;
|
|
299
|
+
this.active.set(index);
|
|
300
|
+
const stage = this.stages()[index];
|
|
301
|
+
const t = this.translations();
|
|
302
|
+
const conversion = stage.conversion === null ? "" : `, ${t.chartConversion.toLocaleLowerCase(this.intl())} ${this.formatPercent()(stage.conversion)}`;
|
|
303
|
+
this.frame()?.announce(`${stage.label}: ${this.valueFormatter()(stage.value)}${conversion}`);
|
|
304
|
+
}
|
|
305
|
+
readGeometry() {
|
|
306
|
+
const element = this.host.nativeElement;
|
|
307
|
+
const next = {
|
|
308
|
+
gap: readTokenNumber(element, "--tx-chart-funnel-row-gap", DEFAULTS.gap),
|
|
309
|
+
labelWidth: readTokenNumber(element, "--tx-chart-funnel-label-width", DEFAULTS.labelWidth),
|
|
310
|
+
labelFontSize: readTokenNumber(element, "--tx-chart-funnel-label-font-size", DEFAULTS.labelFontSize),
|
|
311
|
+
valueFontSize: readTokenNumber(element, "--tx-chart-funnel-value-font-size", DEFAULTS.valueFontSize),
|
|
312
|
+
conversionFontSize: readTokenNumber(element, "--tx-chart-funnel-conversion-font-size", DEFAULTS.conversionFontSize)
|
|
313
|
+
};
|
|
314
|
+
const current = this.geometry();
|
|
315
|
+
if (Object.keys(next).some((key) => next[key] !== current[key])) this.geometry.set(next);
|
|
316
|
+
}
|
|
317
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
318
|
+
minVersion: "12.0.0",
|
|
319
|
+
version: "22.2.3",
|
|
320
|
+
ngImport: i0,
|
|
321
|
+
type: TxFunnelChart,
|
|
322
|
+
deps: [],
|
|
323
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
324
|
+
});
|
|
325
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
326
|
+
minVersion: "17.0.0",
|
|
327
|
+
version: "22.2.3",
|
|
328
|
+
type: TxFunnelChart,
|
|
329
|
+
isStandalone: true,
|
|
330
|
+
selector: "tx-funnel-chart",
|
|
331
|
+
inputs: {
|
|
332
|
+
items: {
|
|
333
|
+
classPropertyName: "items",
|
|
334
|
+
publicName: "items",
|
|
335
|
+
isSignal: true,
|
|
336
|
+
isRequired: false,
|
|
337
|
+
transformFunction: null
|
|
338
|
+
},
|
|
339
|
+
height: {
|
|
340
|
+
classPropertyName: "height",
|
|
341
|
+
publicName: "height",
|
|
342
|
+
isSignal: true,
|
|
343
|
+
isRequired: false,
|
|
344
|
+
transformFunction: null
|
|
345
|
+
},
|
|
346
|
+
colorful: {
|
|
347
|
+
classPropertyName: "colorful",
|
|
348
|
+
publicName: "colorful",
|
|
349
|
+
isSignal: true,
|
|
350
|
+
isRequired: false,
|
|
351
|
+
transformFunction: null
|
|
352
|
+
},
|
|
353
|
+
showLabels: {
|
|
354
|
+
classPropertyName: "showLabels",
|
|
355
|
+
publicName: "showLabels",
|
|
356
|
+
isSignal: true,
|
|
357
|
+
isRequired: false,
|
|
358
|
+
transformFunction: null
|
|
359
|
+
},
|
|
360
|
+
showValues: {
|
|
361
|
+
classPropertyName: "showValues",
|
|
362
|
+
publicName: "showValues",
|
|
363
|
+
isSignal: true,
|
|
364
|
+
isRequired: false,
|
|
365
|
+
transformFunction: null
|
|
366
|
+
},
|
|
367
|
+
showConversion: {
|
|
368
|
+
classPropertyName: "showConversion",
|
|
369
|
+
publicName: "showConversion",
|
|
370
|
+
isSignal: true,
|
|
371
|
+
isRequired: false,
|
|
372
|
+
transformFunction: null
|
|
373
|
+
},
|
|
374
|
+
connectors: {
|
|
375
|
+
classPropertyName: "connectors",
|
|
376
|
+
publicName: "connectors",
|
|
377
|
+
isSignal: true,
|
|
378
|
+
isRequired: false,
|
|
379
|
+
transformFunction: null
|
|
380
|
+
},
|
|
381
|
+
showTooltip: {
|
|
382
|
+
classPropertyName: "showTooltip",
|
|
383
|
+
publicName: "showTooltip",
|
|
384
|
+
isSignal: true,
|
|
385
|
+
isRequired: false,
|
|
386
|
+
transformFunction: null
|
|
387
|
+
},
|
|
388
|
+
valueFormat: {
|
|
389
|
+
classPropertyName: "valueFormat",
|
|
390
|
+
publicName: "valueFormat",
|
|
391
|
+
isSignal: true,
|
|
392
|
+
isRequired: false,
|
|
393
|
+
transformFunction: null
|
|
394
|
+
},
|
|
395
|
+
toolbar: {
|
|
396
|
+
classPropertyName: "toolbar",
|
|
397
|
+
publicName: "toolbar",
|
|
398
|
+
isSignal: true,
|
|
399
|
+
isRequired: false,
|
|
400
|
+
transformFunction: null
|
|
401
|
+
},
|
|
402
|
+
loading: {
|
|
403
|
+
classPropertyName: "loading",
|
|
404
|
+
publicName: "loading",
|
|
405
|
+
isSignal: true,
|
|
406
|
+
isRequired: false,
|
|
407
|
+
transformFunction: null
|
|
408
|
+
},
|
|
409
|
+
ariaLabel: {
|
|
410
|
+
classPropertyName: "ariaLabel",
|
|
411
|
+
publicName: "ariaLabel",
|
|
412
|
+
isSignal: true,
|
|
413
|
+
isRequired: false,
|
|
414
|
+
transformFunction: null
|
|
415
|
+
},
|
|
416
|
+
dt: {
|
|
417
|
+
classPropertyName: "dt",
|
|
418
|
+
publicName: "dt",
|
|
419
|
+
isSignal: true,
|
|
420
|
+
isRequired: false,
|
|
421
|
+
transformFunction: null
|
|
422
|
+
},
|
|
423
|
+
pt: {
|
|
424
|
+
classPropertyName: "pt",
|
|
425
|
+
publicName: "pt",
|
|
426
|
+
isSignal: true,
|
|
427
|
+
isRequired: false,
|
|
428
|
+
transformFunction: null
|
|
429
|
+
},
|
|
430
|
+
ptOptions: {
|
|
431
|
+
classPropertyName: "ptOptions",
|
|
432
|
+
publicName: "ptOptions",
|
|
433
|
+
isSignal: true,
|
|
434
|
+
isRequired: false,
|
|
435
|
+
transformFunction: null
|
|
436
|
+
},
|
|
437
|
+
unstyled: {
|
|
438
|
+
classPropertyName: "unstyled",
|
|
439
|
+
publicName: "unstyled",
|
|
440
|
+
isSignal: true,
|
|
441
|
+
isRequired: false,
|
|
442
|
+
transformFunction: null
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
outputs: { stageClick: "stageClick" },
|
|
446
|
+
host: {
|
|
447
|
+
properties: {
|
|
448
|
+
"class": "passThrough().root?.class",
|
|
449
|
+
"style": "hostStyle()",
|
|
450
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
451
|
+
"class.tx-funnel-chart--fill": "typeof height() === \"string\"",
|
|
452
|
+
"class.tx-funnel-chart--entering": "entrance.active()",
|
|
453
|
+
"class.tx-funnel-chart--morph": "morph()",
|
|
454
|
+
"class.tx-funnel-chart--active": "active() !== null"
|
|
455
|
+
},
|
|
456
|
+
classAttribute: "tx-funnel-chart"
|
|
457
|
+
},
|
|
458
|
+
queries: [{
|
|
459
|
+
propertyName: "tooltipTemplate",
|
|
460
|
+
first: true,
|
|
461
|
+
predicate: TxChartTooltipTemplate,
|
|
462
|
+
descendants: true,
|
|
463
|
+
isSignal: true
|
|
464
|
+
}],
|
|
465
|
+
viewQueries: [{
|
|
466
|
+
propertyName: "frame",
|
|
467
|
+
first: true,
|
|
468
|
+
predicate: TxChartFrame,
|
|
469
|
+
descendants: true,
|
|
470
|
+
isSignal: true
|
|
471
|
+
}],
|
|
472
|
+
ngImport: i0,
|
|
473
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-bar\"\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 (tooltipClosed)=\"active.set(null)\"\n>\n @if (connectors()) {\n @for (shape of connectorShapes(); track shape.key) {\n <svg:path\n class=\"tx-funnel-chart__connector\"\n [class]=\"passThrough().connector?.class\"\n [style]=\"passThrough().connector?.style\"\n [attr.d]=\"shape.path\"\n [style.fill]=\"shape.color\"\n />\n }\n }\n @for (stage of stages(); track stage.key) {\n <svg:rect\n class=\"tx-funnel-chart__stage\"\n [class.tx-funnel-chart__stage--active]=\"active() === stage.index\"\n [class]=\"passThrough().stage?.class\"\n [style]=\"passThrough().stage?.style\"\n [attr.data-index]=\"stage.index\"\n [attr.x]=\"stage.x\"\n [attr.y]=\"stage.y\"\n [attr.width]=\"stage.width\"\n [attr.height]=\"stage.height\"\n [style.fill]=\"stage.color\"\n [style.--tx-funnel-chart-order]=\"stage.index\"\n />\n }\n @if (showConversion() && gapHeight() >= geometry().conversionFontSize + 2) {\n @for (shape of connectorShapes(); track shape.key) {\n <svg:text\n class=\"tx-funnel-chart__conversion\"\n [class]=\"passThrough().conversion?.class\"\n [style]=\"passThrough().conversion?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [attr.x]=\"shape.textX\"\n [attr.y]=\"shape.textY\"\n >\n {{ formatPercent()(shape.conversion) }}\n </svg:text>\n }\n }\n @for (text of labels(); track text.key) {\n @if (showLabels()) {\n <svg:text\n class=\"tx-funnel-chart__label\"\n [class.tx-funnel-chart__label--active]=\"active() === text.index\"\n [class]=\"passThrough().label?.class\"\n [style]=\"passThrough().label?.style\"\n dominant-baseline=\"central\"\n [attr.x]=\"text.labelX\"\n [attr.y]=\"text.y\"\n >\n {{ text.label }}\n @if (text.label !== text.full) {\n <svg:title>{{ text.full }}</svg:title>\n }\n </svg:text>\n }\n @if (showValues()) {\n <svg:text\n class=\"tx-funnel-chart__value\"\n [class.tx-funnel-chart__value--outside]=\"!text.inside\"\n [class]=\"passThrough().value?.class\"\n [style]=\"passThrough().value?.style\"\n dominant-baseline=\"central\"\n [attr.text-anchor]=\"text.inside ? 'middle' : 'start'\"\n [attr.x]=\"text.valueX\"\n [attr.y]=\"text.y\"\n >\n {{ text.value }}\n </svg:text>\n }\n }\n</tx-chart-frame>\n",
|
|
474
|
+
styles: [":host{display:block;min-width:0}:host(.tx-funnel-chart--fill){height:100%}.tx-funnel-chart__stage{transform-box:fill-box;transform-origin:50% 50%}.tx-funnel-chart__connector{fill-opacity:.16}.tx-funnel-chart__connector,.tx-funnel-chart__label,.tx-funnel-chart__value,.tx-funnel-chart__conversion{pointer-events:none}:host([data-styled]) .tx-funnel-chart__stage{clip-path:inset(0 round var(--tx-chart-funnel-radius));transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-funnel-chart__connector{fill-opacity:var(--tx-chart-funnel-connector-opacity)}:host([data-styled]) .tx-funnel-chart__label{fill:var(--tx-chart-funnel-label-color);font-size:var(--tx-chart-funnel-label-font-size);font-weight:var(--tx-chart-funnel-label-font-weight)}:host([data-styled]) .tx-funnel-chart__value{fill:var(--tx-chart-funnel-value-color);font-size:var(--tx-chart-funnel-value-font-size);font-weight:var(--tx-chart-funnel-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-funnel-chart__value--outside{fill:var(--tx-chart-funnel-outside-value-color)}:host([data-styled]) .tx-funnel-chart__conversion{fill:var(--tx-chart-funnel-conversion-color);font-size:var(--tx-chart-funnel-conversion-font-size);font-variant-numeric:tabular-nums}:host([data-styled].tx-funnel-chart--active) .tx-funnel-chart__stage:not(.tx-funnel-chart__stage--active){opacity:var(--tx-chart-funnel-dimmed-opacity)}:host([data-styled].tx-funnel-chart--morph) .tx-funnel-chart__stage{transition:opacity var(--tx-chart-motion-hover-duration) ease,x var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),y var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),width var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),height var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-funnel-chart--morph) .tx-funnel-chart__connector{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__stage{animation:tx-funnel-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-funnel-chart-order, 0) * var(--tx-chart-motion-stagger) * 2)}:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__connector,:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__value,:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__conversion{animation:tx-funnel-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-funnel-chart-grow{0%{transform:scaleX(0)}to{transform:scaleX(1)}}@keyframes tx-funnel-chart-fade{0%,60%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-funnel-chart__stage,:host([data-styled]) .tx-funnel-chart__connector,:host([data-styled]) .tx-funnel-chart__value,:host([data-styled]) .tx-funnel-chart__conversion{transition:none;animation:none}}\n"],
|
|
475
|
+
dependencies: [{
|
|
476
|
+
kind: "component",
|
|
477
|
+
type: TxChartFrame,
|
|
478
|
+
selector: "tx-chart-frame",
|
|
479
|
+
inputs: [
|
|
480
|
+
"height",
|
|
481
|
+
"size",
|
|
482
|
+
"legendItems",
|
|
483
|
+
"showLegend",
|
|
484
|
+
"legendPosition",
|
|
485
|
+
"legendAlign",
|
|
486
|
+
"legendVariant",
|
|
487
|
+
"legendToggle",
|
|
488
|
+
"legendTemplate",
|
|
489
|
+
"empty",
|
|
490
|
+
"loading",
|
|
491
|
+
"emptyIcon",
|
|
492
|
+
"summary",
|
|
493
|
+
"table",
|
|
494
|
+
"tooltip",
|
|
495
|
+
"tooltipTemplate",
|
|
496
|
+
"tooltipPlacement",
|
|
497
|
+
"panelStyle",
|
|
498
|
+
"parts",
|
|
499
|
+
"styled",
|
|
500
|
+
"interactive",
|
|
501
|
+
"actionKeys",
|
|
502
|
+
"zoomable",
|
|
503
|
+
"zoomedIn",
|
|
504
|
+
"plotHeight",
|
|
505
|
+
"toolbar",
|
|
506
|
+
"exportName"
|
|
507
|
+
],
|
|
508
|
+
outputs: [
|
|
509
|
+
"sizeChange",
|
|
510
|
+
"pointer",
|
|
511
|
+
"navigate",
|
|
512
|
+
"legendToggled",
|
|
513
|
+
"legendHovered",
|
|
514
|
+
"tooltipClosed",
|
|
515
|
+
"zoomed",
|
|
516
|
+
"panned",
|
|
517
|
+
"zoomReset"
|
|
518
|
+
]
|
|
519
|
+
}],
|
|
520
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
524
|
+
minVersion: "12.0.0",
|
|
525
|
+
version: "22.2.3",
|
|
526
|
+
ngImport: i0,
|
|
527
|
+
type: TxFunnelChart,
|
|
528
|
+
decorators: [{
|
|
529
|
+
type: Component,
|
|
530
|
+
args: [{
|
|
531
|
+
selector: "tx-funnel-chart",
|
|
532
|
+
imports: [TxChartFrame],
|
|
533
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
534
|
+
host: {
|
|
535
|
+
class: "tx-funnel-chart",
|
|
536
|
+
"[class]": "passThrough().root?.class",
|
|
537
|
+
"[style]": "hostStyle()",
|
|
538
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
539
|
+
"[class.tx-funnel-chart--fill]": "typeof height() === \"string\"",
|
|
540
|
+
"[class.tx-funnel-chart--entering]": "entrance.active()",
|
|
541
|
+
"[class.tx-funnel-chart--morph]": "morph()",
|
|
542
|
+
"[class.tx-funnel-chart--active]": "active() !== null"
|
|
543
|
+
},
|
|
544
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-bar\"\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 (tooltipClosed)=\"active.set(null)\"\n>\n @if (connectors()) {\n @for (shape of connectorShapes(); track shape.key) {\n <svg:path\n class=\"tx-funnel-chart__connector\"\n [class]=\"passThrough().connector?.class\"\n [style]=\"passThrough().connector?.style\"\n [attr.d]=\"shape.path\"\n [style.fill]=\"shape.color\"\n />\n }\n }\n @for (stage of stages(); track stage.key) {\n <svg:rect\n class=\"tx-funnel-chart__stage\"\n [class.tx-funnel-chart__stage--active]=\"active() === stage.index\"\n [class]=\"passThrough().stage?.class\"\n [style]=\"passThrough().stage?.style\"\n [attr.data-index]=\"stage.index\"\n [attr.x]=\"stage.x\"\n [attr.y]=\"stage.y\"\n [attr.width]=\"stage.width\"\n [attr.height]=\"stage.height\"\n [style.fill]=\"stage.color\"\n [style.--tx-funnel-chart-order]=\"stage.index\"\n />\n }\n @if (showConversion() && gapHeight() >= geometry().conversionFontSize + 2) {\n @for (shape of connectorShapes(); track shape.key) {\n <svg:text\n class=\"tx-funnel-chart__conversion\"\n [class]=\"passThrough().conversion?.class\"\n [style]=\"passThrough().conversion?.style\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [attr.x]=\"shape.textX\"\n [attr.y]=\"shape.textY\"\n >\n {{ formatPercent()(shape.conversion) }}\n </svg:text>\n }\n }\n @for (text of labels(); track text.key) {\n @if (showLabels()) {\n <svg:text\n class=\"tx-funnel-chart__label\"\n [class.tx-funnel-chart__label--active]=\"active() === text.index\"\n [class]=\"passThrough().label?.class\"\n [style]=\"passThrough().label?.style\"\n dominant-baseline=\"central\"\n [attr.x]=\"text.labelX\"\n [attr.y]=\"text.y\"\n >\n {{ text.label }}\n @if (text.label !== text.full) {\n <svg:title>{{ text.full }}</svg:title>\n }\n </svg:text>\n }\n @if (showValues()) {\n <svg:text\n class=\"tx-funnel-chart__value\"\n [class.tx-funnel-chart__value--outside]=\"!text.inside\"\n [class]=\"passThrough().value?.class\"\n [style]=\"passThrough().value?.style\"\n dominant-baseline=\"central\"\n [attr.text-anchor]=\"text.inside ? 'middle' : 'start'\"\n [attr.x]=\"text.valueX\"\n [attr.y]=\"text.y\"\n >\n {{ text.value }}\n </svg:text>\n }\n }\n</tx-chart-frame>\n",
|
|
545
|
+
styles: [":host{display:block;min-width:0}:host(.tx-funnel-chart--fill){height:100%}.tx-funnel-chart__stage{transform-box:fill-box;transform-origin:50% 50%}.tx-funnel-chart__connector{fill-opacity:.16}.tx-funnel-chart__connector,.tx-funnel-chart__label,.tx-funnel-chart__value,.tx-funnel-chart__conversion{pointer-events:none}:host([data-styled]) .tx-funnel-chart__stage{clip-path:inset(0 round var(--tx-chart-funnel-radius));transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-funnel-chart__connector{fill-opacity:var(--tx-chart-funnel-connector-opacity)}:host([data-styled]) .tx-funnel-chart__label{fill:var(--tx-chart-funnel-label-color);font-size:var(--tx-chart-funnel-label-font-size);font-weight:var(--tx-chart-funnel-label-font-weight)}:host([data-styled]) .tx-funnel-chart__value{fill:var(--tx-chart-funnel-value-color);font-size:var(--tx-chart-funnel-value-font-size);font-weight:var(--tx-chart-funnel-value-font-weight);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-funnel-chart__value--outside{fill:var(--tx-chart-funnel-outside-value-color)}:host([data-styled]) .tx-funnel-chart__conversion{fill:var(--tx-chart-funnel-conversion-color);font-size:var(--tx-chart-funnel-conversion-font-size);font-variant-numeric:tabular-nums}:host([data-styled].tx-funnel-chart--active) .tx-funnel-chart__stage:not(.tx-funnel-chart__stage--active){opacity:var(--tx-chart-funnel-dimmed-opacity)}:host([data-styled].tx-funnel-chart--morph) .tx-funnel-chart__stage{transition:opacity var(--tx-chart-motion-hover-duration) ease,x var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),y var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),width var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing),height var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-funnel-chart--morph) .tx-funnel-chart__connector{transition:d var(--tx-chart-motion-update-duration) var(--tx-chart-motion-easing)}:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__stage{animation:tx-funnel-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-funnel-chart-order, 0) * var(--tx-chart-motion-stagger) * 2)}:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__connector,:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__value,:host([data-styled].tx-funnel-chart--entering) .tx-funnel-chart__conversion{animation:tx-funnel-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-funnel-chart-grow{0%{transform:scaleX(0)}to{transform:scaleX(1)}}@keyframes tx-funnel-chart-fade{0%,60%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-funnel-chart__stage,:host([data-styled]) .tx-funnel-chart__connector,:host([data-styled]) .tx-funnel-chart__value,:host([data-styled]) .tx-funnel-chart__conversion{transition:none;animation:none}}\n"]
|
|
546
|
+
}]
|
|
547
|
+
}],
|
|
548
|
+
ctorParameters: () => [],
|
|
549
|
+
propDecorators: {
|
|
550
|
+
items: [{
|
|
551
|
+
type: i0.Input,
|
|
552
|
+
args: [{
|
|
553
|
+
isSignal: true,
|
|
554
|
+
alias: "items",
|
|
555
|
+
required: false
|
|
556
|
+
}]
|
|
557
|
+
}],
|
|
558
|
+
height: [{
|
|
559
|
+
type: i0.Input,
|
|
560
|
+
args: [{
|
|
561
|
+
isSignal: true,
|
|
562
|
+
alias: "height",
|
|
563
|
+
required: false
|
|
564
|
+
}]
|
|
565
|
+
}],
|
|
566
|
+
colorful: [{
|
|
567
|
+
type: i0.Input,
|
|
568
|
+
args: [{
|
|
569
|
+
isSignal: true,
|
|
570
|
+
alias: "colorful",
|
|
571
|
+
required: false
|
|
572
|
+
}]
|
|
573
|
+
}],
|
|
574
|
+
showLabels: [{
|
|
575
|
+
type: i0.Input,
|
|
576
|
+
args: [{
|
|
577
|
+
isSignal: true,
|
|
578
|
+
alias: "showLabels",
|
|
579
|
+
required: false
|
|
580
|
+
}]
|
|
581
|
+
}],
|
|
582
|
+
showValues: [{
|
|
583
|
+
type: i0.Input,
|
|
584
|
+
args: [{
|
|
585
|
+
isSignal: true,
|
|
586
|
+
alias: "showValues",
|
|
587
|
+
required: false
|
|
588
|
+
}]
|
|
589
|
+
}],
|
|
590
|
+
showConversion: [{
|
|
591
|
+
type: i0.Input,
|
|
592
|
+
args: [{
|
|
593
|
+
isSignal: true,
|
|
594
|
+
alias: "showConversion",
|
|
595
|
+
required: false
|
|
596
|
+
}]
|
|
597
|
+
}],
|
|
598
|
+
connectors: [{
|
|
599
|
+
type: i0.Input,
|
|
600
|
+
args: [{
|
|
601
|
+
isSignal: true,
|
|
602
|
+
alias: "connectors",
|
|
603
|
+
required: false
|
|
604
|
+
}]
|
|
605
|
+
}],
|
|
606
|
+
showTooltip: [{
|
|
607
|
+
type: i0.Input,
|
|
608
|
+
args: [{
|
|
609
|
+
isSignal: true,
|
|
610
|
+
alias: "showTooltip",
|
|
611
|
+
required: false
|
|
612
|
+
}]
|
|
613
|
+
}],
|
|
614
|
+
valueFormat: [{
|
|
615
|
+
type: i0.Input,
|
|
616
|
+
args: [{
|
|
617
|
+
isSignal: true,
|
|
618
|
+
alias: "valueFormat",
|
|
619
|
+
required: false
|
|
620
|
+
}]
|
|
621
|
+
}],
|
|
622
|
+
toolbar: [{
|
|
623
|
+
type: i0.Input,
|
|
624
|
+
args: [{
|
|
625
|
+
isSignal: true,
|
|
626
|
+
alias: "toolbar",
|
|
627
|
+
required: false
|
|
628
|
+
}]
|
|
629
|
+
}],
|
|
630
|
+
loading: [{
|
|
631
|
+
type: i0.Input,
|
|
632
|
+
args: [{
|
|
633
|
+
isSignal: true,
|
|
634
|
+
alias: "loading",
|
|
635
|
+
required: false
|
|
636
|
+
}]
|
|
637
|
+
}],
|
|
638
|
+
ariaLabel: [{
|
|
639
|
+
type: i0.Input,
|
|
640
|
+
args: [{
|
|
641
|
+
isSignal: true,
|
|
642
|
+
alias: "ariaLabel",
|
|
643
|
+
required: false
|
|
644
|
+
}]
|
|
645
|
+
}],
|
|
646
|
+
dt: [{
|
|
647
|
+
type: i0.Input,
|
|
648
|
+
args: [{
|
|
649
|
+
isSignal: true,
|
|
650
|
+
alias: "dt",
|
|
651
|
+
required: false
|
|
652
|
+
}]
|
|
653
|
+
}],
|
|
654
|
+
pt: [{
|
|
655
|
+
type: i0.Input,
|
|
656
|
+
args: [{
|
|
657
|
+
isSignal: true,
|
|
658
|
+
alias: "pt",
|
|
659
|
+
required: false
|
|
660
|
+
}]
|
|
661
|
+
}],
|
|
662
|
+
ptOptions: [{
|
|
663
|
+
type: i0.Input,
|
|
664
|
+
args: [{
|
|
665
|
+
isSignal: true,
|
|
666
|
+
alias: "ptOptions",
|
|
667
|
+
required: false
|
|
668
|
+
}]
|
|
669
|
+
}],
|
|
670
|
+
unstyled: [{
|
|
671
|
+
type: i0.Input,
|
|
672
|
+
args: [{
|
|
673
|
+
isSignal: true,
|
|
674
|
+
alias: "unstyled",
|
|
675
|
+
required: false
|
|
676
|
+
}]
|
|
677
|
+
}],
|
|
678
|
+
stageClick: [{
|
|
679
|
+
type: i0.Output,
|
|
680
|
+
args: ["stageClick"]
|
|
681
|
+
}],
|
|
682
|
+
tooltipTemplate: [{
|
|
683
|
+
type: i0.ContentChild,
|
|
684
|
+
args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
|
|
685
|
+
}],
|
|
686
|
+
frame: [{
|
|
687
|
+
type: i0.ViewChild,
|
|
688
|
+
args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
|
|
689
|
+
}]
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
export { TxFunnelChart, funnelBoxes, funnelConnectorPath, funnelIndexAt, funnelRate };
|
|
693
|
+
|
|
694
|
+
//# sourceMappingURL=tectra-ng-charts-funnel.mjs.map
|