@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,887 @@
|
|
|
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 { TxChartAxes, TxChartFrame, TxChartHoverBand, TxChartLegendTemplate, TxChartTooltipTemplate, cartesianLayout, chartBandRect, chartNumberFormatter, chartSummary, cycleIndex, extent, initialChartSize, injectChartEntrance, readTokenNumber, seriesColor, stepIndex, 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
|
+
function quantile(sorted, p) {
|
|
9
|
+
if (!sorted.length) return NaN;
|
|
10
|
+
const at = (sorted.length - 1) * p;
|
|
11
|
+
const low = Math.floor(at);
|
|
12
|
+
const high = Math.ceil(at);
|
|
13
|
+
return sorted[low] + (sorted[high] - sorted[low]) * (at - low);
|
|
14
|
+
}
|
|
15
|
+
function boxStats(values) {
|
|
16
|
+
const sorted = values.filter((value) => Number.isFinite(value)).sort((a, b) => a - b);
|
|
17
|
+
if (!sorted.length) return null;
|
|
18
|
+
const q1 = quantile(sorted, .25);
|
|
19
|
+
const median = quantile(sorted, .5);
|
|
20
|
+
const q3 = quantile(sorted, .75);
|
|
21
|
+
const reach = (q3 - q1) * 1.5;
|
|
22
|
+
const inside = sorted.filter((value) => value >= q1 - reach && value <= q3 + reach);
|
|
23
|
+
return {
|
|
24
|
+
min: inside[0] ?? q1,
|
|
25
|
+
q1,
|
|
26
|
+
median,
|
|
27
|
+
q3,
|
|
28
|
+
max: inside[inside.length - 1] ?? q3,
|
|
29
|
+
outliers: sorted.filter((value) => value < q1 - reach || value > q3 + reach)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function toBoxStats(entry) {
|
|
33
|
+
if (!entry) return null;
|
|
34
|
+
if (Array.isArray(entry)) return boxStats(entry);
|
|
35
|
+
const stats = entry;
|
|
36
|
+
return [
|
|
37
|
+
stats.min,
|
|
38
|
+
stats.q1,
|
|
39
|
+
stats.median,
|
|
40
|
+
stats.q3,
|
|
41
|
+
stats.max
|
|
42
|
+
].every((value) => Number.isFinite(value)) ? stats : null;
|
|
43
|
+
}
|
|
44
|
+
const DEFAULTS = {
|
|
45
|
+
boxWidth: .5,
|
|
46
|
+
groupGap: 6,
|
|
47
|
+
whiskerWidth: .5
|
|
48
|
+
};
|
|
49
|
+
const EDGE_SLACK = 8;
|
|
50
|
+
var TxBoxplotChart = class TxBoxplotChart {
|
|
51
|
+
locale = inject(TxLocaleService);
|
|
52
|
+
host = inject(ElementRef);
|
|
53
|
+
translations = injectTranslations();
|
|
54
|
+
series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
|
|
55
|
+
categories = input([], ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
|
|
56
|
+
height = input(350, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
57
|
+
showOutliers = input(true, {
|
|
58
|
+
...ngDevMode ? { debugName: "showOutliers" } : /* istanbul ignore next */ {},
|
|
59
|
+
transform: booleanAttribute
|
|
60
|
+
});
|
|
61
|
+
showLegend = input(true, {
|
|
62
|
+
...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
|
|
63
|
+
transform: booleanAttribute
|
|
64
|
+
});
|
|
65
|
+
legendPosition = input("top", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
|
|
66
|
+
legendAlign = input("start", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
|
|
67
|
+
showTooltip = input(true, {
|
|
68
|
+
...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
|
|
69
|
+
transform: booleanAttribute
|
|
70
|
+
});
|
|
71
|
+
valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
72
|
+
yMin = input(void 0, ...ngDevMode ? [{ debugName: "yMin" }] : /* istanbul ignore next */ []);
|
|
73
|
+
yMax = input(void 0, ...ngDevMode ? [{ debugName: "yMax" }] : /* istanbul ignore next */ []);
|
|
74
|
+
xAxisTitle = input("", ...ngDevMode ? [{ debugName: "xAxisTitle" }] : /* istanbul ignore next */ []);
|
|
75
|
+
yAxisTitle = input("", ...ngDevMode ? [{ debugName: "yAxisTitle" }] : /* istanbul ignore next */ []);
|
|
76
|
+
grid = input("value", ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
|
|
77
|
+
labelMode = input("auto", ...ngDevMode ? [{ debugName: "labelMode" }] : /* istanbul ignore next */ []);
|
|
78
|
+
toolbar = input(true, {
|
|
79
|
+
...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
|
|
80
|
+
transform: booleanAttribute
|
|
81
|
+
});
|
|
82
|
+
loading = input(false, {
|
|
83
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
84
|
+
transform: booleanAttribute
|
|
85
|
+
});
|
|
86
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
87
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
88
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
89
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
90
|
+
unstyled = input(void 0, {
|
|
91
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
92
|
+
transform: optionalBoolean
|
|
93
|
+
});
|
|
94
|
+
boxClick = output();
|
|
95
|
+
seriesToggle = output();
|
|
96
|
+
legendTemplate = contentChild(TxChartLegendTemplate, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
|
|
97
|
+
tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
|
|
98
|
+
frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
|
|
99
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
100
|
+
passThrough = injectPassThrough("boxplotChart", this, this.pt, this.ptOptions);
|
|
101
|
+
tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
|
|
102
|
+
hostStyle = computed(() => ({
|
|
103
|
+
...this.tokenStyle(),
|
|
104
|
+
...this.passThrough().root?.style
|
|
105
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
106
|
+
entrance = injectChartEntrance();
|
|
107
|
+
morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
|
|
108
|
+
hidden = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
|
|
109
|
+
focusedSeries = signal(null, ...ngDevMode ? [{ debugName: "focusedSeries" }] : /* istanbul ignore next */ []);
|
|
110
|
+
active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
111
|
+
geometry = signal(DEFAULTS, ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
|
|
112
|
+
intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
|
|
113
|
+
list = computed(() => this.series() ?? [], ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
|
|
114
|
+
stats = computed(() => this.list().map((item) => item.data.map((entry) => toBoxStats(entry))), ...ngDevMode ? [{ debugName: "stats" }] : /* istanbul ignore next */ []);
|
|
115
|
+
labels = computed(() => {
|
|
116
|
+
const count = Math.max(0, ...this.list().map((item) => item.data.length));
|
|
117
|
+
const categories = this.categories() ?? [];
|
|
118
|
+
return Array.from({ length: count }, (_, index) => categories[index] ?? `${index + 1}`);
|
|
119
|
+
}, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
120
|
+
keys = computed(() => this.list().map((item, index) => `${index}:${item.name}`), ...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
|
|
121
|
+
visibleIndexes = computed(() => this.keys().flatMap((key, index) => this.hidden().has(key) ? [] : [index]), ...ngDevMode ? [{ debugName: "visibleIndexes" }] : /* istanbul ignore next */ []);
|
|
122
|
+
isEmpty = computed(() => !this.stats().some((row) => row.some((entry) => entry !== null)), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
123
|
+
legendShown = computed(() => this.showLegend() && this.list().length > 1, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
|
|
124
|
+
size = linkedSignal(() => initialChartSize(this.height(), this.legendShown() ? this.legendPosition() : null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
125
|
+
valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
|
|
126
|
+
layout = computed(() => {
|
|
127
|
+
const { width, height } = this.size();
|
|
128
|
+
const values = this.visibleIndexes().flatMap((index) => this.stats()[index].flatMap((entry) => entry ? [
|
|
129
|
+
entry.min,
|
|
130
|
+
entry.max,
|
|
131
|
+
...this.showOutliers() ? entry.outliers ?? [] : []
|
|
132
|
+
] : []));
|
|
133
|
+
return cartesianLayout({
|
|
134
|
+
width,
|
|
135
|
+
height,
|
|
136
|
+
intl: this.intl(),
|
|
137
|
+
category: {
|
|
138
|
+
kind: "band",
|
|
139
|
+
labels: this.labels(),
|
|
140
|
+
count: this.labels().length,
|
|
141
|
+
labelMode: this.labelMode(),
|
|
142
|
+
title: this.xAxisTitle() || void 0
|
|
143
|
+
},
|
|
144
|
+
value: {
|
|
145
|
+
extent: extent(values) ?? [0, 1],
|
|
146
|
+
format: this.valueFormat(),
|
|
147
|
+
includeZero: false,
|
|
148
|
+
min: this.yMin(),
|
|
149
|
+
max: this.yMax(),
|
|
150
|
+
title: this.yAxisTitle() || void 0
|
|
151
|
+
},
|
|
152
|
+
grid: this.grid()
|
|
153
|
+
});
|
|
154
|
+
}, ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
155
|
+
boxes = computed(() => {
|
|
156
|
+
const layout = this.layout();
|
|
157
|
+
const band = layout.category;
|
|
158
|
+
const scale = layout.value;
|
|
159
|
+
const { boxWidth, groupGap, whiskerWidth } = this.geometry();
|
|
160
|
+
const visible = this.visibleIndexes();
|
|
161
|
+
const group = band.bandwidth * Math.min(1, Math.max(.05, boxWidth * Math.max(1, Math.min(visible.length, 2))));
|
|
162
|
+
const slots = Math.max(1, visible.length);
|
|
163
|
+
const slot = (group - groupGap * (slots - 1)) / slots;
|
|
164
|
+
return visible.flatMap((seriesIndex, position) => this.stats()[seriesIndex].flatMap((entry, index) => {
|
|
165
|
+
if (!entry) return [];
|
|
166
|
+
const x = band.center(index) - group / 2 + position * (slot + groupGap);
|
|
167
|
+
return [{
|
|
168
|
+
key: `${seriesIndex}:${index}`,
|
|
169
|
+
series: seriesIndex,
|
|
170
|
+
index,
|
|
171
|
+
color: seriesColor(this.list()[seriesIndex].color, seriesIndex),
|
|
172
|
+
x,
|
|
173
|
+
width: Math.max(1, slot),
|
|
174
|
+
center: x + slot / 2,
|
|
175
|
+
q1: scale.map(entry.q1),
|
|
176
|
+
q3: scale.map(entry.q3),
|
|
177
|
+
median: scale.map(entry.median),
|
|
178
|
+
min: scale.map(entry.min),
|
|
179
|
+
max: scale.map(entry.max),
|
|
180
|
+
capWidth: Math.max(1, slot * whiskerWidth),
|
|
181
|
+
outliers: this.showOutliers() ? (entry.outliers ?? []).map((value, at) => ({
|
|
182
|
+
key: `${at}:${value}`,
|
|
183
|
+
y: scale.map(value),
|
|
184
|
+
value
|
|
185
|
+
})) : []
|
|
186
|
+
}];
|
|
187
|
+
}));
|
|
188
|
+
}, ...ngDevMode ? [{ debugName: "boxes" }] : /* istanbul ignore next */ []);
|
|
189
|
+
hoverBand = computed(() => {
|
|
190
|
+
const active = this.active();
|
|
191
|
+
return active ? chartBandRect(this.layout().category, active.index, this.layout().plot) : null;
|
|
192
|
+
}, ...ngDevMode ? [{ debugName: "hoverBand" }] : /* istanbul ignore next */ []);
|
|
193
|
+
legendItems = computed(() => this.list().map((item, index) => ({
|
|
194
|
+
key: this.keys()[index],
|
|
195
|
+
label: item.name,
|
|
196
|
+
color: seriesColor(item.color, index),
|
|
197
|
+
hidden: this.hidden().has(this.keys()[index])
|
|
198
|
+
})), ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
|
|
199
|
+
tooltip = computed(() => {
|
|
200
|
+
const active = this.active();
|
|
201
|
+
if (!active || !this.showTooltip()) return null;
|
|
202
|
+
const entry = this.stats()[active.series]?.[active.index];
|
|
203
|
+
const box = this.boxes().find((item) => item.series === active.series && item.index === active.index);
|
|
204
|
+
if (!entry || !box) return null;
|
|
205
|
+
const t = this.translations();
|
|
206
|
+
const format = this.valueFormatter();
|
|
207
|
+
const row = (label, value, seriesIndex) => ({
|
|
208
|
+
label,
|
|
209
|
+
value: format(value),
|
|
210
|
+
color: "transparent",
|
|
211
|
+
raw: value,
|
|
212
|
+
seriesIndex
|
|
213
|
+
});
|
|
214
|
+
const outliers = entry.outliers?.length ?? 0;
|
|
215
|
+
const rows = [
|
|
216
|
+
{
|
|
217
|
+
label: this.list()[active.series].name,
|
|
218
|
+
value: "",
|
|
219
|
+
color: box.color,
|
|
220
|
+
raw: null,
|
|
221
|
+
seriesIndex: 0,
|
|
222
|
+
active: true
|
|
223
|
+
},
|
|
224
|
+
row(t.chartMax, entry.max, 1),
|
|
225
|
+
row(t.chartQ3, entry.q3, 2),
|
|
226
|
+
row(t.chartMedian, entry.median, 3),
|
|
227
|
+
row(t.chartQ1, entry.q1, 4),
|
|
228
|
+
row(t.chartMin, entry.min, 5),
|
|
229
|
+
...outliers ? [{
|
|
230
|
+
label: t.chartOutliers,
|
|
231
|
+
value: chartNumberFormatter(this.intl(), "integer")(outliers),
|
|
232
|
+
color: "transparent",
|
|
233
|
+
raw: outliers,
|
|
234
|
+
seriesIndex: 6
|
|
235
|
+
}] : []
|
|
236
|
+
];
|
|
237
|
+
const top = Math.min(box.max, ...box.outliers.map((item) => item.y));
|
|
238
|
+
return {
|
|
239
|
+
title: this.labels()[active.index] ?? "",
|
|
240
|
+
rows,
|
|
241
|
+
index: active.index,
|
|
242
|
+
x: box.center,
|
|
243
|
+
y: top,
|
|
244
|
+
placement: "top"
|
|
245
|
+
};
|
|
246
|
+
}, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
247
|
+
summary = computed(() => {
|
|
248
|
+
const t = this.translations();
|
|
249
|
+
const text = chartSummary(t, this.intl(), t.chartBoxplot, this.list().length, this.labels().length, null);
|
|
250
|
+
return this.ariaLabel() ? `${this.ariaLabel()}. ${text}` : text;
|
|
251
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
252
|
+
dataTable = computed(() => {
|
|
253
|
+
const t = this.translations();
|
|
254
|
+
const format = this.valueFormatter();
|
|
255
|
+
return {
|
|
256
|
+
columns: [
|
|
257
|
+
{
|
|
258
|
+
key: "min",
|
|
259
|
+
label: t.chartMin
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
key: "q1",
|
|
263
|
+
label: t.chartQ1
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: "median",
|
|
267
|
+
label: t.chartMedian
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
key: "q3",
|
|
271
|
+
label: t.chartQ3
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: "max",
|
|
275
|
+
label: t.chartMax
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
rows: this.list().flatMap((item, seriesIndex) => this.stats()[seriesIndex].flatMap((entry, index) => entry ? [{
|
|
279
|
+
label: this.list().length > 1 ? `${item.name}, ${this.labels()[index]}` : this.labels()[index],
|
|
280
|
+
cells: [
|
|
281
|
+
entry.min,
|
|
282
|
+
entry.q1,
|
|
283
|
+
entry.median,
|
|
284
|
+
entry.q3,
|
|
285
|
+
entry.max
|
|
286
|
+
].map((value) => format(value))
|
|
287
|
+
}] : []))
|
|
288
|
+
};
|
|
289
|
+
}, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
|
|
290
|
+
constructor() {
|
|
291
|
+
afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
|
|
292
|
+
afterRenderEffect(() => {
|
|
293
|
+
this.dt();
|
|
294
|
+
this.readGeometry();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
isActive(box) {
|
|
298
|
+
const active = this.active();
|
|
299
|
+
return !!active && active.series === box.series && active.index === box.index;
|
|
300
|
+
}
|
|
301
|
+
onPointer(event) {
|
|
302
|
+
if (event.type === "leave") {
|
|
303
|
+
this.active.set(null);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const plot = this.layout().plot;
|
|
307
|
+
const index = event.x >= plot.left && event.x <= plot.left + plot.width && event.y >= plot.top - EDGE_SLACK && event.y <= plot.top + plot.height + EDGE_SLACK ? this.layout().category.indexAt(event.x) : -1;
|
|
308
|
+
const candidates = this.boxes().filter((box) => box.index === index);
|
|
309
|
+
if (!candidates.length) {
|
|
310
|
+
this.active.set(null);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const box = candidates.reduce((best, next) => Math.abs(next.center - event.x) < Math.abs(best.center - event.x) ? next : best);
|
|
314
|
+
this.active.set({
|
|
315
|
+
index,
|
|
316
|
+
series: box.series,
|
|
317
|
+
pointerY: event.y,
|
|
318
|
+
keyboard: false
|
|
319
|
+
});
|
|
320
|
+
if (event.type === "click") {
|
|
321
|
+
const stats = this.stats()[box.series][index];
|
|
322
|
+
this.boxClick.emit({
|
|
323
|
+
seriesIndex: box.series,
|
|
324
|
+
dataPointIndex: index,
|
|
325
|
+
category: this.labels()[index] ?? "",
|
|
326
|
+
stats
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
onNavigate(event) {
|
|
331
|
+
if (event.key === "Escape") {
|
|
332
|
+
this.active.set(null);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const visible = this.visibleIndexes();
|
|
336
|
+
const current = this.active();
|
|
337
|
+
let index = current?.index ?? -1;
|
|
338
|
+
let series = current?.series ?? visible[0] ?? -1;
|
|
339
|
+
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
340
|
+
series = cycleIndex(series, event.key === "ArrowDown" ? 1 : -1, visible);
|
|
341
|
+
index = Math.max(0, index);
|
|
342
|
+
} else index = stepIndex(event.key, index, this.labels().length);
|
|
343
|
+
if (index < 0 || series < 0) return;
|
|
344
|
+
this.active.set({
|
|
345
|
+
index,
|
|
346
|
+
series,
|
|
347
|
+
pointerY: null,
|
|
348
|
+
keyboard: true
|
|
349
|
+
});
|
|
350
|
+
const entry = this.stats()[series]?.[index];
|
|
351
|
+
const t = this.translations();
|
|
352
|
+
const format = this.valueFormatter();
|
|
353
|
+
this.frame()?.announce(entry ? `${this.list()[series].name}, ${this.labels()[index]}: ${t.chartMedian} ${format(entry.median)}, ${t.chartQ1} ${format(entry.q1)}, ${t.chartQ3} ${format(entry.q3)}, ${t.chartMin} ${format(entry.min)}, ${t.chartMax} ${format(entry.max)}` : `${this.list()[series].name}, ${this.labels()[index]}: —`);
|
|
354
|
+
}
|
|
355
|
+
onLegendToggle(key) {
|
|
356
|
+
const index = this.keys().indexOf(key);
|
|
357
|
+
this.hidden.update((keys) => toggleKey(keys, key));
|
|
358
|
+
if (this.active()?.series === index) this.active.set(null);
|
|
359
|
+
this.seriesToggle.emit({
|
|
360
|
+
seriesIndex: index,
|
|
361
|
+
name: this.list()[index]?.name ?? "",
|
|
362
|
+
hidden: this.hidden().has(key)
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
onLegendHover(key) {
|
|
366
|
+
const index = key === null ? -1 : this.keys().indexOf(key);
|
|
367
|
+
this.focusedSeries.set(index >= 0 && !this.hidden().has(key ?? "") ? index : null);
|
|
368
|
+
}
|
|
369
|
+
readGeometry() {
|
|
370
|
+
const element = this.host.nativeElement;
|
|
371
|
+
const next = {
|
|
372
|
+
boxWidth: readTokenNumber(element, "--tx-chart-boxplot-box-width", DEFAULTS.boxWidth),
|
|
373
|
+
groupGap: readTokenNumber(element, "--tx-chart-boxplot-group-gap", DEFAULTS.groupGap),
|
|
374
|
+
whiskerWidth: readTokenNumber(element, "--tx-chart-boxplot-whisker-width", DEFAULTS.whiskerWidth)
|
|
375
|
+
};
|
|
376
|
+
const current = this.geometry();
|
|
377
|
+
if (current.boxWidth !== next.boxWidth || current.groupGap !== next.groupGap || current.whiskerWidth !== next.whiskerWidth) this.geometry.set(next);
|
|
378
|
+
}
|
|
379
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
380
|
+
minVersion: "12.0.0",
|
|
381
|
+
version: "22.2.3",
|
|
382
|
+
ngImport: i0,
|
|
383
|
+
type: TxBoxplotChart,
|
|
384
|
+
deps: [],
|
|
385
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
386
|
+
});
|
|
387
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
388
|
+
minVersion: "17.0.0",
|
|
389
|
+
version: "22.2.3",
|
|
390
|
+
type: TxBoxplotChart,
|
|
391
|
+
isStandalone: true,
|
|
392
|
+
selector: "tx-boxplot-chart",
|
|
393
|
+
inputs: {
|
|
394
|
+
series: {
|
|
395
|
+
classPropertyName: "series",
|
|
396
|
+
publicName: "series",
|
|
397
|
+
isSignal: true,
|
|
398
|
+
isRequired: false,
|
|
399
|
+
transformFunction: null
|
|
400
|
+
},
|
|
401
|
+
categories: {
|
|
402
|
+
classPropertyName: "categories",
|
|
403
|
+
publicName: "categories",
|
|
404
|
+
isSignal: true,
|
|
405
|
+
isRequired: false,
|
|
406
|
+
transformFunction: null
|
|
407
|
+
},
|
|
408
|
+
height: {
|
|
409
|
+
classPropertyName: "height",
|
|
410
|
+
publicName: "height",
|
|
411
|
+
isSignal: true,
|
|
412
|
+
isRequired: false,
|
|
413
|
+
transformFunction: null
|
|
414
|
+
},
|
|
415
|
+
showOutliers: {
|
|
416
|
+
classPropertyName: "showOutliers",
|
|
417
|
+
publicName: "showOutliers",
|
|
418
|
+
isSignal: true,
|
|
419
|
+
isRequired: false,
|
|
420
|
+
transformFunction: null
|
|
421
|
+
},
|
|
422
|
+
showLegend: {
|
|
423
|
+
classPropertyName: "showLegend",
|
|
424
|
+
publicName: "showLegend",
|
|
425
|
+
isSignal: true,
|
|
426
|
+
isRequired: false,
|
|
427
|
+
transformFunction: null
|
|
428
|
+
},
|
|
429
|
+
legendPosition: {
|
|
430
|
+
classPropertyName: "legendPosition",
|
|
431
|
+
publicName: "legendPosition",
|
|
432
|
+
isSignal: true,
|
|
433
|
+
isRequired: false,
|
|
434
|
+
transformFunction: null
|
|
435
|
+
},
|
|
436
|
+
legendAlign: {
|
|
437
|
+
classPropertyName: "legendAlign",
|
|
438
|
+
publicName: "legendAlign",
|
|
439
|
+
isSignal: true,
|
|
440
|
+
isRequired: false,
|
|
441
|
+
transformFunction: null
|
|
442
|
+
},
|
|
443
|
+
showTooltip: {
|
|
444
|
+
classPropertyName: "showTooltip",
|
|
445
|
+
publicName: "showTooltip",
|
|
446
|
+
isSignal: true,
|
|
447
|
+
isRequired: false,
|
|
448
|
+
transformFunction: null
|
|
449
|
+
},
|
|
450
|
+
valueFormat: {
|
|
451
|
+
classPropertyName: "valueFormat",
|
|
452
|
+
publicName: "valueFormat",
|
|
453
|
+
isSignal: true,
|
|
454
|
+
isRequired: false,
|
|
455
|
+
transformFunction: null
|
|
456
|
+
},
|
|
457
|
+
yMin: {
|
|
458
|
+
classPropertyName: "yMin",
|
|
459
|
+
publicName: "yMin",
|
|
460
|
+
isSignal: true,
|
|
461
|
+
isRequired: false,
|
|
462
|
+
transformFunction: null
|
|
463
|
+
},
|
|
464
|
+
yMax: {
|
|
465
|
+
classPropertyName: "yMax",
|
|
466
|
+
publicName: "yMax",
|
|
467
|
+
isSignal: true,
|
|
468
|
+
isRequired: false,
|
|
469
|
+
transformFunction: null
|
|
470
|
+
},
|
|
471
|
+
xAxisTitle: {
|
|
472
|
+
classPropertyName: "xAxisTitle",
|
|
473
|
+
publicName: "xAxisTitle",
|
|
474
|
+
isSignal: true,
|
|
475
|
+
isRequired: false,
|
|
476
|
+
transformFunction: null
|
|
477
|
+
},
|
|
478
|
+
yAxisTitle: {
|
|
479
|
+
classPropertyName: "yAxisTitle",
|
|
480
|
+
publicName: "yAxisTitle",
|
|
481
|
+
isSignal: true,
|
|
482
|
+
isRequired: false,
|
|
483
|
+
transformFunction: null
|
|
484
|
+
},
|
|
485
|
+
grid: {
|
|
486
|
+
classPropertyName: "grid",
|
|
487
|
+
publicName: "grid",
|
|
488
|
+
isSignal: true,
|
|
489
|
+
isRequired: false,
|
|
490
|
+
transformFunction: null
|
|
491
|
+
},
|
|
492
|
+
labelMode: {
|
|
493
|
+
classPropertyName: "labelMode",
|
|
494
|
+
publicName: "labelMode",
|
|
495
|
+
isSignal: true,
|
|
496
|
+
isRequired: false,
|
|
497
|
+
transformFunction: null
|
|
498
|
+
},
|
|
499
|
+
toolbar: {
|
|
500
|
+
classPropertyName: "toolbar",
|
|
501
|
+
publicName: "toolbar",
|
|
502
|
+
isSignal: true,
|
|
503
|
+
isRequired: false,
|
|
504
|
+
transformFunction: null
|
|
505
|
+
},
|
|
506
|
+
loading: {
|
|
507
|
+
classPropertyName: "loading",
|
|
508
|
+
publicName: "loading",
|
|
509
|
+
isSignal: true,
|
|
510
|
+
isRequired: false,
|
|
511
|
+
transformFunction: null
|
|
512
|
+
},
|
|
513
|
+
ariaLabel: {
|
|
514
|
+
classPropertyName: "ariaLabel",
|
|
515
|
+
publicName: "ariaLabel",
|
|
516
|
+
isSignal: true,
|
|
517
|
+
isRequired: false,
|
|
518
|
+
transformFunction: null
|
|
519
|
+
},
|
|
520
|
+
dt: {
|
|
521
|
+
classPropertyName: "dt",
|
|
522
|
+
publicName: "dt",
|
|
523
|
+
isSignal: true,
|
|
524
|
+
isRequired: false,
|
|
525
|
+
transformFunction: null
|
|
526
|
+
},
|
|
527
|
+
pt: {
|
|
528
|
+
classPropertyName: "pt",
|
|
529
|
+
publicName: "pt",
|
|
530
|
+
isSignal: true,
|
|
531
|
+
isRequired: false,
|
|
532
|
+
transformFunction: null
|
|
533
|
+
},
|
|
534
|
+
ptOptions: {
|
|
535
|
+
classPropertyName: "ptOptions",
|
|
536
|
+
publicName: "ptOptions",
|
|
537
|
+
isSignal: true,
|
|
538
|
+
isRequired: false,
|
|
539
|
+
transformFunction: null
|
|
540
|
+
},
|
|
541
|
+
unstyled: {
|
|
542
|
+
classPropertyName: "unstyled",
|
|
543
|
+
publicName: "unstyled",
|
|
544
|
+
isSignal: true,
|
|
545
|
+
isRequired: false,
|
|
546
|
+
transformFunction: null
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
outputs: {
|
|
550
|
+
boxClick: "boxClick",
|
|
551
|
+
seriesToggle: "seriesToggle"
|
|
552
|
+
},
|
|
553
|
+
host: {
|
|
554
|
+
properties: {
|
|
555
|
+
"class": "passThrough().root?.class",
|
|
556
|
+
"style": "hostStyle()",
|
|
557
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
558
|
+
"class.tx-boxplot-chart--fill": "typeof height() === \"string\"",
|
|
559
|
+
"class.tx-boxplot-chart--entering": "entrance.active()",
|
|
560
|
+
"class.tx-boxplot-chart--morph": "morph()",
|
|
561
|
+
"class.tx-boxplot-chart--active": "active() !== null",
|
|
562
|
+
"class.tx-boxplot-chart--focused": "focusedSeries() !== null"
|
|
563
|
+
},
|
|
564
|
+
classAttribute: "tx-boxplot-chart"
|
|
565
|
+
},
|
|
566
|
+
queries: [{
|
|
567
|
+
propertyName: "legendTemplate",
|
|
568
|
+
first: true,
|
|
569
|
+
predicate: TxChartLegendTemplate,
|
|
570
|
+
descendants: true,
|
|
571
|
+
isSignal: true
|
|
572
|
+
}, {
|
|
573
|
+
propertyName: "tooltipTemplate",
|
|
574
|
+
first: true,
|
|
575
|
+
predicate: TxChartTooltipTemplate,
|
|
576
|
+
descendants: true,
|
|
577
|
+
isSignal: true
|
|
578
|
+
}],
|
|
579
|
+
viewQueries: [{
|
|
580
|
+
propertyName: "frame",
|
|
581
|
+
first: true,
|
|
582
|
+
predicate: TxChartFrame,
|
|
583
|
+
descendants: true,
|
|
584
|
+
isSignal: true
|
|
585
|
+
}],
|
|
586
|
+
ngImport: i0,
|
|
587
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [legendItems]=\"legendItems()\"\n [showLegend]=\"legendShown()\"\n [legendPosition]=\"legendPosition()\"\n [legendAlign]=\"legendAlign()\"\n [legendTemplate]=\"legendTemplate()?.template\"\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 (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n <svg:g [tx-chart-hover-band]=\"hoverBand()\" [part]=\"passThrough().hoverBand\" />\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n @for (box of boxes(); track box.key) {\n <svg:g\n class=\"tx-boxplot-chart__item\"\n [class.tx-boxplot-chart__item--active]=\"isActive(box)\"\n [class.tx-boxplot-chart__item--focused]=\"focusedSeries() === box.series\"\n [attr.data-series]=\"box.series\"\n [attr.data-index]=\"box.index\"\n [style.--tx-boxplot-chart-color]=\"box.color\"\n [style.--tx-boxplot-chart-order]=\"box.index\"\n >\n <svg:line class=\"tx-boxplot-chart__whisker\" [class]=\"passThrough().whisker?.class\" [style]=\"passThrough().whisker?.style\" [attr.x1]=\"box.center\" [attr.x2]=\"box.center\" [attr.y1]=\"box.max\" [attr.y2]=\"box.q3\" />\n <svg:line class=\"tx-boxplot-chart__whisker\" [class]=\"passThrough().whisker?.class\" [style]=\"passThrough().whisker?.style\" [attr.x1]=\"box.center\" [attr.x2]=\"box.center\" [attr.y1]=\"box.q1\" [attr.y2]=\"box.min\" />\n <svg:line class=\"tx-boxplot-chart__cap\" [attr.x1]=\"box.center - box.capWidth / 2\" [attr.x2]=\"box.center + box.capWidth / 2\" [attr.y1]=\"box.max\" [attr.y2]=\"box.max\" />\n <svg:line class=\"tx-boxplot-chart__cap\" [attr.x1]=\"box.center - box.capWidth / 2\" [attr.x2]=\"box.center + box.capWidth / 2\" [attr.y1]=\"box.min\" [attr.y2]=\"box.min\" />\n <svg:rect\n class=\"tx-boxplot-chart__box\"\n [class]=\"passThrough().box?.class\"\n [style]=\"passThrough().box?.style\"\n [attr.x]=\"box.x\"\n [attr.y]=\"box.q3\"\n [attr.width]=\"box.width\"\n [attr.height]=\"box.q1 - box.q3\"\n />\n <svg:line\n class=\"tx-boxplot-chart__median\"\n [class]=\"passThrough().median?.class\"\n [style]=\"passThrough().median?.style\"\n [attr.x1]=\"box.x\"\n [attr.x2]=\"box.x + box.width\"\n [attr.y1]=\"box.median\"\n [attr.y2]=\"box.median\"\n />\n @for (point of box.outliers; track point.key) {\n <svg:circle class=\"tx-boxplot-chart__outlier\" [class]=\"passThrough().outlier?.class\" [style]=\"passThrough().outlier?.style\" [attr.cx]=\"box.center\" [attr.cy]=\"point.y\" />\n }\n </svg:g>\n }\n</tx-chart-frame>\n",
|
|
588
|
+
styles: [":host{display:block;min-width:0}:host(.tx-boxplot-chart--fill){height:100%}.tx-boxplot-chart__item{pointer-events:none;transform-box:fill-box;transform-origin:50% 50%}.tx-boxplot-chart__box{fill:var(--tx-boxplot-chart-color);fill-opacity:.2;stroke:var(--tx-boxplot-chart-color)}.tx-boxplot-chart__whisker,.tx-boxplot-chart__cap,.tx-boxplot-chart__median{stroke:var(--tx-boxplot-chart-color)}.tx-boxplot-chart__outlier{r:3px;fill:none;stroke:var(--tx-boxplot-chart-color)}:host([data-styled]) .tx-boxplot-chart__box{fill-opacity:var(--tx-chart-boxplot-fill-opacity);stroke-width:var(--tx-chart-boxplot-stroke-width);rx:var(--tx-chart-boxplot-radius);transition:fill-opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-boxplot-chart__whisker,:host([data-styled]) .tx-boxplot-chart__cap{stroke-width:var(--tx-chart-boxplot-stroke-width);stroke-linecap:round}:host([data-styled]) .tx-boxplot-chart__median{stroke-width:var(--tx-chart-boxplot-median-width);stroke-linecap:round}:host([data-styled]) .tx-boxplot-chart__outlier{r:var(--tx-chart-boxplot-outlier-radius);stroke-width:var(--tx-chart-boxplot-stroke-width)}:host([data-styled]) .tx-boxplot-chart__item{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-boxplot-chart__item--active .tx-boxplot-chart__box{fill-opacity:calc(var(--tx-chart-boxplot-fill-opacity) * 2)}:host([data-styled].tx-boxplot-chart--active) .tx-boxplot-chart__item:not(.tx-boxplot-chart__item--active),:host([data-styled].tx-boxplot-chart--focused) .tx-boxplot-chart__item:not(.tx-boxplot-chart__item--focused){opacity:var(--tx-chart-boxplot-dimmed-opacity)}:host([data-styled].tx-boxplot-chart--entering) .tx-boxplot-chart__item{animation:tx-boxplot-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-boxplot-chart-order, 0) * var(--tx-chart-motion-stagger) * 2)}@keyframes tx-boxplot-chart-grow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-boxplot-chart__item,:host([data-styled]) .tx-boxplot-chart__box{transition:none;animation:none}}\n"],
|
|
589
|
+
dependencies: [
|
|
590
|
+
{
|
|
591
|
+
kind: "component",
|
|
592
|
+
type: TxChartFrame,
|
|
593
|
+
selector: "tx-chart-frame",
|
|
594
|
+
inputs: [
|
|
595
|
+
"height",
|
|
596
|
+
"size",
|
|
597
|
+
"legendItems",
|
|
598
|
+
"showLegend",
|
|
599
|
+
"legendPosition",
|
|
600
|
+
"legendAlign",
|
|
601
|
+
"legendVariant",
|
|
602
|
+
"legendToggle",
|
|
603
|
+
"legendTemplate",
|
|
604
|
+
"empty",
|
|
605
|
+
"loading",
|
|
606
|
+
"emptyIcon",
|
|
607
|
+
"summary",
|
|
608
|
+
"table",
|
|
609
|
+
"tooltip",
|
|
610
|
+
"tooltipTemplate",
|
|
611
|
+
"tooltipPlacement",
|
|
612
|
+
"panelStyle",
|
|
613
|
+
"parts",
|
|
614
|
+
"styled",
|
|
615
|
+
"interactive",
|
|
616
|
+
"actionKeys",
|
|
617
|
+
"zoomable",
|
|
618
|
+
"zoomedIn",
|
|
619
|
+
"plotHeight",
|
|
620
|
+
"toolbar",
|
|
621
|
+
"exportName"
|
|
622
|
+
],
|
|
623
|
+
outputs: [
|
|
624
|
+
"sizeChange",
|
|
625
|
+
"pointer",
|
|
626
|
+
"navigate",
|
|
627
|
+
"legendToggled",
|
|
628
|
+
"legendHovered",
|
|
629
|
+
"tooltipClosed",
|
|
630
|
+
"zoomed",
|
|
631
|
+
"panned",
|
|
632
|
+
"zoomReset"
|
|
633
|
+
]
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
kind: "component",
|
|
637
|
+
type: TxChartAxes,
|
|
638
|
+
selector: "g[tx-chart-axes]",
|
|
639
|
+
inputs: [
|
|
640
|
+
"tx-chart-axes",
|
|
641
|
+
"gridPart",
|
|
642
|
+
"axisPart"
|
|
643
|
+
]
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
kind: "component",
|
|
647
|
+
type: TxChartHoverBand,
|
|
648
|
+
selector: "g[tx-chart-hover-band]",
|
|
649
|
+
inputs: ["tx-chart-hover-band", "part"]
|
|
650
|
+
}
|
|
651
|
+
],
|
|
652
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
656
|
+
minVersion: "12.0.0",
|
|
657
|
+
version: "22.2.3",
|
|
658
|
+
ngImport: i0,
|
|
659
|
+
type: TxBoxplotChart,
|
|
660
|
+
decorators: [{
|
|
661
|
+
type: Component,
|
|
662
|
+
args: [{
|
|
663
|
+
selector: "tx-boxplot-chart",
|
|
664
|
+
imports: [
|
|
665
|
+
TxChartFrame,
|
|
666
|
+
TxChartAxes,
|
|
667
|
+
TxChartHoverBand
|
|
668
|
+
],
|
|
669
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
670
|
+
host: {
|
|
671
|
+
class: "tx-boxplot-chart",
|
|
672
|
+
"[class]": "passThrough().root?.class",
|
|
673
|
+
"[style]": "hostStyle()",
|
|
674
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
675
|
+
"[class.tx-boxplot-chart--fill]": "typeof height() === \"string\"",
|
|
676
|
+
"[class.tx-boxplot-chart--entering]": "entrance.active()",
|
|
677
|
+
"[class.tx-boxplot-chart--morph]": "morph()",
|
|
678
|
+
"[class.tx-boxplot-chart--active]": "active() !== null",
|
|
679
|
+
"[class.tx-boxplot-chart--focused]": "focusedSeries() !== null"
|
|
680
|
+
},
|
|
681
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [legendItems]=\"legendItems()\"\n [showLegend]=\"legendShown()\"\n [legendPosition]=\"legendPosition()\"\n [legendAlign]=\"legendAlign()\"\n [legendTemplate]=\"legendTemplate()?.template\"\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 (legendToggled)=\"onLegendToggle($event)\"\n (legendHovered)=\"onLegendHover($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n <svg:g [tx-chart-hover-band]=\"hoverBand()\" [part]=\"passThrough().hoverBand\" />\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n @for (box of boxes(); track box.key) {\n <svg:g\n class=\"tx-boxplot-chart__item\"\n [class.tx-boxplot-chart__item--active]=\"isActive(box)\"\n [class.tx-boxplot-chart__item--focused]=\"focusedSeries() === box.series\"\n [attr.data-series]=\"box.series\"\n [attr.data-index]=\"box.index\"\n [style.--tx-boxplot-chart-color]=\"box.color\"\n [style.--tx-boxplot-chart-order]=\"box.index\"\n >\n <svg:line class=\"tx-boxplot-chart__whisker\" [class]=\"passThrough().whisker?.class\" [style]=\"passThrough().whisker?.style\" [attr.x1]=\"box.center\" [attr.x2]=\"box.center\" [attr.y1]=\"box.max\" [attr.y2]=\"box.q3\" />\n <svg:line class=\"tx-boxplot-chart__whisker\" [class]=\"passThrough().whisker?.class\" [style]=\"passThrough().whisker?.style\" [attr.x1]=\"box.center\" [attr.x2]=\"box.center\" [attr.y1]=\"box.q1\" [attr.y2]=\"box.min\" />\n <svg:line class=\"tx-boxplot-chart__cap\" [attr.x1]=\"box.center - box.capWidth / 2\" [attr.x2]=\"box.center + box.capWidth / 2\" [attr.y1]=\"box.max\" [attr.y2]=\"box.max\" />\n <svg:line class=\"tx-boxplot-chart__cap\" [attr.x1]=\"box.center - box.capWidth / 2\" [attr.x2]=\"box.center + box.capWidth / 2\" [attr.y1]=\"box.min\" [attr.y2]=\"box.min\" />\n <svg:rect\n class=\"tx-boxplot-chart__box\"\n [class]=\"passThrough().box?.class\"\n [style]=\"passThrough().box?.style\"\n [attr.x]=\"box.x\"\n [attr.y]=\"box.q3\"\n [attr.width]=\"box.width\"\n [attr.height]=\"box.q1 - box.q3\"\n />\n <svg:line\n class=\"tx-boxplot-chart__median\"\n [class]=\"passThrough().median?.class\"\n [style]=\"passThrough().median?.style\"\n [attr.x1]=\"box.x\"\n [attr.x2]=\"box.x + box.width\"\n [attr.y1]=\"box.median\"\n [attr.y2]=\"box.median\"\n />\n @for (point of box.outliers; track point.key) {\n <svg:circle class=\"tx-boxplot-chart__outlier\" [class]=\"passThrough().outlier?.class\" [style]=\"passThrough().outlier?.style\" [attr.cx]=\"box.center\" [attr.cy]=\"point.y\" />\n }\n </svg:g>\n }\n</tx-chart-frame>\n",
|
|
682
|
+
styles: [":host{display:block;min-width:0}:host(.tx-boxplot-chart--fill){height:100%}.tx-boxplot-chart__item{pointer-events:none;transform-box:fill-box;transform-origin:50% 50%}.tx-boxplot-chart__box{fill:var(--tx-boxplot-chart-color);fill-opacity:.2;stroke:var(--tx-boxplot-chart-color)}.tx-boxplot-chart__whisker,.tx-boxplot-chart__cap,.tx-boxplot-chart__median{stroke:var(--tx-boxplot-chart-color)}.tx-boxplot-chart__outlier{r:3px;fill:none;stroke:var(--tx-boxplot-chart-color)}:host([data-styled]) .tx-boxplot-chart__box{fill-opacity:var(--tx-chart-boxplot-fill-opacity);stroke-width:var(--tx-chart-boxplot-stroke-width);rx:var(--tx-chart-boxplot-radius);transition:fill-opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-boxplot-chart__whisker,:host([data-styled]) .tx-boxplot-chart__cap{stroke-width:var(--tx-chart-boxplot-stroke-width);stroke-linecap:round}:host([data-styled]) .tx-boxplot-chart__median{stroke-width:var(--tx-chart-boxplot-median-width);stroke-linecap:round}:host([data-styled]) .tx-boxplot-chart__outlier{r:var(--tx-chart-boxplot-outlier-radius);stroke-width:var(--tx-chart-boxplot-stroke-width)}:host([data-styled]) .tx-boxplot-chart__item{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-boxplot-chart__item--active .tx-boxplot-chart__box{fill-opacity:calc(var(--tx-chart-boxplot-fill-opacity) * 2)}:host([data-styled].tx-boxplot-chart--active) .tx-boxplot-chart__item:not(.tx-boxplot-chart__item--active),:host([data-styled].tx-boxplot-chart--focused) .tx-boxplot-chart__item:not(.tx-boxplot-chart__item--focused){opacity:var(--tx-chart-boxplot-dimmed-opacity)}:host([data-styled].tx-boxplot-chart--entering) .tx-boxplot-chart__item{animation:tx-boxplot-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(var(--tx-boxplot-chart-order, 0) * var(--tx-chart-motion-stagger) * 2)}@keyframes tx-boxplot-chart-grow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-boxplot-chart__item,:host([data-styled]) .tx-boxplot-chart__box{transition:none;animation:none}}\n"]
|
|
683
|
+
}]
|
|
684
|
+
}],
|
|
685
|
+
ctorParameters: () => [],
|
|
686
|
+
propDecorators: {
|
|
687
|
+
series: [{
|
|
688
|
+
type: i0.Input,
|
|
689
|
+
args: [{
|
|
690
|
+
isSignal: true,
|
|
691
|
+
alias: "series",
|
|
692
|
+
required: false
|
|
693
|
+
}]
|
|
694
|
+
}],
|
|
695
|
+
categories: [{
|
|
696
|
+
type: i0.Input,
|
|
697
|
+
args: [{
|
|
698
|
+
isSignal: true,
|
|
699
|
+
alias: "categories",
|
|
700
|
+
required: false
|
|
701
|
+
}]
|
|
702
|
+
}],
|
|
703
|
+
height: [{
|
|
704
|
+
type: i0.Input,
|
|
705
|
+
args: [{
|
|
706
|
+
isSignal: true,
|
|
707
|
+
alias: "height",
|
|
708
|
+
required: false
|
|
709
|
+
}]
|
|
710
|
+
}],
|
|
711
|
+
showOutliers: [{
|
|
712
|
+
type: i0.Input,
|
|
713
|
+
args: [{
|
|
714
|
+
isSignal: true,
|
|
715
|
+
alias: "showOutliers",
|
|
716
|
+
required: false
|
|
717
|
+
}]
|
|
718
|
+
}],
|
|
719
|
+
showLegend: [{
|
|
720
|
+
type: i0.Input,
|
|
721
|
+
args: [{
|
|
722
|
+
isSignal: true,
|
|
723
|
+
alias: "showLegend",
|
|
724
|
+
required: false
|
|
725
|
+
}]
|
|
726
|
+
}],
|
|
727
|
+
legendPosition: [{
|
|
728
|
+
type: i0.Input,
|
|
729
|
+
args: [{
|
|
730
|
+
isSignal: true,
|
|
731
|
+
alias: "legendPosition",
|
|
732
|
+
required: false
|
|
733
|
+
}]
|
|
734
|
+
}],
|
|
735
|
+
legendAlign: [{
|
|
736
|
+
type: i0.Input,
|
|
737
|
+
args: [{
|
|
738
|
+
isSignal: true,
|
|
739
|
+
alias: "legendAlign",
|
|
740
|
+
required: false
|
|
741
|
+
}]
|
|
742
|
+
}],
|
|
743
|
+
showTooltip: [{
|
|
744
|
+
type: i0.Input,
|
|
745
|
+
args: [{
|
|
746
|
+
isSignal: true,
|
|
747
|
+
alias: "showTooltip",
|
|
748
|
+
required: false
|
|
749
|
+
}]
|
|
750
|
+
}],
|
|
751
|
+
valueFormat: [{
|
|
752
|
+
type: i0.Input,
|
|
753
|
+
args: [{
|
|
754
|
+
isSignal: true,
|
|
755
|
+
alias: "valueFormat",
|
|
756
|
+
required: false
|
|
757
|
+
}]
|
|
758
|
+
}],
|
|
759
|
+
yMin: [{
|
|
760
|
+
type: i0.Input,
|
|
761
|
+
args: [{
|
|
762
|
+
isSignal: true,
|
|
763
|
+
alias: "yMin",
|
|
764
|
+
required: false
|
|
765
|
+
}]
|
|
766
|
+
}],
|
|
767
|
+
yMax: [{
|
|
768
|
+
type: i0.Input,
|
|
769
|
+
args: [{
|
|
770
|
+
isSignal: true,
|
|
771
|
+
alias: "yMax",
|
|
772
|
+
required: false
|
|
773
|
+
}]
|
|
774
|
+
}],
|
|
775
|
+
xAxisTitle: [{
|
|
776
|
+
type: i0.Input,
|
|
777
|
+
args: [{
|
|
778
|
+
isSignal: true,
|
|
779
|
+
alias: "xAxisTitle",
|
|
780
|
+
required: false
|
|
781
|
+
}]
|
|
782
|
+
}],
|
|
783
|
+
yAxisTitle: [{
|
|
784
|
+
type: i0.Input,
|
|
785
|
+
args: [{
|
|
786
|
+
isSignal: true,
|
|
787
|
+
alias: "yAxisTitle",
|
|
788
|
+
required: false
|
|
789
|
+
}]
|
|
790
|
+
}],
|
|
791
|
+
grid: [{
|
|
792
|
+
type: i0.Input,
|
|
793
|
+
args: [{
|
|
794
|
+
isSignal: true,
|
|
795
|
+
alias: "grid",
|
|
796
|
+
required: false
|
|
797
|
+
}]
|
|
798
|
+
}],
|
|
799
|
+
labelMode: [{
|
|
800
|
+
type: i0.Input,
|
|
801
|
+
args: [{
|
|
802
|
+
isSignal: true,
|
|
803
|
+
alias: "labelMode",
|
|
804
|
+
required: false
|
|
805
|
+
}]
|
|
806
|
+
}],
|
|
807
|
+
toolbar: [{
|
|
808
|
+
type: i0.Input,
|
|
809
|
+
args: [{
|
|
810
|
+
isSignal: true,
|
|
811
|
+
alias: "toolbar",
|
|
812
|
+
required: false
|
|
813
|
+
}]
|
|
814
|
+
}],
|
|
815
|
+
loading: [{
|
|
816
|
+
type: i0.Input,
|
|
817
|
+
args: [{
|
|
818
|
+
isSignal: true,
|
|
819
|
+
alias: "loading",
|
|
820
|
+
required: false
|
|
821
|
+
}]
|
|
822
|
+
}],
|
|
823
|
+
ariaLabel: [{
|
|
824
|
+
type: i0.Input,
|
|
825
|
+
args: [{
|
|
826
|
+
isSignal: true,
|
|
827
|
+
alias: "ariaLabel",
|
|
828
|
+
required: false
|
|
829
|
+
}]
|
|
830
|
+
}],
|
|
831
|
+
dt: [{
|
|
832
|
+
type: i0.Input,
|
|
833
|
+
args: [{
|
|
834
|
+
isSignal: true,
|
|
835
|
+
alias: "dt",
|
|
836
|
+
required: false
|
|
837
|
+
}]
|
|
838
|
+
}],
|
|
839
|
+
pt: [{
|
|
840
|
+
type: i0.Input,
|
|
841
|
+
args: [{
|
|
842
|
+
isSignal: true,
|
|
843
|
+
alias: "pt",
|
|
844
|
+
required: false
|
|
845
|
+
}]
|
|
846
|
+
}],
|
|
847
|
+
ptOptions: [{
|
|
848
|
+
type: i0.Input,
|
|
849
|
+
args: [{
|
|
850
|
+
isSignal: true,
|
|
851
|
+
alias: "ptOptions",
|
|
852
|
+
required: false
|
|
853
|
+
}]
|
|
854
|
+
}],
|
|
855
|
+
unstyled: [{
|
|
856
|
+
type: i0.Input,
|
|
857
|
+
args: [{
|
|
858
|
+
isSignal: true,
|
|
859
|
+
alias: "unstyled",
|
|
860
|
+
required: false
|
|
861
|
+
}]
|
|
862
|
+
}],
|
|
863
|
+
boxClick: [{
|
|
864
|
+
type: i0.Output,
|
|
865
|
+
args: ["boxClick"]
|
|
866
|
+
}],
|
|
867
|
+
seriesToggle: [{
|
|
868
|
+
type: i0.Output,
|
|
869
|
+
args: ["seriesToggle"]
|
|
870
|
+
}],
|
|
871
|
+
legendTemplate: [{
|
|
872
|
+
type: i0.ContentChild,
|
|
873
|
+
args: [i0.forwardRef(() => TxChartLegendTemplate), { isSignal: true }]
|
|
874
|
+
}],
|
|
875
|
+
tooltipTemplate: [{
|
|
876
|
+
type: i0.ContentChild,
|
|
877
|
+
args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
|
|
878
|
+
}],
|
|
879
|
+
frame: [{
|
|
880
|
+
type: i0.ViewChild,
|
|
881
|
+
args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
|
|
882
|
+
}]
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
export { TxBoxplotChart, boxStats, quantile, toBoxStats };
|
|
886
|
+
|
|
887
|
+
//# sourceMappingURL=tectra-ng-charts-boxplot.mjs.map
|