@ids-group-ltd/ids-design-system 0.13.2 → 0.13.3
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/CHANGELOG.md +265 -0
- package/components.md +12 -16
- package/docs/agent/INDEX.md +1 -2
- package/docs/agent/charts/ds-column-chart.md +3 -2
- package/docs/agent/feedback/ds-bar.md +13 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +9 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs +95 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +70 -41
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +973 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +141 -120
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs +42 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +16 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +14 -83
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +163 -21
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.13.3.json +211 -0
- package/package.json +17 -17
- package/styles/_chart-frame.scss +16 -6
- package/styles/_tokens-charts.scss +29 -5
- package/styles/_tokens.scss +1 -1
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +2 -1
- package/types/ids-group-ltd-ids-design-system-components-bar.d.ts +63 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +7 -4
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +543 -0
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +95 -38
- package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +15 -2
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +8 -18
- package/types/ids-group-ltd-ids-design-system-components.d.ts +58 -9
- package/types/ids-group-ltd-ids-design-system-core.d.ts +55 -4
- package/types/ids-group-ltd-ids-design-system.d.ts +4 -4
- package/docs/agent/feedback/ds-meter.md +0 -11
- package/docs/agent/feedback/ds-progress.md +0 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-meter.mjs +0 -61
- package/fesm2022/ids-group-ltd-ids-design-system-components-meter.mjs.map +0 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs +0 -65
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs.map +0 -1
- package/types/ids-group-ltd-ids-design-system-components-meter.d.ts +0 -36
- package/types/ids-group-ltd-ids-design-system-components-progress.d.ts +0 -40
|
@@ -0,0 +1,973 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, input, numberAttribute, booleanAttribute, inject, ElementRef, computed, signal, effect, afterRenderEffect, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, Component, output } from '@angular/core';
|
|
3
|
+
import { domainMinOf, niceDomain, linearScale, tickValues, roundStepAtLeast, defaultChartFormat, elementWidth, bandScale, CHART_SERIES_COLORS, staggerDelay, nextRovingIndex, focusMark, describeShare, lineSegments, areaPath, polylinePoints } from '@ids-group-ltd/ids-design-system/components';
|
|
4
|
+
import { SkeletonComponent } from '@ids-group-ltd/ids-design-system/components/skeleton';
|
|
5
|
+
import { resolveWithConfig, ICONS } from '@ids-group-ltd/ids-design-system/core';
|
|
6
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
7
|
+
import { chartActiveMark } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';
|
|
8
|
+
|
|
9
|
+
const CHART_DEFAULT_TICK_COUNT = 5;
|
|
10
|
+
const CHART_AXIS_LABEL_GAP = 8;
|
|
11
|
+
const CHART_CATEGORY_LABEL_OFFSET = 18;
|
|
12
|
+
const CHART_BAND_PADDING = 0.3;
|
|
13
|
+
/** What the chart lays out at while it measures zero: under SSR, while the host is
|
|
14
|
+
* `display: none`, and for the frame before the first `ResizeObserver` callback. Without it the
|
|
15
|
+
* plot is `0 - axisGutter - EDGE_GUTTER` wide, which clamps to zero and stacks every category on
|
|
16
|
+
* one x rather than leaving a blank space that the measurement then fills.
|
|
17
|
+
*
|
|
18
|
+
* The client cost is one frame drawn at this width and scaled to fit - measured at a 400px card
|
|
19
|
+
* in Chrome 153: `viewBox="0 0 640 310"` at t=242ms, `"0 0 358 310"` at t=260ms.
|
|
20
|
+
*
|
|
21
|
+
* @internal */
|
|
22
|
+
const CHART_FALLBACK_WIDTH = 640;
|
|
23
|
+
const CHART_DEFAULT_PLOT_HEIGHT = 240;
|
|
24
|
+
const CHART_DEFAULT_AXIS_GUTTER = 46;
|
|
25
|
+
const CHART_DEFAULT_VALUE_SPACE = 20;
|
|
26
|
+
/** Room past the last band, so a mark centred on it is not cut by the viewBox edge. */
|
|
27
|
+
const CHART_EDGE_GUTTER = 12;
|
|
28
|
+
/** Blank between two stacked plots: enough for the lower plot's top tick label to clear the upper
|
|
29
|
+
* plot's category-free bottom edge. */
|
|
30
|
+
const CHART_STACKED_PLOT_GAP = 34;
|
|
31
|
+
/** Height of the category-label row under the plot: one line plus its descenders. */
|
|
32
|
+
const CATEGORY_GUTTER = 30;
|
|
33
|
+
/** The drawable rectangle, in the same CSS pixels the container was measured in.
|
|
34
|
+
*
|
|
35
|
+
* `measuredWidth` is the `<svg>`'s own rendered width, which is what makes every coordinate
|
|
36
|
+
* derived from this an exact CSS pixel: the viewBox is sized to match, so one user unit is one
|
|
37
|
+
* pixel and a mark capped at 48 is 48 pixels wide at every card width.
|
|
38
|
+
*
|
|
39
|
+
* @internal */
|
|
40
|
+
function chartPlot(measuredWidth, plotHeight, axisGutter, valueSpace, rightGutter = CHART_EDGE_GUTTER) {
|
|
41
|
+
return {
|
|
42
|
+
left: axisGutter,
|
|
43
|
+
top: valueSpace,
|
|
44
|
+
width: Math.max(0, measuredWidth - axisGutter - rightGutter),
|
|
45
|
+
height: Math.max(0, plotHeight),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** The viewBox's height, and the `<svg>`'s rendered height in pixels - the two are the same
|
|
49
|
+
* number, which is what holds the 1:1 scale on the vertical axis too.
|
|
50
|
+
*
|
|
51
|
+
* `valueSpace` is always budgeted above the plot, for a value label over the tallest mark. It is
|
|
52
|
+
* budgeted a SECOND time below the baseline only when the domain reaches under zero, where a
|
|
53
|
+
* negative mark's label would otherwise print into the category labels: reserving it for every
|
|
54
|
+
* chart costs the all-positive ones - the common case - that much height for nothing.
|
|
55
|
+
*
|
|
56
|
+
* @internal */
|
|
57
|
+
function chartViewHeight(plotHeight, valueSpace, reservesBelowBaseline = false) {
|
|
58
|
+
const below = reservesBelowBaseline ? valueSpace : 0;
|
|
59
|
+
return valueSpace + Math.max(0, plotHeight) + below + CATEGORY_GUTTER;
|
|
60
|
+
}
|
|
61
|
+
/** The domain the value axis draws: the union of every reported set, always reaching zero,
|
|
62
|
+
* widened by the pins and snapped to a round tick step.
|
|
63
|
+
*
|
|
64
|
+
* Zero is always in it because a bar measured against a floating floor misstates its own size,
|
|
65
|
+
* and a pin only ever widens because a maximum under the data would push readings off the plot
|
|
66
|
+
* rather than rescale them.
|
|
67
|
+
*
|
|
68
|
+
* @internal */
|
|
69
|
+
function axisDomain(reported, tickCount, pinnedMinimum = null, pinnedMaximum = null) {
|
|
70
|
+
let minimum = 0;
|
|
71
|
+
let maximum = 0;
|
|
72
|
+
for (const values of reported) {
|
|
73
|
+
const finite = values.filter((value) => Number.isFinite(value));
|
|
74
|
+
minimum = Math.min(minimum, domainMinOf(finite));
|
|
75
|
+
maximum = finite.reduce((highest, value) => Math.max(highest, value), maximum);
|
|
76
|
+
}
|
|
77
|
+
if (pinnedMinimum !== null &&
|
|
78
|
+
Number.isFinite(pinnedMinimum) &&
|
|
79
|
+
pinnedMinimum < minimum) {
|
|
80
|
+
minimum = pinnedMinimum;
|
|
81
|
+
}
|
|
82
|
+
if (pinnedMaximum !== null &&
|
|
83
|
+
Number.isFinite(pinnedMaximum) &&
|
|
84
|
+
pinnedMaximum > maximum) {
|
|
85
|
+
maximum = pinnedMaximum;
|
|
86
|
+
}
|
|
87
|
+
return niceDomain(minimum, maximum, tickCount);
|
|
88
|
+
}
|
|
89
|
+
/** Where a value sits vertically, clamped inside the plot. An unplottable value lands on the
|
|
90
|
+
* baseline rather than becoming a `NaN`, which would void the whole coordinate attribute it was
|
|
91
|
+
* written into and take the mark off screen with nothing logged.
|
|
92
|
+
*
|
|
93
|
+
* @internal */
|
|
94
|
+
function valueScale(domain, top, height) {
|
|
95
|
+
const baseline = top + height;
|
|
96
|
+
const scale = linearScale(domain.min, domain.max, height);
|
|
97
|
+
return (value) => {
|
|
98
|
+
const y = baseline - scale(value);
|
|
99
|
+
return Number.isFinite(y) ? Math.min(Math.max(y, top), baseline) : baseline;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Distance from a reference line, or a band's upper edge, to its label's baseline. */
|
|
103
|
+
const THRESHOLD_LABEL_GAP = 5;
|
|
104
|
+
/** Inset from the plot's LEFT edge. The label sits at the start of the line rather than its end
|
|
105
|
+
* because a value label is centred on its column, and the last column's is the one nearest the
|
|
106
|
+
* edge the line stops at - measured on the docs demo, a right-anchored "Escalation" printed over
|
|
107
|
+
* the last column's own value. */
|
|
108
|
+
const THRESHOLD_LABEL_INSET = 4;
|
|
109
|
+
/** Every drawable coordinate of a chart's reference lines and bands, so the strokes and the labels
|
|
110
|
+
* - which paint in different layers, under the marks and over them - are laid out by one
|
|
111
|
+
* calculation rather than by two that can disagree.
|
|
112
|
+
*
|
|
113
|
+
* @internal */
|
|
114
|
+
function thresholdMarks(thresholds, plot, toY) {
|
|
115
|
+
return thresholds.map((threshold, index) => {
|
|
116
|
+
const y = toY(threshold.value);
|
|
117
|
+
const far = threshold.to == null ? y : toY(threshold.to);
|
|
118
|
+
const top = Math.min(y, far);
|
|
119
|
+
return {
|
|
120
|
+
key: index,
|
|
121
|
+
label: threshold.label ?? '',
|
|
122
|
+
color: threshold.color ?? null,
|
|
123
|
+
dash: threshold.dash ?? 'dashed',
|
|
124
|
+
band: threshold.to != null,
|
|
125
|
+
left: plot.left,
|
|
126
|
+
right: plot.left + plot.width,
|
|
127
|
+
width: plot.width,
|
|
128
|
+
y,
|
|
129
|
+
top,
|
|
130
|
+
height: Math.abs(y - far),
|
|
131
|
+
labelX: plot.left + THRESHOLD_LABEL_INSET,
|
|
132
|
+
labelY: top - THRESHOLD_LABEL_GAP,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** A tick row's index for the value zero, or `null` when the rows do not carry one.
|
|
137
|
+
*
|
|
138
|
+
* Two axes share gridlines only if they also share a zero: a second scale hung on the first's
|
|
139
|
+
* rows has to put its own zero on the same row, or a reading above the line on one axis sits
|
|
140
|
+
* below it on the other. */
|
|
141
|
+
function zeroRow(ticks) {
|
|
142
|
+
if (ticks.length < 2) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const step = ticks[1] - ticks[0];
|
|
146
|
+
if (!Number.isFinite(step) || step === 0) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const row = (0 - ticks[0]) / step;
|
|
150
|
+
const rounded = Math.round(row);
|
|
151
|
+
return Math.abs(row - rounded) < 1e-9 &&
|
|
152
|
+
rounded >= 0 &&
|
|
153
|
+
rounded < ticks.length
|
|
154
|
+
? rounded
|
|
155
|
+
: null;
|
|
156
|
+
}
|
|
157
|
+
/** The second value axis, as the four modes define it.
|
|
158
|
+
*
|
|
159
|
+
* `'rounded'` and `'exact'` hang the second scale on the first's tick rows and differ only in the
|
|
160
|
+
* step: `'rounded'` snaps it up to a round number and overshoots the data, `'exact'` takes the
|
|
161
|
+
* step the data needs and lands on it. `'independent'` and `'stacked'` nice the second domain on
|
|
162
|
+
* its own - stacked plots sit one above the other, so there is nothing to align.
|
|
163
|
+
*
|
|
164
|
+
* Falls back to an independent scale wherever alignment is not available: fewer than two rows, no
|
|
165
|
+
* shared zero row, or a domain whose sign has no rows on its side of that zero.
|
|
166
|
+
*
|
|
167
|
+
* @internal */
|
|
168
|
+
function secondaryAxis(primaryTicks, reported, tickCount, mode) {
|
|
169
|
+
let minimum = 0;
|
|
170
|
+
let maximum = 0;
|
|
171
|
+
for (const values of reported) {
|
|
172
|
+
const finite = values.filter((value) => Number.isFinite(value));
|
|
173
|
+
minimum = Math.min(minimum, domainMinOf(finite));
|
|
174
|
+
maximum = finite.reduce((highest, value) => Math.max(highest, value), maximum);
|
|
175
|
+
}
|
|
176
|
+
const independent = () => ({
|
|
177
|
+
domain: niceDomain(minimum, maximum, tickCount),
|
|
178
|
+
ticks: tickValues(minimum, maximum, tickCount),
|
|
179
|
+
aligned: false,
|
|
180
|
+
});
|
|
181
|
+
if (mode !== 'rounded' && mode !== 'exact') {
|
|
182
|
+
return independent();
|
|
183
|
+
}
|
|
184
|
+
const zero = zeroRow(primaryTicks);
|
|
185
|
+
if (zero === null) {
|
|
186
|
+
return independent();
|
|
187
|
+
}
|
|
188
|
+
const rowsAbove = primaryTicks.length - 1 - zero;
|
|
189
|
+
const rowsBelow = zero;
|
|
190
|
+
if ((maximum > 0 && rowsAbove === 0) || (minimum < 0 && rowsBelow === 0)) {
|
|
191
|
+
return independent();
|
|
192
|
+
}
|
|
193
|
+
const needed = Math.max(rowsAbove > 0 ? maximum / rowsAbove : 0, rowsBelow > 0 ? -minimum / rowsBelow : 0);
|
|
194
|
+
const step = mode === 'rounded' ? roundStepAtLeast(needed) : needed;
|
|
195
|
+
if (!Number.isFinite(step) || step <= 0) {
|
|
196
|
+
return {
|
|
197
|
+
domain: { min: 0, max: 0 },
|
|
198
|
+
ticks: primaryTicks.map(() => 0),
|
|
199
|
+
aligned: true,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
domain: { min: -rowsBelow * step, max: rowsAbove * step },
|
|
204
|
+
ticks: primaryTicks.map((_, row) => roundTick((row - zero) * step)),
|
|
205
|
+
aligned: true,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/** A step multiplied back out rarely lands on itself, and an axis label that prints
|
|
209
|
+
* `149.99999999999997` is the visible form of that. */
|
|
210
|
+
function roundTick(value) {
|
|
211
|
+
return Number(value.toFixed(6));
|
|
212
|
+
}
|
|
213
|
+
/** Every segment's span on the value axis, series-major: `offsets[series][category]`.
|
|
214
|
+
*
|
|
215
|
+
* `'none'` and `'grouped'` give every series the same span it would have alone - the two differ in
|
|
216
|
+
* where the band puts them, which is geometry rather than value. The stacking modes run a
|
|
217
|
+
* POSITIVE and a NEGATIVE pile per category, so a negative segment hangs below the baseline
|
|
218
|
+
* instead of being subtracted from the positive pile it sits in.
|
|
219
|
+
*
|
|
220
|
+
* `'normalized'` divides a running SUM rather than each share in turn: adding 20/60 to 40/60
|
|
221
|
+
* lands on 0.9999999999999999, which draws a category that visibly falls short of full.
|
|
222
|
+
*
|
|
223
|
+
* @internal */
|
|
224
|
+
function stackOffsets(series, mode) {
|
|
225
|
+
const reading = (value) => Number.isFinite(value) ? value : 0;
|
|
226
|
+
if (mode === 'none' || mode === 'grouped') {
|
|
227
|
+
return series.map((values) => values.map((value) => ({ from: 0, to: reading(value) })));
|
|
228
|
+
}
|
|
229
|
+
const magnitude = [];
|
|
230
|
+
if (mode === 'normalized') {
|
|
231
|
+
for (const values of series) {
|
|
232
|
+
values.forEach((value, category) => {
|
|
233
|
+
magnitude[category] =
|
|
234
|
+
(magnitude[category] ?? 0) + Math.abs(reading(value));
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const risen = [];
|
|
239
|
+
const fallen = [];
|
|
240
|
+
return series.map((values) => values.map((raw, category) => {
|
|
241
|
+
const value = reading(raw);
|
|
242
|
+
const pile = value < 0 ? fallen : risen;
|
|
243
|
+
const from = pile[category] ?? 0;
|
|
244
|
+
const to = from + value;
|
|
245
|
+
pile[category] = to;
|
|
246
|
+
const total = mode === 'normalized' ? (magnitude[category] ?? 0) : 1;
|
|
247
|
+
return total > 0
|
|
248
|
+
? { from: from / total, to: to / total }
|
|
249
|
+
: { from: 0, to: 0 };
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const CHART_SCALES = new InjectionToken('CHART_SCALES');
|
|
254
|
+
|
|
255
|
+
class ChartComponent {
|
|
256
|
+
/** The category axis. Every projected mark is positioned against this list, so its length is
|
|
257
|
+
* what decides how many bands the plot has. */
|
|
258
|
+
categories = input([], ...(ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []));
|
|
259
|
+
/** How many value-axis ticks to aim for. A hint, not a count: ticks snap to a round step, so
|
|
260
|
+
* the axis may carry one more or one fewer. */
|
|
261
|
+
tickCount = input(CHART_DEFAULT_TICK_COUNT, { ...(ngDevMode ? { debugName: "tickCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
262
|
+
/** Pins the floor of the value axis instead of deriving it from the marks. It only ever opens
|
|
263
|
+
* the axis further: a floor above the data would push readings off the plot. */
|
|
264
|
+
min = input(null, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
265
|
+
/** Pins the ceiling of the value axis. See `min`. Two charts drawn one subject at a time are
|
|
266
|
+
* only comparable when both are pinned. */
|
|
267
|
+
max = input(null, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
268
|
+
/** Height of the plot itself, in CSS pixels, axis labels and value headroom excluded. Real
|
|
269
|
+
* pixels rather than a share of the width: one viewBox unit is one pixel, so a card that
|
|
270
|
+
* widens spreads the categories further apart and leaves the plot exactly this tall. */
|
|
271
|
+
plotHeight = input(CHART_DEFAULT_PLOT_HEIGHT, { ...(ngDevMode ? { debugName: "plotHeight" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
272
|
+
/** Width in CSS pixels of the gutter down the left that carries the value-axis labels. Widen it
|
|
273
|
+
* for long tick labels; the plot takes whatever is left. */
|
|
274
|
+
axisGutter = input(CHART_DEFAULT_AXIS_GUTTER, { ...(ngDevMode ? { debugName: "axisGutter" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
275
|
+
/** Pixels reserved for a value label at each end of the plot: above the top tick for a mark at
|
|
276
|
+
* the ceiling, and below the baseline for a negative mark, whose label would otherwise print
|
|
277
|
+
* over the category labels. Reserved whether or not a mark draws one, because a chart that
|
|
278
|
+
* gains a label on one value must not change height. */
|
|
279
|
+
valueSpace = input(CHART_DEFAULT_VALUE_SPACE, { ...(ngDevMode ? { debugName: "valueSpace" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
280
|
+
/** Printed above the plot as the chart's visible title. */
|
|
281
|
+
caption = input(null, ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
282
|
+
/** Whether the projected marks answer to the pointer and the keyboard. The container draws no
|
|
283
|
+
* marks of its own and only reads this for the plot's role: a group of controls to step
|
|
284
|
+
* through, against a single image to be described. */
|
|
285
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
286
|
+
/** Accessible name for the plot. The container holds no readings of its own, so a chart that
|
|
287
|
+
* needs its numbers described supplies the sentence here - `describeSeries` is what the five
|
|
288
|
+
* presets build it with. It is the whole label in the static case, where nothing else is
|
|
289
|
+
* reachable. */
|
|
290
|
+
summary = input(null, ...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
291
|
+
/** Whether the chart draws its own bordered, padded box. `'auto'`, the default, draws it;
|
|
292
|
+
* `'none'` leaves it bare, for one placed inside a card the page has already drawn. Unset
|
|
293
|
+
* falls back to `DS_CONFIG.chart.frame`, then `'auto'`. */
|
|
294
|
+
frame = input(null, ...(ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []));
|
|
295
|
+
/** Draws a placeholder in place of the plot, at the plot's own height, so the page does not
|
|
296
|
+
* resize when the data lands. */
|
|
297
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
298
|
+
/** Shown in place of the plot when `categories` is empty. Unset falls back to
|
|
299
|
+
* `DS_CONFIG.chart.emptyText`, then `'No data'`. */
|
|
300
|
+
emptyText = input(null, ...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
301
|
+
/** Shows `errorText` in place of the plot. Separate from `loading` and from an empty
|
|
302
|
+
* `categories`, because "the request failed" and "there is nothing to show" read the same to a
|
|
303
|
+
* reader and mean opposite things. */
|
|
304
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
305
|
+
/** The message the error state prints. Unset falls back to `DS_CONFIG.chart.errorText`, then
|
|
306
|
+
* `'Could not load the data'`. */
|
|
307
|
+
errorText = input(null, ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
308
|
+
/** Formats the value-axis ticks. Unset falls back to `DS_CONFIG.chart.valueFormat`, then the
|
|
309
|
+
* browser's locale grouping with a K/M/B suffix past four digits. */
|
|
310
|
+
valueFormat = input(null, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
311
|
+
/** How the second value axis relates to the first, once a mark has reported against it. The
|
|
312
|
+
* same four words `ds-line-chart` takes. */
|
|
313
|
+
secondaryAxisMode = input('rounded', ...(ngDevMode ? [{ debugName: "secondaryAxisMode" }] : /* istanbul ignore next */ []));
|
|
314
|
+
/** Paints the first axis's tick labels in the colour of the marks measured against it. A
|
|
315
|
+
* two-scale plot is ambiguous without it - nothing on the canvas says which of two lines is
|
|
316
|
+
* read against which set of numbers - and it is the author, not the container, who knows which
|
|
317
|
+
* colour an axis belongs to, because several marks can share one. */
|
|
318
|
+
axisColor = input(null, ...(ngDevMode ? [{ debugName: "axisColor" }] : /* istanbul ignore next */ []));
|
|
319
|
+
/** `axisColor` for the second axis. */
|
|
320
|
+
secondaryAxisColor = input(null, ...(ngDevMode ? [{ debugName: "secondaryAxisColor" }] : /* istanbul ignore next */ []));
|
|
321
|
+
frameResolved = resolveWithConfig(this.frame, (config) => config.chart?.frame, 'auto');
|
|
322
|
+
emptyTextResolved = resolveWithConfig(this.emptyText, (config) => config.chart?.emptyText, 'No data');
|
|
323
|
+
errorTextResolved = resolveWithConfig(this.errorText, (config) => config.chart?.errorText, 'Could not load the data');
|
|
324
|
+
valueFormatResolved = resolveWithConfig(this.valueFormat, (config) => config.chart?.valueFormat, defaultChartFormat);
|
|
325
|
+
host = inject(ElementRef);
|
|
326
|
+
/** The `<svg>`'s own rendered width: `:host(.framed)` carries the frame padding, so the host's
|
|
327
|
+
* CONTENT box - which is what a `ResizeObserver` reports - is the box the canvas fills at
|
|
328
|
+
* `inline-size: 100%`. Measuring the host is therefore measuring the canvas. */
|
|
329
|
+
measuredWidth = elementWidth(this.host);
|
|
330
|
+
viewWidth = computed(() => this.measuredWidth() || CHART_FALLBACK_WIDTH, ...(ngDevMode ? [{ debugName: "viewWidth" }] : /* istanbul ignore next */ []));
|
|
331
|
+
/** Whether the marks may animate yet. The first frame draws at `CHART_FALLBACK_WIDTH` scaled to
|
|
332
|
+
* fit, so the measurement that follows moves every mark - and a mark that transitions its
|
|
333
|
+
* geometry would play that correction as an animated slide on every load, hydration included.
|
|
334
|
+
*
|
|
335
|
+
* Two frames, not one. A transition starts when the property changes in a style that also
|
|
336
|
+
* enables it, so the enabling must not land in the same style recalculation as the correction.
|
|
337
|
+
* One `requestAnimationFrame` is not enough: scheduled from the change detection that writes
|
|
338
|
+
* the corrected geometry, it runs at the START of the next frame, still before that geometry
|
|
339
|
+
* has been through a recalculation. Measured with one frame: `transitionrun` on `x` and
|
|
340
|
+
* `width`, both marks, on the same tick the class cleared. */
|
|
341
|
+
settled = signal(false, ...(ngDevMode ? [{ debugName: "settled" }] : /* istanbul ignore next */ []));
|
|
342
|
+
constructor() {
|
|
343
|
+
effect((onCleanup) => {
|
|
344
|
+
if (this.settled() || this.measuredWidth() === 0) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
let second = 0;
|
|
348
|
+
const first = requestAnimationFrame(() => {
|
|
349
|
+
second = requestAnimationFrame(() => this.settled.set(true));
|
|
350
|
+
});
|
|
351
|
+
onCleanup(() => {
|
|
352
|
+
cancelAnimationFrame(first);
|
|
353
|
+
cancelAnimationFrame(second);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
// The read phase, so every `getComputedTextLength` lands in one batch before any write:
|
|
357
|
+
// interleaving them forces a synchronous layout per label.
|
|
358
|
+
afterRenderEffect({
|
|
359
|
+
read: () => {
|
|
360
|
+
this.measuredLabelWidth.set(this.widestLabel('.axis-label.is-primary'));
|
|
361
|
+
this.measuredSecondaryLabelWidth.set(this.widestLabel('.axis-label.is-secondary'));
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
widestLabel(selector) {
|
|
366
|
+
const labels = this.host.nativeElement.querySelectorAll(selector);
|
|
367
|
+
let widest = 0;
|
|
368
|
+
for (const label of labels) {
|
|
369
|
+
widest = Math.max(widest, label.getComputedTextLength());
|
|
370
|
+
}
|
|
371
|
+
return Math.ceil(widest);
|
|
372
|
+
}
|
|
373
|
+
/** Two plots, one above the other, sharing the category axis: the only mode whose second axis
|
|
374
|
+
* is a second PLOT rather than a second scale over the first. */
|
|
375
|
+
stacked = computed(() => this.secondaryAxisMode() === 'stacked' && this.hasSecondaryAxis(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
376
|
+
viewHeight = computed(() => chartViewHeight(this.plotHeight(), this.valueSpace(), this.reachesBelowZero()) + (this.stacked() ? this.plotHeight() + CHART_STACKED_PLOT_GAP : 0), ...(ngDevMode ? [{ debugName: "viewHeight" }] : /* istanbul ignore next */ []));
|
|
377
|
+
/** One viewBox unit is one CSS pixel, in both axes. That is the whole point of measuring: a
|
|
378
|
+
* radius, a gutter or a width cap set anywhere inside the plot is then the length it says it
|
|
379
|
+
* is, at every card width, instead of a share of one that a fixed viewBox stretches. */
|
|
380
|
+
viewBox = computed(() => `0 0 ${this.viewWidth()} ${this.viewHeight()}`, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
381
|
+
/** Widest tick label actually rendered, in the CSS pixels the canvas is drawn in. Zero until the
|
|
382
|
+
* first read, and zero under SSR, where `axisGutter` alone decides. */
|
|
383
|
+
measuredLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredLabelWidth" }] : /* istanbul ignore next */ []));
|
|
384
|
+
/** `axisGutter` is the FLOOR, not the answer: a compact number is far wider in some locales than
|
|
385
|
+
* in others - `3,5 тыс.` against `3.5k` - and an SVG canvas CLIPS what a DOM column merely
|
|
386
|
+
* overflowed, so a fixed gutter silently eats the leading digit. The gutter takes whichever is
|
|
387
|
+
* larger, so setting the token still guarantees at least that much room.
|
|
388
|
+
*
|
|
389
|
+
* This converges rather than oscillating: a tick's TEXT is decided by the domain and the tick
|
|
390
|
+
* count, neither of which the gutter feeds, so widening it moves the labels without rewriting
|
|
391
|
+
* them and the second measurement equals the first. */
|
|
392
|
+
effectiveAxisGutter = computed(() => Math.max(this.axisGutter(), this.measuredLabelWidth() + CHART_AXIS_LABEL_GAP), ...(ngDevMode ? [{ debugName: "effectiveAxisGutter" }] : /* istanbul ignore next */ []));
|
|
393
|
+
/** Widest secondary tick label, measured the same way and for the same reason as the primary
|
|
394
|
+
* one: those labels sit OUTSIDE the plot's right edge and an SVG canvas clips what a DOM
|
|
395
|
+
* column merely overflowed. */
|
|
396
|
+
measuredSecondaryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredSecondaryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
397
|
+
/** The plot gives the right-hand labels room only when they are drawn there - a stacked second
|
|
398
|
+
* axis puts both label columns down the left, so the plot keeps the full width. */
|
|
399
|
+
rightGutter = computed(() => this.hasSecondaryAxis() && !this.stacked()
|
|
400
|
+
? Math.max(this.axisGutter(), this.measuredSecondaryLabelWidth() + CHART_AXIS_LABEL_GAP)
|
|
401
|
+
: CHART_EDGE_GUTTER, ...(ngDevMode ? [{ debugName: "rightGutter" }] : /* istanbul ignore next */ []));
|
|
402
|
+
plot = computed(() => chartPlot(this.viewWidth(), this.plotHeight(), this.effectiveAxisGutter(), this.valueSpace(), this.rightGutter()), ...(ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []));
|
|
403
|
+
secondaryPlot = computed(() => {
|
|
404
|
+
const plot = this.plot();
|
|
405
|
+
return this.stacked()
|
|
406
|
+
? { ...plot, top: plot.top + plot.height + CHART_STACKED_PLOT_GAP }
|
|
407
|
+
: plot;
|
|
408
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryPlot" }] : /* istanbul ignore next */ []));
|
|
409
|
+
reportedDomains = signal(new Map(), ...(ngDevMode ? [{ debugName: "reportedDomains" }] : /* istanbul ignore next */ []));
|
|
410
|
+
reportDomain(id, values, axis = 'primary') {
|
|
411
|
+
this.reportedDomains.update((reported) => new Map(reported).set(id, { axis, values }));
|
|
412
|
+
}
|
|
413
|
+
valuesOn(axis) {
|
|
414
|
+
const found = [];
|
|
415
|
+
for (const report of this.reportedDomains().values()) {
|
|
416
|
+
if (report.axis === axis) {
|
|
417
|
+
found.push(report.values);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return found;
|
|
421
|
+
}
|
|
422
|
+
releaseDomain(id) {
|
|
423
|
+
this.reportedDomains.update((reported) => {
|
|
424
|
+
const next = new Map(reported);
|
|
425
|
+
next.delete(id);
|
|
426
|
+
return next;
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/** Compared by value, which is what stops a mark that reports AND reads `yPosition()` in one
|
|
430
|
+
* effect from running forever: every report allocates a fresh `Map` and `niceDomain` a fresh
|
|
431
|
+
* object, so identity always differs and the read would re-arm the write. Measured without it:
|
|
432
|
+
* 97507 effect runs in 45 seconds, no Angular loop error, renderer unresponsive. */
|
|
433
|
+
domain = computed(() => axisDomain(this.valuesOn('primary'), this.tickCount(), this.min(), this.max()), { ...(ngDevMode ? { debugName: "domain" } : /* istanbul ignore next */ {}), equal: (a, b) => a.min === b.min && a.max === b.max });
|
|
434
|
+
hasSecondaryAxis = computed(() => this.valuesOn('secondary').length > 0, ...(ngDevMode ? [{ debugName: "hasSecondaryAxis" }] : /* istanbul ignore next */ []));
|
|
435
|
+
secondary = computed(() => secondaryAxis(this.ticks().map((tick) => tick.value), this.valuesOn('secondary'), this.tickCount(), this.secondaryAxisMode()), { ...(ngDevMode ? { debugName: "secondary" } : /* istanbul ignore next */ {}), equal: (a, b) => a.aligned === b.aligned &&
|
|
436
|
+
a.domain.min === b.domain.min &&
|
|
437
|
+
a.domain.max === b.domain.max &&
|
|
438
|
+
a.ticks.length === b.ticks.length &&
|
|
439
|
+
a.ticks.every((tick, index) => tick === b.ticks[index]) });
|
|
440
|
+
secondaryYPosition = computed(() => {
|
|
441
|
+
if (!this.hasSecondaryAxis()) {
|
|
442
|
+
return this.yPosition();
|
|
443
|
+
}
|
|
444
|
+
const plot = this.secondaryPlot();
|
|
445
|
+
return valueScale(this.secondary().domain, plot.top, plot.height);
|
|
446
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryYPosition" }] : /* istanbul ignore next */ []));
|
|
447
|
+
secondaryTicks = computed(() => {
|
|
448
|
+
if (!this.hasSecondaryAxis()) {
|
|
449
|
+
return [];
|
|
450
|
+
}
|
|
451
|
+
const toY = this.secondaryYPosition();
|
|
452
|
+
const format = this.valueFormatResolved();
|
|
453
|
+
return this.secondary().ticks.map((value) => ({
|
|
454
|
+
value,
|
|
455
|
+
y: toY(value),
|
|
456
|
+
label: format(value, 'tick'),
|
|
457
|
+
}));
|
|
458
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryTicks" }] : /* istanbul ignore next */ []));
|
|
459
|
+
/** A second set of gridlines only where the two scales do NOT share rows: drawn against an
|
|
460
|
+
* aligned axis they would land on the primary's own lines and double every stroke. */
|
|
461
|
+
showSecondaryGridlines = computed(() => this.hasSecondaryAxis() &&
|
|
462
|
+
(this.stacked() || !this.secondary().aligned) &&
|
|
463
|
+
this.secondaryTicks().length > 1, ...(ngDevMode ? [{ debugName: "showSecondaryGridlines" }] : /* istanbul ignore next */ []));
|
|
464
|
+
secondaryLabelX = computed(() => this.stacked()
|
|
465
|
+
? this.plot().left - CHART_AXIS_LABEL_GAP
|
|
466
|
+
: this.plot().left + this.plot().width + CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "secondaryLabelX" }] : /* istanbul ignore next */ []));
|
|
467
|
+
secondaryLabelAnchor = computed(() => this.stacked() ? 'end' : 'start', ...(ngDevMode ? [{ debugName: "secondaryLabelAnchor" }] : /* istanbul ignore next */ []));
|
|
468
|
+
secondaryPlotBottom = computed(() => this.secondaryPlot().top + this.secondaryPlot().height, ...(ngDevMode ? [{ debugName: "secondaryPlotBottom" }] : /* istanbul ignore next */ []));
|
|
469
|
+
/** No tint on a single-scale plot: one axis needs no telling apart, and colouring it would only
|
|
470
|
+
* restate the marks' own colour in the furniture. */
|
|
471
|
+
axisLabelFill = computed(() => this.hasSecondaryAxis() ? this.axisColor() : null, ...(ngDevMode ? [{ debugName: "axisLabelFill" }] : /* istanbul ignore next */ []));
|
|
472
|
+
secondaryAxisLabelFill = computed(() => this.secondaryAxisColor(), ...(ngDevMode ? [{ debugName: "secondaryAxisLabelFill" }] : /* istanbul ignore next */ []));
|
|
473
|
+
bands = computed(() => bandScale(this.categories().length, this.plot().width, CHART_BAND_PADDING), ...(ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []));
|
|
474
|
+
bandWidth = computed(() => this.bands().bandWidth, ...(ngDevMode ? [{ debugName: "bandWidth" }] : /* istanbul ignore next */ []));
|
|
475
|
+
xPosition = computed(() => {
|
|
476
|
+
const plot = this.plot();
|
|
477
|
+
const bands = this.bands();
|
|
478
|
+
return (index) => plot.left + bands.position(index) + bands.bandWidth / 2;
|
|
479
|
+
}, ...(ngDevMode ? [{ debugName: "xPosition" }] : /* istanbul ignore next */ []));
|
|
480
|
+
yPosition = computed(() => {
|
|
481
|
+
const plot = this.plot();
|
|
482
|
+
return valueScale(this.domain(), plot.top, plot.height);
|
|
483
|
+
}, ...(ngDevMode ? [{ debugName: "yPosition" }] : /* istanbul ignore next */ []));
|
|
484
|
+
zeroOffset = computed(() => this.yPosition()(0), ...(ngDevMode ? [{ debugName: "zeroOffset" }] : /* istanbul ignore next */ []));
|
|
485
|
+
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
486
|
+
setActiveIndex(index) {
|
|
487
|
+
const last = this.categories().length - 1;
|
|
488
|
+
this.activeIndex.set(Number.isFinite(index)
|
|
489
|
+
? Math.min(Math.max(Math.trunc(index), -1), last)
|
|
490
|
+
: -1);
|
|
491
|
+
}
|
|
492
|
+
plotRight = computed(() => this.plot().left + this.plot().width, ...(ngDevMode ? [{ debugName: "plotRight" }] : /* istanbul ignore next */ []));
|
|
493
|
+
plotBottom = computed(() => this.plot().top + this.plot().height, ...(ngDevMode ? [{ debugName: "plotBottom" }] : /* istanbul ignore next */ []));
|
|
494
|
+
axisLabelX = computed(() => this.plot().left - CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "axisLabelX" }] : /* istanbul ignore next */ []));
|
|
495
|
+
/** Clears the same reservation the view height budgets, and only when it is there: adding it
|
|
496
|
+
* unconditionally would drop the labels past a viewBox that no longer holds the space. */
|
|
497
|
+
categoryLabelY = computed(() => this.secondaryPlotBottom() +
|
|
498
|
+
(this.reachesBelowZero() ? this.valueSpace() : 0) +
|
|
499
|
+
CHART_CATEGORY_LABEL_OFFSET, ...(ngDevMode ? [{ debugName: "categoryLabelY" }] : /* istanbul ignore next */ []));
|
|
500
|
+
ticks = computed(() => {
|
|
501
|
+
const domain = this.domain();
|
|
502
|
+
const toY = this.yPosition();
|
|
503
|
+
const format = this.valueFormatResolved();
|
|
504
|
+
return tickValues(domain.min, domain.max, this.tickCount()).map((value) => ({
|
|
505
|
+
value,
|
|
506
|
+
y: toY(value),
|
|
507
|
+
label: format(value, 'tick'),
|
|
508
|
+
}));
|
|
509
|
+
}, ...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
510
|
+
categoryLabels = computed(() => {
|
|
511
|
+
const toX = this.xPosition();
|
|
512
|
+
return this.categories().map((text, index) => ({ x: toX(index), text }));
|
|
513
|
+
}, ...(ngDevMode ? [{ debugName: "categoryLabels" }] : /* istanbul ignore next */ []));
|
|
514
|
+
reachesBelowZero = computed(() => this.domain().min < 0, ...(ngDevMode ? [{ debugName: "reachesBelowZero" }] : /* istanbul ignore next */ []));
|
|
515
|
+
/** Empty is read off `categories` alone, never off the reported domains: the marks are
|
|
516
|
+
* projected INTO the branch that this decides, so a container that waited for a report before
|
|
517
|
+
* rendering them would never receive one. */
|
|
518
|
+
isEmpty = computed(() => this.categories().length === 0, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
519
|
+
accessibleName = computed(() => this.summary() ?? this.caption() ?? 'Chart', ...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
520
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
521
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartComponent, isStandalone: true, selector: "ds-chart", inputs: { categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, tickCount: { classPropertyName: "tickCount", publicName: "tickCount", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, plotHeight: { classPropertyName: "plotHeight", publicName: "plotHeight", isSignal: true, isRequired: false, transformFunction: null }, axisGutter: { classPropertyName: "axisGutter", publicName: "axisGutter", isSignal: true, isRequired: false, transformFunction: null }, valueSpace: { classPropertyName: "valueSpace", publicName: "valueSpace", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null }, summary: { classPropertyName: "summary", publicName: "summary", isSignal: true, isRequired: false, transformFunction: null }, frame: { classPropertyName: "frame", publicName: "frame", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorText: { classPropertyName: "errorText", publicName: "errorText", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null }, secondaryAxisMode: { classPropertyName: "secondaryAxisMode", publicName: "secondaryAxisMode", isSignal: true, isRequired: false, transformFunction: null }, axisColor: { classPropertyName: "axisColor", publicName: "axisColor", isSignal: true, isRequired: false, transformFunction: null }, secondaryAxisColor: { classPropertyName: "secondaryAxisColor", publicName: "secondaryAxisColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.framed": "frameResolved() === 'auto'", "class.measuring": "!settled()", "style.--_chart-view-height": "viewHeight() + 'px'" } }, providers: [
|
|
522
|
+
{
|
|
523
|
+
provide: CHART_SCALES,
|
|
524
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
525
|
+
},
|
|
526
|
+
], ngImport: i0, template: "<figure class=\"chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorTextResolved() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n <ds-skeleton height=\"var(--_chart-view-height)\" />\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyTextResolved() }}\n </p>\n } @else {\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\">\n <svg\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <!-- Hidden as a group rather than on the svg: a projected mark may be focusable, and an\n aria-hidden ancestor would leave it reachable by Tab and invisible to a reader. -->\n <g\n class=\"axes\"\n aria-hidden=\"true\">\n @for (tick of ticks(); track tick.value) {\n <line\n class=\"grid-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\" />\n }\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"plotBottom()\"\n [attr.y2]=\"plotBottom()\" />\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plot().left\"\n [attr.y1]=\"plot().top\"\n [attr.y2]=\"plotBottom()\" />\n\n @if (showSecondaryGridlines()) {\n @for (tick of secondaryTicks(); track tick.value) {\n <line\n class=\"grid-line is-secondary\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\" />\n }\n }\n\n @if (stacked()) {\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"secondaryPlotBottom()\"\n [attr.y2]=\"secondaryPlotBottom()\" />\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plot().left\"\n [attr.y1]=\"secondaryPlot().top\"\n [attr.y2]=\"secondaryPlotBottom()\" />\n }\n\n @if (reachesBelowZero()) {\n <line\n class=\"zero-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"zeroOffset()\"\n [attr.y2]=\"zeroOffset()\" />\n }\n </g>\n\n <!-- Two slots, one group: a reference line has to paint UNDER the marks whatever order the\n consumer wrote it in, and a selected slot is what decides that instead of the author.\n Both stay inside `.marks`, which is what the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @for (tick of ticks(); track tick.value) {\n <text\n class=\"axis-label is-primary\"\n text-anchor=\"end\"\n [style.fill]=\"axisLabelFill()\"\n [attr.x]=\"axisLabelX()\"\n [attr.y]=\"tick.y\">\n {{ tick.label }}\n </text>\n }\n\n @for (tick of secondaryTicks(); track tick.value) {\n <text\n class=\"axis-label is-secondary\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.text-anchor]=\"secondaryLabelAnchor()\"\n [attr.x]=\"secondaryLabelX()\"\n [attr.y]=\"tick.y\">\n {{ tick.label }}\n </text>\n }\n\n @for (label of categoryLabels(); track $index) {\n <text\n class=\"category-label\"\n text-anchor=\"middle\"\n [attr.x]=\"label.x\"\n [attr.y]=\"categoryLabelY()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks, where `.marks` is under them: an annotation's LINE is furniture and\n belongs below the readings, its NAME has to survive a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel]\" />\n </g>\n </svg>\n </div>\n }\n</figure>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:block;-webkit-user-select:none;user-select:none}:host(.framed){padding:var(--ds-chart-frame-padding);background:var(--ds-chart-frame-bg-color);border:var(--ds-chart-frame-border-width) solid var(--ds-chart-frame-border-color);border-radius:var(--ds-chart-frame-radius)}.data-table,.stage-table,figcaption{-webkit-user-select:text;user-select:text}.chart{--_chart-grid-line-color: var(--ds-chart-grid-line-color, var(--chart-grid-line-color));--_chart-axis-line-color: var(--ds-chart-axis-line-color, var(--chart-axis-line-color));--_chart-axis-label-color: var(--ds-chart-axis-label-color, var(--chart-axis-label-color));--_chart-axis-font-size: var(--ds-chart-axis-font-size, var(--chart-axis-font-size));margin:0}figcaption{margin-block-end:var(--space-3);color:var(--text-primary);font-weight:600}.empty{display:grid;place-items:center;min-block-size:var(--_chart-view-height);margin:0;color:var(--text-secondary);text-align:center;border-inline-start:1px solid var(--ds-chart-axis-line-color);border-block-end:1px solid var(--ds-chart-axis-line-color)}.canvas{display:block;inline-size:100%}:host(.measuring) .marks ::ng-deep *{transition-duration:0ms!important}.grid-line{stroke:var(--_chart-grid-line-color);stroke-width:1}.axis-line,.zero-line{stroke:var(--_chart-axis-line-color);stroke-width:1}.axis-label,.category-label{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size)}.axis-label{dominant-baseline:middle}@media(forced-colors:active){.axis-line,.grid-line{stroke:CanvasText}.axis-label,.category-label{fill:CanvasText}:focus-visible{stroke:Highlight;filter:none}}\n"], dependencies: [{ kind: "component", type: SkeletonComponent, selector: "ds-skeleton", inputs: ["width", "height", "circle", "inline"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
527
|
+
}
|
|
528
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, decorators: [{
|
|
529
|
+
type: Component,
|
|
530
|
+
args: [{ selector: 'ds-chart', standalone: true, imports: [SkeletonComponent], host: {
|
|
531
|
+
'[class.framed]': "frameResolved() === 'auto'",
|
|
532
|
+
'[class.measuring]': '!settled()',
|
|
533
|
+
'[style.--_chart-view-height]': "viewHeight() + 'px'",
|
|
534
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
535
|
+
{
|
|
536
|
+
provide: CHART_SCALES,
|
|
537
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
538
|
+
},
|
|
539
|
+
], template: "<figure class=\"chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorTextResolved() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n <ds-skeleton height=\"var(--_chart-view-height)\" />\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyTextResolved() }}\n </p>\n } @else {\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\">\n <svg\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <!-- Hidden as a group rather than on the svg: a projected mark may be focusable, and an\n aria-hidden ancestor would leave it reachable by Tab and invisible to a reader. -->\n <g\n class=\"axes\"\n aria-hidden=\"true\">\n @for (tick of ticks(); track tick.value) {\n <line\n class=\"grid-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\" />\n }\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"plotBottom()\"\n [attr.y2]=\"plotBottom()\" />\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plot().left\"\n [attr.y1]=\"plot().top\"\n [attr.y2]=\"plotBottom()\" />\n\n @if (showSecondaryGridlines()) {\n @for (tick of secondaryTicks(); track tick.value) {\n <line\n class=\"grid-line is-secondary\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\" />\n }\n }\n\n @if (stacked()) {\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"secondaryPlotBottom()\"\n [attr.y2]=\"secondaryPlotBottom()\" />\n\n <line\n class=\"axis-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plot().left\"\n [attr.y1]=\"secondaryPlot().top\"\n [attr.y2]=\"secondaryPlotBottom()\" />\n }\n\n @if (reachesBelowZero()) {\n <line\n class=\"zero-line\"\n [attr.x1]=\"plot().left\"\n [attr.x2]=\"plotRight()\"\n [attr.y1]=\"zeroOffset()\"\n [attr.y2]=\"zeroOffset()\" />\n }\n </g>\n\n <!-- Two slots, one group: a reference line has to paint UNDER the marks whatever order the\n consumer wrote it in, and a selected slot is what decides that instead of the author.\n Both stay inside `.marks`, which is what the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @for (tick of ticks(); track tick.value) {\n <text\n class=\"axis-label is-primary\"\n text-anchor=\"end\"\n [style.fill]=\"axisLabelFill()\"\n [attr.x]=\"axisLabelX()\"\n [attr.y]=\"tick.y\">\n {{ tick.label }}\n </text>\n }\n\n @for (tick of secondaryTicks(); track tick.value) {\n <text\n class=\"axis-label is-secondary\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.text-anchor]=\"secondaryLabelAnchor()\"\n [attr.x]=\"secondaryLabelX()\"\n [attr.y]=\"tick.y\">\n {{ tick.label }}\n </text>\n }\n\n @for (label of categoryLabels(); track $index) {\n <text\n class=\"category-label\"\n text-anchor=\"middle\"\n [attr.x]=\"label.x\"\n [attr.y]=\"categoryLabelY()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks, where `.marks` is under them: an annotation's LINE is furniture and\n belongs below the readings, its NAME has to survive a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel]\" />\n </g>\n </svg>\n </div>\n }\n</figure>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{display:block;-webkit-user-select:none;user-select:none}:host(.framed){padding:var(--ds-chart-frame-padding);background:var(--ds-chart-frame-bg-color);border:var(--ds-chart-frame-border-width) solid var(--ds-chart-frame-border-color);border-radius:var(--ds-chart-frame-radius)}.data-table,.stage-table,figcaption{-webkit-user-select:text;user-select:text}.chart{--_chart-grid-line-color: var(--ds-chart-grid-line-color, var(--chart-grid-line-color));--_chart-axis-line-color: var(--ds-chart-axis-line-color, var(--chart-axis-line-color));--_chart-axis-label-color: var(--ds-chart-axis-label-color, var(--chart-axis-label-color));--_chart-axis-font-size: var(--ds-chart-axis-font-size, var(--chart-axis-font-size));margin:0}figcaption{margin-block-end:var(--space-3);color:var(--text-primary);font-weight:600}.empty{display:grid;place-items:center;min-block-size:var(--_chart-view-height);margin:0;color:var(--text-secondary);text-align:center;border-inline-start:1px solid var(--ds-chart-axis-line-color);border-block-end:1px solid var(--ds-chart-axis-line-color)}.canvas{display:block;inline-size:100%}:host(.measuring) .marks ::ng-deep *{transition-duration:0ms!important}.grid-line{stroke:var(--_chart-grid-line-color);stroke-width:1}.axis-line,.zero-line{stroke:var(--_chart-axis-line-color);stroke-width:1}.axis-label,.category-label{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size)}.axis-label{dominant-baseline:middle}@media(forced-colors:active){.axis-line,.grid-line{stroke:CanvasText}.axis-label,.category-label{fill:CanvasText}:focus-visible{stroke:Highlight;filter:none}}\n"] }]
|
|
540
|
+
}], ctorParameters: () => [], propDecorators: { categories: [{ type: i0.Input, args: [{ isSignal: true, alias: "categories", required: false }] }], tickCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "tickCount", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], plotHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "plotHeight", required: false }] }], axisGutter: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisGutter", required: false }] }], valueSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueSpace", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], interactive: [{ type: i0.Input, args: [{ isSignal: true, alias: "interactive", required: false }] }], summary: [{ type: i0.Input, args: [{ isSignal: true, alias: "summary", required: false }] }], frame: [{ type: i0.Input, args: [{ isSignal: true, alias: "frame", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorText: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorText", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], secondaryAxisMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryAxisMode", required: false }] }], axisColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisColor", required: false }] }], secondaryAxisColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryAxisColor", required: false }] }] } });
|
|
541
|
+
|
|
542
|
+
/** The disc's radius, and half the glyph's box, in the same CSS pixels the plot is drawn in. */
|
|
543
|
+
const PIN_DISC_RADIUS = 11;
|
|
544
|
+
const PIN_GLYPH_SIZE = 14;
|
|
545
|
+
/** Distance from a mark's own tip to its value label's baseline. */
|
|
546
|
+
const VALUE_LABEL_GAP = 8;
|
|
547
|
+
/** Blank left at a stacked segment's lower end, so the boundary between two segments is a gap in
|
|
548
|
+
* the surface colour rather than a drawn rule. A rule is a third ink the palette has to stay
|
|
549
|
+
* legible against and it vanishes in print; a gap survives both, and it is the secondary encoding
|
|
550
|
+
* the palette's 6-8 dE separation band asks for. */
|
|
551
|
+
const STACK_SEGMENT_GAP = 2;
|
|
552
|
+
let nextSeriesId$1 = 0;
|
|
553
|
+
/**
|
|
554
|
+
* One column per datum, drawn against the scales `ds-chart` supplies.
|
|
555
|
+
*
|
|
556
|
+
* Hosted on a `<g>` rather than an element of its own: an element the SVG specification does not
|
|
557
|
+
* know is not rendered, and neither are its descendants, so `<ds-column-series>` inside the
|
|
558
|
+
* container's canvas would draw nothing. Written as `<svg:g dsColumnSeries>`.
|
|
559
|
+
*
|
|
560
|
+
* @internal
|
|
561
|
+
*/
|
|
562
|
+
class ColumnSeriesComponent {
|
|
563
|
+
scales = inject(CHART_SCALES);
|
|
564
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this same
|
|
565
|
+
* element, and a required input throws NG0950 for the pass before its own value is written. */
|
|
566
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
567
|
+
showValues = input(true, { ...(ngDevMode ? { debugName: "showValues" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
568
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
569
|
+
pinOnClick = input(false, { ...(ngDevMode ? { debugName: "pinOnClick" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
570
|
+
dimOthers = input(false, { ...(ngDevMode ? { debugName: "dimOthers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
571
|
+
staggerMs = input(0, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
572
|
+
partOfWhole = input(false, { ...(ngDevMode ? { debugName: "partOfWhole" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
573
|
+
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
574
|
+
tooltipAnchor = input('mark', ...(ngDevMode ? [{ debugName: "tooltipAnchor" }] : /* istanbul ignore next */ []));
|
|
575
|
+
tooltipLingerMs = input(0, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
576
|
+
valueFormat = input(defaultChartFormat, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
577
|
+
/** The mark's share of its category's own slot, before the maximum width caps it. Measured off
|
|
578
|
+
* the slot rather than off `bandWidth()`, which has the container's own padding already taken
|
|
579
|
+
* out of it - applying both would narrow every uncapped column twice. */
|
|
580
|
+
columnWidthRatio = input(0.8, { ...(ngDevMode ? { debugName: "columnWidthRatio" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
581
|
+
/** This series' position among the slots a category's band is divided into. */
|
|
582
|
+
slot = input(0, { ...(ngDevMode ? { debugName: "slot" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
583
|
+
/** How many slots the band is divided into - the number of series drawn side by side. One, the
|
|
584
|
+
* default, is the whole band, which is what a single series has always taken. */
|
|
585
|
+
slotCount = input(1, { ...(ngDevMode ? { debugName: "slotCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
586
|
+
/** Where each mark starts and ends on the value axis, one entry per point. Unset, every mark
|
|
587
|
+
* runs from zero to its own value, which is the unstacked case. */
|
|
588
|
+
offsets = input(null, ...(ngDevMode ? [{ debugName: "offsets" }] : /* istanbul ignore next */ []));
|
|
589
|
+
/** One colour for the whole series, which is what several series drawn together need. Unset,
|
|
590
|
+
* each mark takes the categorical palette by its own position - the right reading when the
|
|
591
|
+
* marks ARE the categories, which is the single-series case. A point's own colour wins over
|
|
592
|
+
* both. */
|
|
593
|
+
seriesColor = input(null, ...(ngDevMode ? [{ debugName: "seriesColor" }] : /* istanbul ignore next */ []));
|
|
594
|
+
/** `seriesColor` for the fill pattern. A point's own `fill` wins. */
|
|
595
|
+
seriesFill = input(null, ...(ngDevMode ? [{ debugName: "seriesFill" }] : /* istanbul ignore next */ []));
|
|
596
|
+
/** Names the series in the tooltip, where the category then becomes the panel's heading. Unset,
|
|
597
|
+
* the panel names the category instead, which is what a chart of one series has to say. */
|
|
598
|
+
seriesLabel = input(null, ...(ngDevMode ? [{ debugName: "seriesLabel" }] : /* istanbul ignore next */ []));
|
|
599
|
+
pointClicked = output();
|
|
600
|
+
seriesId = nextSeriesId$1++;
|
|
601
|
+
domainId = `column-series-${this.seriesId}`;
|
|
602
|
+
/** Per instance: two charts on one page would otherwise share the first `<pattern>` to reach the
|
|
603
|
+
* document, and every hatched mark would take that chart's colour. */
|
|
604
|
+
hatchId = `ds-column-hatch-${this.seriesId}`;
|
|
605
|
+
/** Where each mark actually spans, which is what the axis has to hold: a stacked segment's top
|
|
606
|
+
* is its category's running total, not its own reading. */
|
|
607
|
+
spans = computed(() => {
|
|
608
|
+
const given = this.offsets();
|
|
609
|
+
return this.data().map((point, index) => given?.[index] ?? {
|
|
610
|
+
from: 0,
|
|
611
|
+
to: Number.isFinite(point.value) ? point.value : 0,
|
|
612
|
+
});
|
|
613
|
+
}, ...(ngDevMode ? [{ debugName: "spans" }] : /* istanbul ignore next */ []));
|
|
614
|
+
constructor() {
|
|
615
|
+
effect(() => this.scales.reportDomain(this.domainId, this.spans().flatMap((span) => [span.from, span.to])));
|
|
616
|
+
}
|
|
617
|
+
ngOnDestroy() {
|
|
618
|
+
this.scales.releaseDomain(this.domainId);
|
|
619
|
+
}
|
|
620
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs());
|
|
621
|
+
/** One SERIES' slot inside a category's band: the whole band while a chart draws one series,
|
|
622
|
+
* a share of it per series when several are grouped. The box that catches the pointer is sized
|
|
623
|
+
* from this rather than from the drawn column, so a short column stays reachable. */
|
|
624
|
+
slotStep = computed(() => {
|
|
625
|
+
const count = this.data().length;
|
|
626
|
+
const slots = Math.max(1, this.slotCount());
|
|
627
|
+
return count > 0 ? this.scales.plot().width / count / slots : 0;
|
|
628
|
+
}, ...(ngDevMode ? [{ debugName: "slotStep" }] : /* istanbul ignore next */ []));
|
|
629
|
+
slotStepPx = computed(() => `${this.slotStep()}px`, ...(ngDevMode ? [{ debugName: "slotStepPx" }] : /* istanbul ignore next */ []));
|
|
630
|
+
markWidthPx = computed(() => `${this.slotStep() * this.columnWidthRatio()}px`, ...(ngDevMode ? [{ debugName: "markWidthPx" }] : /* istanbul ignore next */ []));
|
|
631
|
+
/** The whole canvas, reserved end included. Overshooting when the container drops that
|
|
632
|
+
* reservation costs nothing - the outer `<svg>` clips it - while falling short would leave a
|
|
633
|
+
* strip under the plot that answers no pointer. */
|
|
634
|
+
hitHeight = computed(() => {
|
|
635
|
+
const plot = this.scales.plot();
|
|
636
|
+
return chartViewHeight(plot.height, plot.top, true);
|
|
637
|
+
}, ...(ngDevMode ? [{ debugName: "hitHeight" }] : /* istanbul ignore next */ []));
|
|
638
|
+
pinDiscRadius = PIN_DISC_RADIUS;
|
|
639
|
+
pinGlyphSize = PIN_GLYPH_SIZE;
|
|
640
|
+
pinGlyphOffset = -PIN_GLYPH_SIZE / 2;
|
|
641
|
+
pinGlyph = inject(DomSanitizer).bypassSecurityTrustHtml(ICONS.pin);
|
|
642
|
+
marks = computed(() => {
|
|
643
|
+
const toX = this.scales.xPosition();
|
|
644
|
+
const toY = this.scales.yPosition();
|
|
645
|
+
const spans = this.spans();
|
|
646
|
+
const format = this.valueFormat();
|
|
647
|
+
return this.data().map((point, index) => {
|
|
648
|
+
const span = spans[index];
|
|
649
|
+
const foot = toY(span.from);
|
|
650
|
+
const tip = toY(span.to);
|
|
651
|
+
const below = tip > foot;
|
|
652
|
+
// Only a segment that has one under it gives up the gap: taking it off the baseline segment
|
|
653
|
+
// would lift the whole stack off the axis.
|
|
654
|
+
const gap = span.from === 0 ? 0 : Math.min(STACK_SEGMENT_GAP, Math.abs(tip - foot));
|
|
655
|
+
const baseline = below ? foot + gap : foot - gap;
|
|
656
|
+
const color = point.color ??
|
|
657
|
+
this.seriesColor() ??
|
|
658
|
+
CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
659
|
+
return {
|
|
660
|
+
key: point.id ?? String(index),
|
|
661
|
+
point,
|
|
662
|
+
x: toX(index),
|
|
663
|
+
tip,
|
|
664
|
+
below,
|
|
665
|
+
baseline,
|
|
666
|
+
top: Math.min(tip, baseline),
|
|
667
|
+
height: Math.abs(tip - baseline),
|
|
668
|
+
labelY: below ? tip + VALUE_LABEL_GAP : tip - VALUE_LABEL_GAP,
|
|
669
|
+
pinY: Math.min(tip, baseline) + PIN_DISC_RADIUS,
|
|
670
|
+
// Growing from the baseline, never the mark's own tip - a column below zero grows
|
|
671
|
+
// downward, so its transform-origin flips to the top edge it hangs from.
|
|
672
|
+
origin: below ? 'top' : 'bottom',
|
|
673
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
674
|
+
color,
|
|
675
|
+
hatched: (point.fill ?? this.seriesFill()) === 'hatched',
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
}, ...(ngDevMode ? [{ debugName: "marks" }] : /* istanbul ignore next */ []));
|
|
679
|
+
markStagger(index) {
|
|
680
|
+
return `${staggerDelay(index, this.staggerMs())}ms`;
|
|
681
|
+
}
|
|
682
|
+
onMarkClick(payload, index, event) {
|
|
683
|
+
this.pointClicked.emit(payload);
|
|
684
|
+
if (this.pinOnClick()) {
|
|
685
|
+
this.activeMark.pin(index, event, this.tooltipAnchor() === 'mark' ? '.bar' : undefined);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
onMarkEnter(index, event) {
|
|
689
|
+
this.activeMark.enter(index, event, this.tooltipAnchor() === 'mark' ? '.bar' : undefined);
|
|
690
|
+
}
|
|
691
|
+
/** One tab stop per chart, not one per mark: WCAG 2.1.1's Understanding is explicit that not
|
|
692
|
+
* every mouse-operable control has to be separately focusable, and that is what keeps a
|
|
693
|
+
* twenty-five mark chart from being twenty-five stops in the page's tab order. */
|
|
694
|
+
rovingIndex = signal(0, ...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
695
|
+
tabStopIndex = computed(() => Math.min(this.rovingIndex(), Math.max(0, this.marks().length - 1)), ...(ngDevMode ? [{ debugName: "tabStopIndex" }] : /* istanbul ignore next */ []));
|
|
696
|
+
onMarkFocus(index, event) {
|
|
697
|
+
this.rovingIndex.set(index);
|
|
698
|
+
this.onMarkEnter(index, event);
|
|
699
|
+
}
|
|
700
|
+
onMarkNavigation(event, index) {
|
|
701
|
+
const next = nextRovingIndex(event.key, index, this.marks().length);
|
|
702
|
+
if (next === null) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
event.preventDefault();
|
|
706
|
+
this.rovingIndex.set(next);
|
|
707
|
+
focusMark(event.currentTarget.closest('.columns'), next);
|
|
708
|
+
}
|
|
709
|
+
onPointKey(point, event) {
|
|
710
|
+
// Only the column's own key opens it: a key pressed on a control inside belongs to that
|
|
711
|
+
// control.
|
|
712
|
+
if (!this.interactive() || event.target !== event.currentTarget) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
event.preventDefault();
|
|
716
|
+
this.pointClicked.emit(point);
|
|
717
|
+
}
|
|
718
|
+
entryLabel(mark) {
|
|
719
|
+
return `${mark.point.label}, ${mark.formattedValue}`;
|
|
720
|
+
}
|
|
721
|
+
tooltipContext = computed(() => {
|
|
722
|
+
const mark = this.marks()[this.activeMark.index()];
|
|
723
|
+
if (this.tooltip() === 'none' || !mark) {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
const series = this.seriesLabel();
|
|
727
|
+
return {
|
|
728
|
+
category: series ? mark.point.label : '',
|
|
729
|
+
entries: [
|
|
730
|
+
{
|
|
731
|
+
label: series ?? mark.point.label,
|
|
732
|
+
value: mark.point.value,
|
|
733
|
+
formatted: mark.formattedValue,
|
|
734
|
+
color: mark.color,
|
|
735
|
+
detail: this.partOfWhole()
|
|
736
|
+
? describeShare(this.data().map((point) => point.value), this.activeMark.index())
|
|
737
|
+
: undefined,
|
|
738
|
+
},
|
|
739
|
+
],
|
|
740
|
+
};
|
|
741
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
742
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
743
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ColumnSeriesComponent, isStandalone: true, selector: "g[dsColumnSeries]", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, showValues: { classPropertyName: "showValues", publicName: "showValues", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null }, pinOnClick: { classPropertyName: "pinOnClick", publicName: "pinOnClick", isSignal: true, isRequired: false, transformFunction: null }, dimOthers: { classPropertyName: "dimOthers", publicName: "dimOthers", isSignal: true, isRequired: false, transformFunction: null }, staggerMs: { classPropertyName: "staggerMs", publicName: "staggerMs", isSignal: true, isRequired: false, transformFunction: null }, partOfWhole: { classPropertyName: "partOfWhole", publicName: "partOfWhole", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipAnchor: { classPropertyName: "tooltipAnchor", publicName: "tooltipAnchor", isSignal: true, isRequired: false, transformFunction: null }, tooltipLingerMs: { classPropertyName: "tooltipLingerMs", publicName: "tooltipLingerMs", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null }, columnWidthRatio: { classPropertyName: "columnWidthRatio", publicName: "columnWidthRatio", isSignal: true, isRequired: false, transformFunction: null }, slot: { classPropertyName: "slot", publicName: "slot", isSignal: true, isRequired: false, transformFunction: null }, slotCount: { classPropertyName: "slotCount", publicName: "slotCount", isSignal: true, isRequired: false, transformFunction: null }, offsets: { classPropertyName: "offsets", publicName: "offsets", isSignal: true, isRequired: false, transformFunction: null }, seriesColor: { classPropertyName: "seriesColor", publicName: "seriesColor", isSignal: true, isRequired: false, transformFunction: null }, seriesFill: { classPropertyName: "seriesFill", publicName: "seriesFill", isSignal: true, isRequired: false, transformFunction: null }, seriesLabel: { classPropertyName: "seriesLabel", publicName: "seriesLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClicked: "pointClicked" }, exportAs: ["dsColumnSeries"], ngImport: i0, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [style.--_column-chart-column-share]=\"markWidthPx()\"\n [style.--_column-chart-slot-step]=\"slotStepPx()\"\n [style.--_column-slot]=\"slot()\"\n [style.--_column-slots]=\"slotCount()\">\n <!-- `userSpaceOnUse`, so the stripe pitch is the same on a tall column and a short one: with the\n default object bounding box it would scale with each mark and read as a different texture\n per bar. -->\n <svg:defs>\n <svg:pattern\n class=\"hatch\"\n patternUnits=\"userSpaceOnUse\"\n width=\"8\"\n height=\"8\"\n patternTransform=\"rotate(45)\"\n [attr.id]=\"hatchId\">\n <svg:rect\n class=\"hatch-ground\"\n width=\"8\"\n height=\"8\" />\n\n <svg:line\n class=\"hatch-stripe\"\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n animate.leave=\"mark-leave\"\n [class.interactive]=\"interactive()\"\n [class.below-baseline]=\"mark.below\"\n [class.is-pinned]=\"activeMark.pinned() && activeMark.index() === index\"\n [style.--_chart-mark-stagger]=\"markStagger(index)\"\n [style.--_column-mark-height]=\"mark.height + 'px'\"\n [style.--_column-baseline-y]=\"mark.baseline + 'px'\"\n [style.--_column-x]=\"mark.x + 'px'\"\n [attr.data-mark-index]=\"index\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (index === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.aria-label]=\"interactive() ? entryLabel(mark) : null\"\n (pointerenter)=\"onMarkEnter(index, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkFocus(index, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkNavigation($event, index)\"\n (click)=\"onMarkClick(mark.point, index, $event)\"\n (keydown.enter)=\"onPointKey(mark.point, $event)\"\n (keydown.space)=\"onPointKey(mark.point, $event)\">\n <!-- The box that catches the pointer is the whole category slot, not the drawn column: a\n column two pixels tall is otherwise unreachable, and a pointer that has to find the\n mark is a pointer that misses it. -->\n <svg:rect\n class=\"hit-area\"\n y=\"0\"\n [attr.height]=\"hitHeight()\" />\n\n <svg:g\n class=\"bar\"\n animate.enter=\"mark-enter\"\n [style.transform-origin]=\"mark.origin\">\n <!-- Under the capped rect, not beside it: `rx` rounds all four corners, and the cap\n belongs on the free end alone. This one fills the two corners at the baseline back\n in, and both keep `y` and `height` a plain interpolable length, which a `<path>`\n would not. -->\n <svg:rect\n class=\"bar-base\"\n [attr.fill]=\"mark.color\" />\n\n <svg:rect\n class=\"bar-cap\"\n [attr.y]=\"mark.top\"\n [attr.height]=\"mark.height\"\n [attr.fill]=\"mark.color\" />\n\n <!-- Stripes OVER the painted mark, not a pattern in place of its fill: a pattern carries\n its own colour, so one shared definition cannot take each mark's. Painting the surface\n colour through it leaves the mark's own hue showing between the stripes. -->\n @if (mark.hatched) {\n <svg:rect\n class=\"bar-hatch\"\n [attr.y]=\"mark.top\"\n [attr.height]=\"mark.height\"\n [attr.fill]=\"'url(#' + hatchId + ')'\" />\n }\n </svg:g>\n\n @if (showValues()) {\n <svg:text\n class=\"value\"\n text-anchor=\"middle\"\n [attr.y]=\"mark.labelY\">\n {{ mark.formattedValue }}\n </svg:text>\n }\n\n @if (activeMark.pinned() && activeMark.index() === index) {\n <svg:g\n class=\"pin-marker\"\n aria-hidden=\"true\"\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\">\n <svg:circle\n class=\"pin-disc\"\n [attr.r]=\"pinDiscRadius\" />\n\n <svg:svg\n class=\"pin-glyph\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n [attr.x]=\"pinGlyphOffset\"\n [attr.y]=\"pinGlyphOffset\"\n [attr.width]=\"pinGlyphSize\"\n [attr.height]=\"pinGlyphSize\"\n [innerHTML]=\"pinGlyph\" />\n </svg:g>\n }\n </svg:g>\n }\n</svg:g>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.column .bar{transform-origin:bottom}.bar.mark-enter{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}@media not (forced-colors:active){.column:focus{outline:none}}.columns .column{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.columns .column.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.columns.dims-others:not(:has(.column.is-pinned)):has(.column.interactive:hover) .column.interactive:not(:hover),.columns.dims-others:not(:has(.column.is-pinned)):has(.column.interactive:focus-visible) .column.interactive:not(:focus-visible),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive{cursor:pointer}.columns{--_column-chart-column-max-width: var(--ds-column-chart-column-max-width, 48px);--_column-chart-column-gap: var(--ds-column-chart-column-gap, var(--ds-chart-bar-gap));--_column-chart-cap-radius: var( --ds-column-chart-cap-radius, var(--ds-chart-mark-cap-radius) );--_column-chart-hatch-color: var( --ds-chart-hatch-color, var(--surface-default) );--_column-chart-hatch-width: var(--ds-chart-hatch-width, 3px)}.column{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_column-hit-width: min( var(--_column-chart-slot-step), calc( var(--_column-chart-column-max-width) + var(--_column-chart-column-gap) ) );--_column-square-height: min( var(--_column-chart-cap-radius), calc(var(--_column-mark-height) / 2) );--_column-slot-offset: calc( (2 * var(--_column-slot, 0) - var(--_column-slots, 1) + 1) * (var(--_column-mark-width) + var(--_column-chart-column-gap)) / 2 );transform:translate(calc(var(--_column-x, 0px) + var(--_column-slot-offset)))}.hit-area{width:var(--_column-hit-width);x:calc(var(--_column-hit-width) / -2);fill:transparent}.bar{transform-box:fill-box}.bar-base,.bar-cap,.bar-hatch{width:var(--_column-mark-width);x:calc(var(--_column-mark-width) / -2);transition:y var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),height var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),fill var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.bar-cap{rx:var(--_column-chart-cap-radius)}.hatch-ground{fill:none}.hatch-stripe{stroke:var(--_column-chart-hatch-color);stroke-width:var(--_column-chart-hatch-width)}.bar-hatch{rx:var(--_column-chart-cap-radius);pointer-events:none}.bar-base{height:var(--_column-square-height);y:calc(var(--_column-baseline-y) - var(--_column-square-height))}.column.below-baseline .bar-base{y:var(--_column-baseline-y)}.value{fill:currentcolor;font-size:var(--font-size-xs);font-weight:700;pointer-events:none}.column.below-baseline .value{dominant-baseline:hanging}@media not (forced-colors:active){.column.interactive:focus-visible{outline:none}}.column.interactive:focus-visible .bar-cap{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 var(--focus-ring-width) var(--ds-chart-focus-halo-color))}@media(forced-colors:active){.column.interactive:focus-visible .bar-cap{stroke:Highlight;filter:none}}.pin-marker{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
744
|
+
}
|
|
745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, decorators: [{
|
|
746
|
+
type: Component,
|
|
747
|
+
args: [{ selector: 'g[dsColumnSeries]', standalone: true, exportAs: 'dsColumnSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [style.--_column-chart-column-share]=\"markWidthPx()\"\n [style.--_column-chart-slot-step]=\"slotStepPx()\"\n [style.--_column-slot]=\"slot()\"\n [style.--_column-slots]=\"slotCount()\">\n <!-- `userSpaceOnUse`, so the stripe pitch is the same on a tall column and a short one: with the\n default object bounding box it would scale with each mark and read as a different texture\n per bar. -->\n <svg:defs>\n <svg:pattern\n class=\"hatch\"\n patternUnits=\"userSpaceOnUse\"\n width=\"8\"\n height=\"8\"\n patternTransform=\"rotate(45)\"\n [attr.id]=\"hatchId\">\n <svg:rect\n class=\"hatch-ground\"\n width=\"8\"\n height=\"8\" />\n\n <svg:line\n class=\"hatch-stripe\"\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n animate.leave=\"mark-leave\"\n [class.interactive]=\"interactive()\"\n [class.below-baseline]=\"mark.below\"\n [class.is-pinned]=\"activeMark.pinned() && activeMark.index() === index\"\n [style.--_chart-mark-stagger]=\"markStagger(index)\"\n [style.--_column-mark-height]=\"mark.height + 'px'\"\n [style.--_column-baseline-y]=\"mark.baseline + 'px'\"\n [style.--_column-x]=\"mark.x + 'px'\"\n [attr.data-mark-index]=\"index\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (index === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.aria-label]=\"interactive() ? entryLabel(mark) : null\"\n (pointerenter)=\"onMarkEnter(index, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkFocus(index, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkNavigation($event, index)\"\n (click)=\"onMarkClick(mark.point, index, $event)\"\n (keydown.enter)=\"onPointKey(mark.point, $event)\"\n (keydown.space)=\"onPointKey(mark.point, $event)\">\n <!-- The box that catches the pointer is the whole category slot, not the drawn column: a\n column two pixels tall is otherwise unreachable, and a pointer that has to find the\n mark is a pointer that misses it. -->\n <svg:rect\n class=\"hit-area\"\n y=\"0\"\n [attr.height]=\"hitHeight()\" />\n\n <svg:g\n class=\"bar\"\n animate.enter=\"mark-enter\"\n [style.transform-origin]=\"mark.origin\">\n <!-- Under the capped rect, not beside it: `rx` rounds all four corners, and the cap\n belongs on the free end alone. This one fills the two corners at the baseline back\n in, and both keep `y` and `height` a plain interpolable length, which a `<path>`\n would not. -->\n <svg:rect\n class=\"bar-base\"\n [attr.fill]=\"mark.color\" />\n\n <svg:rect\n class=\"bar-cap\"\n [attr.y]=\"mark.top\"\n [attr.height]=\"mark.height\"\n [attr.fill]=\"mark.color\" />\n\n <!-- Stripes OVER the painted mark, not a pattern in place of its fill: a pattern carries\n its own colour, so one shared definition cannot take each mark's. Painting the surface\n colour through it leaves the mark's own hue showing between the stripes. -->\n @if (mark.hatched) {\n <svg:rect\n class=\"bar-hatch\"\n [attr.y]=\"mark.top\"\n [attr.height]=\"mark.height\"\n [attr.fill]=\"'url(#' + hatchId + ')'\" />\n }\n </svg:g>\n\n @if (showValues()) {\n <svg:text\n class=\"value\"\n text-anchor=\"middle\"\n [attr.y]=\"mark.labelY\">\n {{ mark.formattedValue }}\n </svg:text>\n }\n\n @if (activeMark.pinned() && activeMark.index() === index) {\n <svg:g\n class=\"pin-marker\"\n aria-hidden=\"true\"\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\">\n <svg:circle\n class=\"pin-disc\"\n [attr.r]=\"pinDiscRadius\" />\n\n <svg:svg\n class=\"pin-glyph\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n [attr.x]=\"pinGlyphOffset\"\n [attr.y]=\"pinGlyphOffset\"\n [attr.width]=\"pinGlyphSize\"\n [attr.height]=\"pinGlyphSize\"\n [innerHTML]=\"pinGlyph\" />\n </svg:g>\n }\n </svg:g>\n }\n</svg:g>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.column .bar{transform-origin:bottom}.bar.mark-enter{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}@media not (forced-colors:active){.column:focus{outline:none}}.columns .column{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.columns .column.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.columns.dims-others:not(:has(.column.is-pinned)):has(.column.interactive:hover) .column.interactive:not(:hover),.columns.dims-others:not(:has(.column.is-pinned)):has(.column.interactive:focus-visible) .column.interactive:not(:focus-visible),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive{cursor:pointer}.columns{--_column-chart-column-max-width: var(--ds-column-chart-column-max-width, 48px);--_column-chart-column-gap: var(--ds-column-chart-column-gap, var(--ds-chart-bar-gap));--_column-chart-cap-radius: var( --ds-column-chart-cap-radius, var(--ds-chart-mark-cap-radius) );--_column-chart-hatch-color: var( --ds-chart-hatch-color, var(--surface-default) );--_column-chart-hatch-width: var(--ds-chart-hatch-width, 3px)}.column{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_column-hit-width: min( var(--_column-chart-slot-step), calc( var(--_column-chart-column-max-width) + var(--_column-chart-column-gap) ) );--_column-square-height: min( var(--_column-chart-cap-radius), calc(var(--_column-mark-height) / 2) );--_column-slot-offset: calc( (2 * var(--_column-slot, 0) - var(--_column-slots, 1) + 1) * (var(--_column-mark-width) + var(--_column-chart-column-gap)) / 2 );transform:translate(calc(var(--_column-x, 0px) + var(--_column-slot-offset)))}.hit-area{width:var(--_column-hit-width);x:calc(var(--_column-hit-width) / -2);fill:transparent}.bar{transform-box:fill-box}.bar-base,.bar-cap,.bar-hatch{width:var(--_column-mark-width);x:calc(var(--_column-mark-width) / -2);transition:y var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),height var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),fill var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.bar-cap{rx:var(--_column-chart-cap-radius)}.hatch-ground{fill:none}.hatch-stripe{stroke:var(--_column-chart-hatch-color);stroke-width:var(--_column-chart-hatch-width)}.bar-hatch{rx:var(--_column-chart-cap-radius);pointer-events:none}.bar-base{height:var(--_column-square-height);y:calc(var(--_column-baseline-y) - var(--_column-square-height))}.column.below-baseline .bar-base{y:var(--_column-baseline-y)}.value{fill:currentcolor;font-size:var(--font-size-xs);font-weight:700;pointer-events:none}.column.below-baseline .value{dominant-baseline:hanging}@media not (forced-colors:active){.column.interactive:focus-visible{outline:none}}.column.interactive:focus-visible .bar-cap{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 var(--focus-ring-width) var(--ds-chart-focus-halo-color))}@media(forced-colors:active){.column.interactive:focus-visible .bar-cap{stroke:Highlight;filter:none}}.pin-marker{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"] }]
|
|
748
|
+
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], showValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValues", required: false }] }], interactive: [{ type: i0.Input, args: [{ isSignal: true, alias: "interactive", required: false }] }], pinOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinOnClick", required: false }] }], dimOthers: [{ type: i0.Input, args: [{ isSignal: true, alias: "dimOthers", required: false }] }], staggerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "staggerMs", required: false }] }], partOfWhole: [{ type: i0.Input, args: [{ isSignal: true, alias: "partOfWhole", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipAnchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipAnchor", required: false }] }], tooltipLingerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipLingerMs", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], columnWidthRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnWidthRatio", required: false }] }], slot: [{ type: i0.Input, args: [{ isSignal: true, alias: "slot", required: false }] }], slotCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "slotCount", required: false }] }], offsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "offsets", required: false }] }], seriesColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesColor", required: false }] }], seriesFill: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesFill", required: false }] }], seriesLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesLabel", required: false }] }], pointClicked: [{ type: i0.Output, args: ["pointClicked"] }] } });
|
|
749
|
+
|
|
750
|
+
let nextSeriesId = 0;
|
|
751
|
+
/**
|
|
752
|
+
* One line per series, drawn against the scales `ds-chart` supplies, on either of its two value
|
|
753
|
+
* axes.
|
|
754
|
+
*
|
|
755
|
+
* Hosted on a `<g>` rather than an element of its own: an element the SVG specification does not
|
|
756
|
+
* know is not rendered, and neither are its descendants. Written as `<svg:g dsLineSeries>`.
|
|
757
|
+
*
|
|
758
|
+
* @internal
|
|
759
|
+
*/
|
|
760
|
+
class LineSeriesComponent {
|
|
761
|
+
scales = inject(CHART_SCALES);
|
|
762
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this same
|
|
763
|
+
* element, and a required input throws NG0950 for the pass before its own value is written. */
|
|
764
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
765
|
+
showMarkers = input(true, { ...(ngDevMode ? { debugName: "showMarkers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
766
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
767
|
+
staggerMs = input(0, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
768
|
+
gaps = input('break', ...(ngDevMode ? [{ debugName: "gaps" }] : /* istanbul ignore next */ []));
|
|
769
|
+
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
770
|
+
tooltipLingerMs = input(0, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
771
|
+
valueFormat = input(defaultChartFormat, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
772
|
+
pointClicked = output();
|
|
773
|
+
domainId = `line-series-${nextSeriesId++}`;
|
|
774
|
+
constructor() {
|
|
775
|
+
effect(() => {
|
|
776
|
+
this.scales.reportDomain(`${this.domainId}-primary`, this.valuesOn('primary'), 'primary');
|
|
777
|
+
this.scales.reportDomain(`${this.domainId}-secondary`, this.valuesOn('secondary'), 'secondary');
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
ngOnDestroy() {
|
|
781
|
+
this.scales.releaseDomain(`${this.domainId}-primary`);
|
|
782
|
+
this.scales.releaseDomain(`${this.domainId}-secondary`);
|
|
783
|
+
}
|
|
784
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs());
|
|
785
|
+
valuesOn(axis) {
|
|
786
|
+
return this.data()
|
|
787
|
+
.filter((series) => (series.axis ?? 'primary') === axis)
|
|
788
|
+
.flatMap((series) => series.data.filter((value) => value !== null));
|
|
789
|
+
}
|
|
790
|
+
/** A `null` past the end is the same missing reading as a `null` inside the run, so a series
|
|
791
|
+
* shorter than `categories` ends its line rather than running off the plot's edge. */
|
|
792
|
+
readingsOf(series, count) {
|
|
793
|
+
const zeroed = this.gaps() === 'zero';
|
|
794
|
+
const readings = [];
|
|
795
|
+
for (let index = 0; index < count; index++) {
|
|
796
|
+
const raw = series.data[index];
|
|
797
|
+
const reading = typeof raw === 'number' && Number.isFinite(raw) ? raw : null;
|
|
798
|
+
readings.push(reading === null && zeroed ? 0 : reading);
|
|
799
|
+
}
|
|
800
|
+
return readings;
|
|
801
|
+
}
|
|
802
|
+
plotted = computed(() => {
|
|
803
|
+
const toX = this.scales.xPosition();
|
|
804
|
+
const primaryY = this.scales.yPosition();
|
|
805
|
+
const secondaryY = this.scales.secondaryYPosition();
|
|
806
|
+
const categories = this.scales.categories();
|
|
807
|
+
let markerIndex = 0;
|
|
808
|
+
return this.data().map((series, index) => {
|
|
809
|
+
const secondary = (series.axis ?? 'primary') === 'secondary';
|
|
810
|
+
const toY = secondary ? secondaryY : primaryY;
|
|
811
|
+
const color = series.color ?? CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
812
|
+
const points = this.readingsOf(series, categories.length).map((value, categoryIndex) => value === null
|
|
813
|
+
? null
|
|
814
|
+
: {
|
|
815
|
+
categoryIndex,
|
|
816
|
+
x: toX(categoryIndex),
|
|
817
|
+
y: toY(value),
|
|
818
|
+
value,
|
|
819
|
+
});
|
|
820
|
+
const segments = lineSegments(points);
|
|
821
|
+
const format = this.valueFormat();
|
|
822
|
+
return {
|
|
823
|
+
series,
|
|
824
|
+
color,
|
|
825
|
+
seriesIndex: index,
|
|
826
|
+
polylines: segments.map((segment) => polylinePoints(segment)),
|
|
827
|
+
areaPaths: series.area
|
|
828
|
+
? segments.map((segment) => areaPath(segment, toY(0)))
|
|
829
|
+
: [],
|
|
830
|
+
markers: points
|
|
831
|
+
.filter((point) => point !== null)
|
|
832
|
+
.map((point) => ({
|
|
833
|
+
key: `${series.id}-${point.categoryIndex}`,
|
|
834
|
+
markIndex: markerIndex++,
|
|
835
|
+
x: point.x,
|
|
836
|
+
y: point.y,
|
|
837
|
+
value: point.value,
|
|
838
|
+
category: categories[point.categoryIndex] ?? '',
|
|
839
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
840
|
+
seriesLabel: series.label,
|
|
841
|
+
seriesId: series.id,
|
|
842
|
+
categoryIndex: point.categoryIndex,
|
|
843
|
+
color,
|
|
844
|
+
})),
|
|
845
|
+
};
|
|
846
|
+
});
|
|
847
|
+
}, ...(ngDevMode ? [{ debugName: "plotted" }] : /* istanbul ignore next */ []));
|
|
848
|
+
allMarkers = computed(() => this.plotted().flatMap((entry) => entry.markers), ...(ngDevMode ? [{ debugName: "allMarkers" }] : /* istanbul ignore next */ []));
|
|
849
|
+
seriesStagger(index) {
|
|
850
|
+
return `${staggerDelay(index, this.staggerMs())}ms`;
|
|
851
|
+
}
|
|
852
|
+
/** One tab stop per chart, not one per mark: WCAG 2.1.1's Understanding is explicit that not
|
|
853
|
+
* every mouse-operable control has to be separately focusable. */
|
|
854
|
+
rovingIndex = signal(0, ...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
855
|
+
tabStopIndex = computed(() => Math.min(this.rovingIndex(), Math.max(0, this.allMarkers().length - 1)), ...(ngDevMode ? [{ debugName: "tabStopIndex" }] : /* istanbul ignore next */ []));
|
|
856
|
+
onMarkerEnter(markIndex, event) {
|
|
857
|
+
this.activeMark.enter(markIndex, event);
|
|
858
|
+
}
|
|
859
|
+
onMarkerFocus(markIndex, event) {
|
|
860
|
+
this.rovingIndex.set(markIndex);
|
|
861
|
+
this.onMarkerEnter(markIndex, event);
|
|
862
|
+
}
|
|
863
|
+
onMarkerNavigation(event, markIndex) {
|
|
864
|
+
const next = nextRovingIndex(event.key, markIndex, this.allMarkers().length);
|
|
865
|
+
if (next === null) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
event.preventDefault();
|
|
869
|
+
this.rovingIndex.set(next);
|
|
870
|
+
focusMark(event.currentTarget.closest('.lines'), next);
|
|
871
|
+
}
|
|
872
|
+
onMarkerClick(markIndex) {
|
|
873
|
+
const marker = this.allMarkers()[markIndex];
|
|
874
|
+
const series = this.data().find((entry) => entry.id === marker?.seriesId);
|
|
875
|
+
if (marker && series) {
|
|
876
|
+
this.pointClicked.emit({
|
|
877
|
+
series,
|
|
878
|
+
categoryIndex: marker.categoryIndex,
|
|
879
|
+
value: marker.value,
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
markerLabel(marker) {
|
|
884
|
+
return `${marker.seriesLabel}, ${marker.category}, ${marker.formattedValue}`;
|
|
885
|
+
}
|
|
886
|
+
tooltipContext = computed(() => {
|
|
887
|
+
const marker = this.allMarkers()[this.activeMark.index()];
|
|
888
|
+
if (this.tooltip() === 'none' || !marker) {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
return {
|
|
892
|
+
category: marker.category,
|
|
893
|
+
entries: [
|
|
894
|
+
{
|
|
895
|
+
label: marker.seriesLabel,
|
|
896
|
+
value: marker.value,
|
|
897
|
+
formatted: marker.formattedValue,
|
|
898
|
+
color: marker.color,
|
|
899
|
+
},
|
|
900
|
+
],
|
|
901
|
+
};
|
|
902
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
903
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
904
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: LineSeriesComponent, isStandalone: true, selector: "g[dsLineSeries]", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, showMarkers: { classPropertyName: "showMarkers", publicName: "showMarkers", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null }, staggerMs: { classPropertyName: "staggerMs", publicName: "staggerMs", isSignal: true, isRequired: false, transformFunction: null }, gaps: { classPropertyName: "gaps", publicName: "gaps", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipLingerMs: { classPropertyName: "tooltipLingerMs", publicName: "tooltipLingerMs", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClicked: "pointClicked" }, exportAs: ["dsLineSeries"], ngImport: i0, template: "<svg:g class=\"lines\">\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.fill]=\"entry.color\" />\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (points of entry.polylines; track $index) {\n <svg:polyline\n class=\"series-line\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.points]=\"points\"\n [attr.stroke]=\"entry.color\" />\n }\n }\n\n @if (showMarkers() || interactive()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n class=\"series-marker\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.is-active]=\"marker.markIndex === activeMark.index()\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [attr.fill]=\"entry.color\"\n [attr.data-mark-index]=\"marker.markIndex\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (marker.markIndex === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.aria-label]=\"interactive() ? markerLabel(marker) : null\"\n (pointerenter)=\"onMarkerEnter(marker.markIndex, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkerFocus(marker.markIndex, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkerNavigation($event, marker.markIndex)\"\n (click)=\"onMarkerClick(marker.markIndex)\"\n (keydown.enter)=\"onMarkerClick(marker.markIndex)\"\n (keydown.space)=\"onMarkerClick(marker.markIndex)\" />\n }\n }\n }\n</svg:g>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.series-line.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-line.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-area.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-marker.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-marker.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}@media not (forced-colors:active){.series-marker:focus{outline:none}}.lines{--_line-series-line-width: var(--ds-chart-line-width);--_line-series-dot-radius: var(--ds-chart-dot-radius);--_line-series-dot-radius-active: var(--ds-chart-dot-radius-active);--_line-series-area-opacity: var(--ds-chart-area-opacity)}.series-line{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),stroke var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.series-line.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.series-marker{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),fill var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),r var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.series-marker.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.series-marker.interactive{cursor:pointer}.series-area{fill-opacity:var(--_line-series-area-opacity);stroke:none}.series-line{fill:none;stroke-width:var(--_line-series-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{r:var(--_line-series-dot-radius)}.series-marker.ghost{fill-opacity:0}.series-marker.ghost:hover,.series-marker.ghost:focus-visible,.series-marker.ghost.is-active{fill-opacity:1}.series-marker.is-active{r:var(--_line-series-dot-radius-active)}.series-marker.interactive{stroke:transparent;stroke-width:24px;vector-effect:non-scaling-stroke}@media(pointer:coarse){.series-marker.interactive{stroke-width:44px}}@media not (forced-colors:active){.series-marker.interactive:focus-visible{outline:none}}.series-marker.interactive:focus-visible{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 var(--focus-ring-width) var(--ds-chart-focus-halo-color));r:var(--_line-series-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
905
|
+
}
|
|
906
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
907
|
+
type: Component,
|
|
908
|
+
args: [{ selector: 'g[dsLineSeries]', standalone: true, exportAs: 'dsLineSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g class=\"lines\">\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.fill]=\"entry.color\" />\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (points of entry.polylines; track $index) {\n <svg:polyline\n class=\"series-line\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.points]=\"points\"\n [attr.stroke]=\"entry.color\" />\n }\n }\n\n @if (showMarkers() || interactive()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n class=\"series-marker\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.is-active]=\"marker.markIndex === activeMark.index()\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [attr.fill]=\"entry.color\"\n [attr.data-mark-index]=\"marker.markIndex\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (marker.markIndex === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.aria-label]=\"interactive() ? markerLabel(marker) : null\"\n (pointerenter)=\"onMarkerEnter(marker.markIndex, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkerFocus(marker.markIndex, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkerNavigation($event, marker.markIndex)\"\n (click)=\"onMarkerClick(marker.markIndex)\"\n (keydown.enter)=\"onMarkerClick(marker.markIndex)\"\n (keydown.space)=\"onMarkerClick(marker.markIndex)\" />\n }\n }\n }\n</svg:g>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.series-line.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-line.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-area.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-marker.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.series-marker.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}@media not (forced-colors:active){.series-marker:focus{outline:none}}.lines{--_line-series-line-width: var(--ds-chart-line-width);--_line-series-dot-radius: var(--ds-chart-dot-radius);--_line-series-dot-radius-active: var(--ds-chart-dot-radius-active);--_line-series-area-opacity: var(--ds-chart-area-opacity)}.series-line{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),stroke var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.series-line.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.series-marker{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),fill var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),r var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.series-marker.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.series-marker.interactive{cursor:pointer}.series-area{fill-opacity:var(--_line-series-area-opacity);stroke:none}.series-line{fill:none;stroke-width:var(--_line-series-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{r:var(--_line-series-dot-radius)}.series-marker.ghost{fill-opacity:0}.series-marker.ghost:hover,.series-marker.ghost:focus-visible,.series-marker.ghost.is-active{fill-opacity:1}.series-marker.is-active{r:var(--_line-series-dot-radius-active)}.series-marker.interactive{stroke:transparent;stroke-width:24px;vector-effect:non-scaling-stroke}@media(pointer:coarse){.series-marker.interactive{stroke-width:44px}}@media not (forced-colors:active){.series-marker.interactive:focus-visible{outline:none}}.series-marker.interactive:focus-visible{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 var(--focus-ring-width) var(--ds-chart-focus-halo-color));r:var(--_line-series-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"] }]
|
|
909
|
+
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], showMarkers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMarkers", required: false }] }], interactive: [{ type: i0.Input, args: [{ isSignal: true, alias: "interactive", required: false }] }], staggerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "staggerMs", required: false }] }], gaps: [{ type: i0.Input, args: [{ isSignal: true, alias: "gaps", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipLingerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipLingerMs", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], pointClicked: [{ type: i0.Output, args: ["pointClicked"] }] } });
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* The names of a chart's reference lines, laid out by the same geometry that draws them.
|
|
913
|
+
*
|
|
914
|
+
* A second element rather than part of `g[dsReferenceLine]`: the strokes belong under the marks
|
|
915
|
+
* and the names over them, and a projected element lands in exactly one of the container's slots.
|
|
916
|
+
* Reports no domain - the line it names already did.
|
|
917
|
+
*
|
|
918
|
+
* @internal
|
|
919
|
+
*/
|
|
920
|
+
class ReferenceLabelComponent {
|
|
921
|
+
scales = inject(CHART_SCALES);
|
|
922
|
+
thresholds = input([], ...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
923
|
+
lines = computed(() => thresholdMarks(this.thresholds(), this.scales.plot(), this.scales.yPosition()).filter((mark) => mark.label !== ''), ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
924
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
925
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ReferenceLabelComponent, isStandalone: true, selector: "g[dsReferenceLabel]", inputs: { thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<svg:g class=\"reference-labels\">\n @for (line of lines(); track line.key) {\n <svg:text\n class=\"threshold-label\"\n text-anchor=\"start\"\n [style.--_chart-threshold-color]=\"line.color\"\n [attr.x]=\"line.labelX\"\n [attr.y]=\"line.labelY\">\n {{ line.label }}\n </svg:text>\n }\n</svg:g>\n", styles: [".threshold-label{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));fill:var(--_chart-threshold-color);font-size:var(--ds-chart-axis-font-size);font-weight:600;paint-order:stroke;stroke:var(--ds-chart-frame-bg-color);stroke-width:3;stroke-linejoin:round}@media(forced-colors:active){.threshold-label{fill:CanvasText;stroke:Canvas}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
926
|
+
}
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, decorators: [{
|
|
928
|
+
type: Component,
|
|
929
|
+
args: [{ selector: 'g[dsReferenceLabel]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g class=\"reference-labels\">\n @for (line of lines(); track line.key) {\n <svg:text\n class=\"threshold-label\"\n text-anchor=\"start\"\n [style.--_chart-threshold-color]=\"line.color\"\n [attr.x]=\"line.labelX\"\n [attr.y]=\"line.labelY\">\n {{ line.label }}\n </svg:text>\n }\n</svg:g>\n", styles: [".threshold-label{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));fill:var(--_chart-threshold-color);font-size:var(--ds-chart-axis-font-size);font-weight:600;paint-order:stroke;stroke:var(--ds-chart-frame-bg-color);stroke-width:3;stroke-linejoin:round}@media(forced-colors:active){.threshold-label{fill:CanvasText;stroke:Canvas}}\n"] }]
|
|
930
|
+
}], propDecorators: { thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }] } });
|
|
931
|
+
|
|
932
|
+
let nextReferenceId = 0;
|
|
933
|
+
/**
|
|
934
|
+
* Reference lines and bands across the plot, drawn against the scales `ds-chart` supplies.
|
|
935
|
+
*
|
|
936
|
+
* Strokes only: the LABELS are a second element, `g[dsReferenceLabel]`, because the two belong in
|
|
937
|
+
* different layers of the canvas - a line reads as furniture under the marks, a label has to stay
|
|
938
|
+
* legible over them - and one projected element can only land in one of the container's slots.
|
|
939
|
+
*
|
|
940
|
+
* Hosted on a `<g>` rather than an element of its own: an element the SVG specification does not
|
|
941
|
+
* know is not rendered, and neither are its descendants. Written as `<svg:g dsReferenceLine>`.
|
|
942
|
+
*
|
|
943
|
+
* @internal
|
|
944
|
+
*/
|
|
945
|
+
class ReferenceLineComponent {
|
|
946
|
+
scales = inject(CHART_SCALES);
|
|
947
|
+
thresholds = input([], ...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
948
|
+
domainId = `reference-line-${nextReferenceId++}`;
|
|
949
|
+
constructor() {
|
|
950
|
+
// Reported like a series: a target above every reading is the one the reader most needs to
|
|
951
|
+
// see, and an axis derived from the data alone would draw it off the plot.
|
|
952
|
+
effect(() => this.scales.reportDomain(this.domainId, this.thresholds().flatMap((threshold) => threshold.to == null
|
|
953
|
+
? [threshold.value]
|
|
954
|
+
: [threshold.value, threshold.to])));
|
|
955
|
+
}
|
|
956
|
+
ngOnDestroy() {
|
|
957
|
+
this.scales.releaseDomain(this.domainId);
|
|
958
|
+
}
|
|
959
|
+
lines = computed(() => thresholdMarks(this.thresholds(), this.scales.plot(), this.scales.yPosition()), ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
960
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
961
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ReferenceLineComponent, isStandalone: true, selector: "g[dsReferenceLine]", inputs: { thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n</svg:g>\n", styles: [".references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
962
|
+
}
|
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLineComponent, decorators: [{
|
|
964
|
+
type: Component,
|
|
965
|
+
args: [{ selector: 'g[dsReferenceLine]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n</svg:g>\n", styles: [".references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"] }]
|
|
966
|
+
}], ctorParameters: () => [], propDecorators: { thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }] } });
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Generated bundle index. Do not edit.
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
export { CHART_SCALES, ChartComponent, ColumnSeriesComponent, LineSeriesComponent, ReferenceLabelComponent, ReferenceLineComponent, chartViewHeight, stackOffsets };
|
|
973
|
+
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-chart.mjs.map
|