@ids-group-ltd/ids-design-system 0.15.0 → 0.15.2
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 +496 -0
- package/components.md +69 -38
- package/docs/agent/INDEX.md +3 -3
- package/docs/agent/charts/column-series-component.md +1 -1
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-column-chart.md +2 -1
- package/docs/agent/charts/ds-heatmap-chart.md +2 -1
- package/docs/agent/charts/ds-line-chart.md +3 -3
- package/docs/agent/charts/ds-pie-chart.md +3 -2
- package/docs/agent/charts/ds-scatter-chart.md +2 -1
- package/docs/agent/charts/ds-waterfall-chart.md +1 -1
- package/docs/agent/charts/line-series-component.md +1 -1
- package/docs/agent/feedback/ds-alert.md +1 -0
- package/docs/agent/feedback/ds-banner.md +1 -0
- package/docs/agent/feedback/ds-toast.md +2 -0
- package/docs/agent/forms/ds-autocomplete.md +1 -1
- package/docs/agent/forms/ds-button.md +1 -0
- package/docs/agent/forms/ds-checkbox.md +1 -1
- package/docs/agent/forms/ds-color-picker.md +1 -1
- package/docs/agent/forms/ds-date-picker.md +1 -1
- package/docs/agent/forms/ds-icon-button.md +1 -1
- package/docs/agent/forms/ds-input.md +1 -1
- package/docs/agent/forms/ds-multi-select.md +1 -1
- package/docs/agent/forms/ds-otp-input.md +1 -1
- package/docs/agent/forms/ds-radio-group.md +1 -1
- package/docs/agent/forms/ds-segmented.md +1 -1
- package/docs/agent/forms/ds-select.md +1 -1
- package/docs/agent/forms/ds-slider.md +1 -1
- package/docs/agent/forms/ds-switch.md +1 -1
- package/docs/agent/forms/ds-textarea.md +1 -1
- package/docs/agent/forms/ds-time-picker.md +1 -1
- package/docs/agent/forms/the-picker-family-ds-select-ds-multi-select-ds-autocomplete.md +1 -1
- package/docs/agent/foundations/global-helper-classes.md +1 -1
- package/docs/agent/foundations/tokens.md +1 -1
- package/docs/agent/navigation/ds-pagination.md +2 -1
- package/docs/agent/overlays/ds-definition-term.md +1 -1
- package/docs/agent/overlays/ds-info-hint.md +21 -2
- package/docs/agent/overlays/ds-tooltip-panel.md +1 -1
- package/docs/agent/overlays/ds-tooltip.md +1 -1
- package/docs/agent/tables/ds-table-columns.md +2 -0
- package/docs/agent/tables/ds-table.md +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +6 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +6 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +8 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +7 -17
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +694 -77
- 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 +2190 -1234
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +10 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +15 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +44 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +22 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +44 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +4 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +49 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +5 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs +76 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +11 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +33 -44
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +50 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +10 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +14 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +102 -27
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +5 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +11 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +123 -23
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +10 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-show-dirty.mjs +55 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-show-dirty.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +10 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +10 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +32 -14
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-resize.mjs +17 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-resize.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +259 -21
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +15 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +24 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +17 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +32 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +10 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +238 -67
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +9 -2
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.15.0.json +43 -12
- package/migrations/0.15.1.json +745 -0
- package/migrations/0.15.2.json +164 -0
- package/migrations/0.3.0.json +16 -9
- package/package.json +9 -1
- package/schematics/check-overrides/surface.json +48 -1
- package/stylelint/deprecated-tokens.json +7 -0
- package/styles/_chart-frame.scss +14 -0
- package/styles/_chart-interactive.scss +26 -1
- package/styles/_chart-motion.scss +47 -8
- package/styles/_link.scss +30 -12
- package/styles/_tokens.scss +3 -0
- package/themes/README.md +55 -0
- package/themes/_semantic.scss +6 -7
- package/themes/dark/_theme.scss +7 -7
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +5 -4
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +4 -4
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +51 -7
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +201 -28
- package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +27 -2
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +19 -2
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +0 -3
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +21 -8
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +3 -2
- package/types/ids-group-ltd-ids-design-system-components-info-hint.d.ts +13 -4
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +13 -7
- package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +6 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +5 -3
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +24 -7
- package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +2 -1
- package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +39 -7
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-show-dirty.d.ts +29 -0
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-table-resize.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +51 -11
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +8 -6
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +4 -1
- package/types/ids-group-ltd-ids-design-system-components.d.ts +110 -34
- package/types/ids-group-ltd-ids-design-system-core.d.ts +44 -12
- package/types/ids-group-ltd-ids-design-system.d.ts +3 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, input,
|
|
3
|
-
import { domainMinOf, niceDomain, linearScale, tickValues, roundStepAtLeast,
|
|
2
|
+
import { InjectionToken, inject, input, booleanAttribute, computed, numberAttribute, output, effect, afterRenderEffect, untracked, ElementRef, signal, NgZone, viewChildren, ChangeDetectionStrategy, ViewEncapsulation, Component, PLATFORM_ID, contentChildren, viewChild, DestroyRef, forwardRef } from '@angular/core';
|
|
3
|
+
import { domainMinOf, niceDomain, linearScale, tickValues, roundStepAtLeast, formatPercent, leaveMark, CHART_TOOLTIP_LINGER_MS, chartValueFormat, listenForMarkFocus, CHART_SERIES_COLORS, lineSegments, linePath, areaPath, bandPath, staggerDelay, tweenMarks, markOf, leftMark, nextRovingIndex, focusMark, dimmedBy, DsChartBase, chartRenderGate, CHART_SKELETON_COUNT, skeletonMarkCount, elementWidth, afterTwoFrames, bandScale, rotationWouldFit, labelInterval, chartTiming, rovingMarks, describeShare } from '@ids-group-ltd/ids-design-system/components';
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
|
-
import { chartActiveMark, CHART_PIN_RADIUS, CHART_PIN_GAP, CHART_UNPIN_DRAWN_BY_HOST, ChartSkeletonComponent, ChartTooltipDirective,
|
|
6
|
-
import { resolveWithConfig, injectDsLocale, DS_INTL } from '@ids-group-ltd/ids-design-system/core';
|
|
5
|
+
import { chartActiveMark, CHART_PIN_RADIUS, CHART_PIN_GAP, ChartPinMarkerComponent, CHART_UNPIN_DRAWN_BY_HOST, isPrimaryPress, ChartSkeletonComponent, ChartTooltipDirective, ChartPlacedDirective, ChartStatesComponent } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';
|
|
6
|
+
import { resolveWithConfig, injectDsLocale, DS_INTL_DEFAULTS, DS_INTL } from '@ids-group-ltd/ids-design-system/core';
|
|
7
7
|
|
|
8
8
|
const CHART_DEFAULT_TICK_COUNT = 5;
|
|
9
9
|
const CHART_AXIS_LABEL_GAP = 8;
|
|
@@ -265,1071 +265,2012 @@ function categoryAt(x, plotLeft, plotWidth, categoryCount) {
|
|
|
265
265
|
const band = plotWidth / categoryCount;
|
|
266
266
|
return Math.min(categoryCount - 1, Math.floor(offset / band));
|
|
267
267
|
}
|
|
268
|
+
/** Where a pin's disc centres on a mark spanning `top` to `top + height`, `inset` being the disc's
|
|
269
|
+
* radius plus its gap: inside the mark's upper end when it holds the disc, else above the mark and
|
|
270
|
+
* above `valueTop`, the top of the value printed over it. */
|
|
271
|
+
function pinYAbove(top, height, valueTop, inset) {
|
|
272
|
+
if (height >= 2 * inset) {
|
|
273
|
+
return top + inset;
|
|
274
|
+
}
|
|
275
|
+
return Math.min(top, valueTop ?? top) - inset;
|
|
276
|
+
}
|
|
277
|
+
/** Whether category `index` falls outside a selected range; nothing is outside no range. */
|
|
278
|
+
function outsideRange(range, index) {
|
|
279
|
+
return range !== null && (index < range.from || index > range.to);
|
|
280
|
+
}
|
|
268
281
|
/** Readings ordered top to bottom with the height dropped; ties and readings with no height keep their place. */
|
|
269
282
|
function topDown(entries) {
|
|
270
283
|
return [...entries]
|
|
271
284
|
.sort((above, below) => (above.y ?? Infinity) - (below.y ?? Infinity) || 0)
|
|
272
285
|
.map(({ y: _drawnAt, ...reading }) => reading);
|
|
273
286
|
}
|
|
287
|
+
/** A key per category that follows the category, not its position: its label, numbered from the
|
|
288
|
+
* second time a label repeats. A mark keyed by it moves with its category when another comes or goes. */
|
|
289
|
+
function categoryKeys(labels) {
|
|
290
|
+
const seen = new Map();
|
|
291
|
+
return labels.map((label) => {
|
|
292
|
+
const count = seen.get(label) ?? 0;
|
|
293
|
+
seen.set(label, count + 1);
|
|
294
|
+
return count === 0 ? label : `${label}#${count}`;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/** The change from one reading to the next: its direction, and its percentage, which is `null` from zero. */
|
|
298
|
+
function changeBetween(from, to, locale) {
|
|
299
|
+
const change = to - from;
|
|
300
|
+
return {
|
|
301
|
+
rising: change >= 0,
|
|
302
|
+
label: from === 0
|
|
303
|
+
? null
|
|
304
|
+
: `${change > 0 ? '+' : ''}${formatPercent(change, Math.abs(from), locale)}`,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
274
307
|
|
|
275
308
|
const CHART_SCALES = new InjectionToken('CHART_SCALES');
|
|
276
309
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
310
|
+
let nextSeriesId$1 = 0;
|
|
311
|
+
// The active marker's default radius, `--chart-dot-radius-active`.
|
|
312
|
+
const PIN_MARKER_CLEARANCE = 6;
|
|
313
|
+
// From the higher end of a thickened change to the baseline of its percentage.
|
|
314
|
+
const CHANGE_LABEL_GAP = 10;
|
|
315
|
+
// View units between two samples of a line; a travelling marker interpolates between them.
|
|
316
|
+
const PATH_SAMPLE_STEP = 2;
|
|
317
|
+
const sampledPaths = new WeakMap();
|
|
318
|
+
// Read once per geometry: every `getPointAtLength` forces style and layout.
|
|
319
|
+
function samplesOf(path) {
|
|
320
|
+
const geometry = `${path.getAttribute('d')}|${path.style.getPropertyValue('d')}`;
|
|
321
|
+
const cached = sampledPaths.get(path);
|
|
322
|
+
if (cached?.geometry === geometry) {
|
|
323
|
+
return cached;
|
|
324
|
+
}
|
|
325
|
+
const total = path.getTotalLength();
|
|
326
|
+
const count = Math.max(2, Math.ceil(total / PATH_SAMPLE_STEP) + 1);
|
|
327
|
+
const samples = {
|
|
328
|
+
geometry,
|
|
329
|
+
xs: new Float64Array(count),
|
|
330
|
+
ys: new Float64Array(count),
|
|
331
|
+
lengths: new Float64Array(count),
|
|
332
|
+
};
|
|
333
|
+
for (let index = 0; index < count; index++) {
|
|
334
|
+
const length = (total * index) / (count - 1);
|
|
335
|
+
const point = path.getPointAtLength(length);
|
|
336
|
+
samples.xs[index] = point.x;
|
|
337
|
+
samples.ys[index] = point.y;
|
|
338
|
+
samples.lengths[index] = length;
|
|
339
|
+
}
|
|
340
|
+
// Mid-glide the drawn line is not the one its `d` names.
|
|
341
|
+
if (path.getAnimations().length === 0) {
|
|
342
|
+
sampledPaths.set(path, samples);
|
|
343
|
+
}
|
|
344
|
+
return samples;
|
|
345
|
+
}
|
|
346
|
+
// The first index whose value reaches `target`, over ascending values.
|
|
347
|
+
function firstReaching(values, target) {
|
|
348
|
+
let low = 0;
|
|
349
|
+
let high = values.length - 1;
|
|
350
|
+
while (low < high) {
|
|
351
|
+
const middle = (low + high) >> 1;
|
|
352
|
+
if (values[middle] < target) {
|
|
353
|
+
low = middle + 1;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
high = middle;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return low;
|
|
360
|
+
}
|
|
361
|
+
function shareBetween(values, index, target) {
|
|
362
|
+
const span = index === 0 ? 0 : values[index] - values[index - 1];
|
|
363
|
+
return span > 0 ? (target - values[index - 1]) / span : 1;
|
|
364
|
+
}
|
|
365
|
+
function interpolate(values, index, share) {
|
|
366
|
+
return index === 0
|
|
367
|
+
? values[0]
|
|
368
|
+
: values[index - 1] + (values[index] - values[index - 1]) * share;
|
|
369
|
+
}
|
|
370
|
+
// Distance along a line drawn left to right at which it reaches `x`; on a vertical run at `x` (a
|
|
371
|
+
// step's riser), the sample nearest `y`.
|
|
372
|
+
function lengthAt(samples, x, y) {
|
|
373
|
+
const index = firstReaching(samples.xs, x);
|
|
374
|
+
let nearest = index;
|
|
375
|
+
for (let candidate = index + 1; candidate < samples.xs.length && samples.xs[candidate] - x < 0.5; candidate++) {
|
|
376
|
+
if (Math.abs(samples.ys[candidate] - y) < Math.abs(samples.ys[nearest] - y)) {
|
|
377
|
+
nearest = candidate;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (nearest !== index) {
|
|
381
|
+
return samples.lengths[nearest];
|
|
382
|
+
}
|
|
383
|
+
return interpolate(samples.lengths, index, shareBetween(samples.xs, index, x));
|
|
384
|
+
}
|
|
385
|
+
function pointAtLength(samples, length) {
|
|
386
|
+
const index = firstReaching(samples.lengths, length);
|
|
387
|
+
const share = shareBetween(samples.lengths, index, length);
|
|
388
|
+
return {
|
|
389
|
+
x: interpolate(samples.xs, index, share),
|
|
390
|
+
y: interpolate(samples.ys, index, share),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
// The drawn piece of a series that spans both x positions; a gap between them leaves none.
|
|
394
|
+
function lineThrough(paths, fromX, toX) {
|
|
395
|
+
const low = Math.min(fromX, toX);
|
|
396
|
+
const high = Math.max(fromX, toX);
|
|
397
|
+
for (const path of paths) {
|
|
398
|
+
const samples = samplesOf(path);
|
|
399
|
+
if (samples.xs[0] <= low + 0.5 &&
|
|
400
|
+
samples.xs[samples.xs.length - 1] >= high - 0.5) {
|
|
401
|
+
return samples;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
// The new keys in order, each removed key placed after the key it followed.
|
|
407
|
+
function mergedKeys(previous, next) {
|
|
408
|
+
const merged = [...next];
|
|
409
|
+
const kept = new Set(next);
|
|
410
|
+
previous.forEach((key, index) => {
|
|
411
|
+
if (kept.has(key)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const before = previous
|
|
415
|
+
.slice(0, index)
|
|
416
|
+
.reverse()
|
|
417
|
+
.find((candidate) => merged.includes(candidate));
|
|
418
|
+
merged.splice(before === undefined ? 0 : merged.indexOf(before) + 1, 0, key);
|
|
419
|
+
});
|
|
420
|
+
return merged;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* One line per series, drawn against the scales `ds-chart` supplies, on either value axis.
|
|
424
|
+
*
|
|
425
|
+
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants.
|
|
426
|
+
* Written as `<svg:g dsLineSeries>`.
|
|
427
|
+
*/
|
|
428
|
+
class LineSeriesComponent {
|
|
429
|
+
leaveMark = leaveMark;
|
|
430
|
+
scales = inject(CHART_SCALES);
|
|
431
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this element (NG0950). */
|
|
432
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
433
|
+
/** Draws a round marker at every reading; reads better off past roughly twenty points. */
|
|
434
|
+
showMarkers = input(true, { ...(ngDevMode ? { debugName: "showMarkers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
435
|
+
/** Lays the line and markers on a background-colour band so they stay legible where they cross other marks. */
|
|
436
|
+
outline = input(true, { ...(ngDevMode ? { debugName: "outline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
437
|
+
/** Turns on the click affordance (pointer cursor and hover tint). `pointClicked` fires either way. */
|
|
438
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
439
|
+
/** Holds the clicked mark and its tooltip until a second click, Escape or a press outside. Unset
|
|
440
|
+
* falls back to `DS_CONFIG.chart.pinOnClick`, then `true`; the category cursor holds the category instead. */
|
|
441
|
+
pinOnClick = input(null, { ...(ngDevMode ? { debugName: "pinOnClick" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? null : booleanAttribute(value)) });
|
|
295
442
|
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
|
|
326
|
-
|
|
443
|
+
pins = computed(() => this.pinOnClickResolved() && !this.scales.cursorOn?.(), ...(ngDevMode ? [{ debugName: "pins" }] : /* istanbul ignore next */ []));
|
|
444
|
+
/** Fades every series but the one under the pointer or singled out by `highlighted`. Off by default:
|
|
445
|
+
* it costs separation between the rest. */
|
|
446
|
+
dimOthers = input(false, { ...(ngDevMode ? { debugName: "dimOthers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
447
|
+
/** The series to single out, as hovering one of its markers does: it draws bold, and under
|
|
448
|
+
* `dimOthers` the others fade. */
|
|
449
|
+
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
450
|
+
/** On the hovered reading, thickens the stretches from the reading before it and to the reading
|
|
451
|
+
* after it, each in its own rising or falling colour (`--ds-chart-positive-color`,
|
|
452
|
+
* `--ds-chart-negative-color`) and, unless it starts at zero, with its own change in percent. With several series it follows the one singled out: hovered, focused or highlighted. */
|
|
453
|
+
showChange = input(false, { ...(ngDevMode ? { debugName: "showChange" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
454
|
+
/** A dash pattern per series, in series order. A series past the end, or given `''`, draws solid. */
|
|
455
|
+
patterns = input([], ...(ngDevMode ? [{ debugName: "patterns" }] : /* istanbul ignore next */ []));
|
|
456
|
+
/** Fills each area from the series below it rather than from the baseline (stacked plots). */
|
|
457
|
+
stacked = input(false, { ...(ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
458
|
+
dashFor(seriesIndex) {
|
|
459
|
+
return this.patterns()[seriesIndex] || null;
|
|
460
|
+
}
|
|
461
|
+
/** Milliseconds between one series' entrance and the next, narrowed to fit the stagger budget; `0` is off. */
|
|
462
|
+
staggerMs = input(40, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
463
|
+
/** What a `null` reading draws: `'break'` leaves a hole in the line, `'zero'` plots a point at zero. */
|
|
464
|
+
gaps = input('break', ...(ngDevMode ? [{ debugName: "gaps" }] : /* istanbul ignore next */ []));
|
|
465
|
+
/** How the line joins its readings: `'linear'` (default) asserts nothing between them; `'step'`
|
|
466
|
+
* holds each reading to the next; `'smooth'` is a monotone cubic that draws no peak the data lacks. */
|
|
467
|
+
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
468
|
+
/** Whether a hovered or focused reading opens a tooltip: `'item'` names the marker, `'axis'` every
|
|
469
|
+
* series at the category, turning the container's category cursor on under `cursor="auto"`. */
|
|
470
|
+
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
471
|
+
/** Where an `'axis'` panel hangs: `'reading'` over the highest reading in the category; `'pointer'` follows the cursor. */
|
|
472
|
+
tooltipAnchor = input('reading', ...(ngDevMode ? [{ debugName: "tooltipAnchor" }] : /* istanbul ignore next */ []));
|
|
473
|
+
/** Milliseconds the panel survives the pointer leaving the marker within the chart. */
|
|
474
|
+
tooltipLingerMs = input(CHART_TOOLTIP_LINGER_MS, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
475
|
+
/** Formats every value this series prints: `'tick'` for an axis label, `'tooltip'` for a value in full. */
|
|
476
|
+
valueFormat = input(chartValueFormat(injectDsLocale()), ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
477
|
+
/** The clicked reading, its series and position in `categories`. Fires on click and Enter or Space, whatever `interactive` says. */
|
|
478
|
+
pointClicked = output();
|
|
479
|
+
domainId = `line-series-${nextSeriesId$1++}`;
|
|
480
|
+
fadeId(seriesIndex) {
|
|
481
|
+
return `${this.domainId}-fade-${seriesIndex}`;
|
|
482
|
+
}
|
|
327
483
|
constructor() {
|
|
328
|
-
super();
|
|
329
|
-
effect((onCleanup) => {
|
|
330
|
-
if (this.settled() || this.measuredWidth() === 0) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
let first = 0;
|
|
334
|
-
let second = 0;
|
|
335
|
-
// Outside the zone: under zone.js each frame callback is a full application tick.
|
|
336
|
-
this.zone.runOutsideAngular(() => {
|
|
337
|
-
first = requestAnimationFrame(() => {
|
|
338
|
-
second = requestAnimationFrame(() => this.settled.set(true));
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
onCleanup(() => {
|
|
342
|
-
cancelAnimationFrame(first);
|
|
343
|
-
cancelAnimationFrame(second);
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
// Before the view drops the stops past the new end, while the focused one is still in the DOM.
|
|
347
484
|
effect(() => {
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
this.cursorState.release();
|
|
352
|
-
this.cursorState.setIndex(last);
|
|
353
|
-
}
|
|
354
|
-
if (this.roving() > last && this.keyboardFocusInside()) {
|
|
355
|
-
this.refocusStop = true;
|
|
485
|
+
for (const axis of ['primary', 'secondary']) {
|
|
486
|
+
for (const hidden of [false, true]) {
|
|
487
|
+
this.scales.reportDomain(this.reportIdOf(axis, hidden), this.valuesOn(axis, hidden), axis, hidden);
|
|
356
488
|
}
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
afterRenderEffect(() => {
|
|
360
|
-
this.categories();
|
|
361
|
-
if (this.refocusStop) {
|
|
362
|
-
this.refocusStop = false;
|
|
363
|
-
untracked(() => this.focusStop(this.focusedCategory()));
|
|
364
489
|
}
|
|
365
490
|
});
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
491
|
+
this.scales.reportTooltip(this.domainId, {
|
|
492
|
+
context: this.tooltipContext,
|
|
493
|
+
origin: this.tooltipOrigin,
|
|
494
|
+
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
495
|
+
readsCategory: computed(() => this.tooltip() === 'axis'),
|
|
496
|
+
axisOrigin: this.topReadingElement,
|
|
497
|
+
axisReadingY: this.topReadingY,
|
|
498
|
+
axisEntries: this.axisEntries,
|
|
499
|
+
axisPointElements: this.axisPointElements,
|
|
500
|
+
axisReadout: this.axisReadout,
|
|
501
|
+
valuesByCategory: this.valuesByCategory,
|
|
371
502
|
});
|
|
372
|
-
// Read phase: every `getComputedTextLength` before any write, or each label forces a layout.
|
|
373
503
|
afterRenderEffect({
|
|
374
|
-
|
|
375
|
-
this.
|
|
376
|
-
this.
|
|
377
|
-
this.
|
|
378
|
-
this.measuredCategoryLabelWidth.set(this.widestLabel('.category-label'));
|
|
504
|
+
write: () => {
|
|
505
|
+
this.scales.activeIndex();
|
|
506
|
+
this.plotted();
|
|
507
|
+
untracked(() => this.zone.runOutsideAngular(() => this.moveTravelMarkers()));
|
|
379
508
|
},
|
|
380
509
|
});
|
|
381
510
|
afterRenderEffect({
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
? this.host.nativeElement.querySelector('[dschartpinmarker]')
|
|
386
|
-
: null;
|
|
387
|
-
const rise = origin instanceof Element && pin
|
|
388
|
-
? origin.getBoundingClientRect().top -
|
|
389
|
-
pin.getBoundingClientRect().top
|
|
390
|
-
: 0;
|
|
391
|
-
this.pinRise.set(Math.max(0, Math.round(rise)));
|
|
511
|
+
write: () => {
|
|
512
|
+
const plotted = this.plotted();
|
|
513
|
+
untracked(() => this.zone.runOutsideAngular(() => this.morphOnCategoryChange(plotted)));
|
|
392
514
|
},
|
|
393
515
|
});
|
|
516
|
+
listenForMarkFocus(inject(ElementRef), (event, hit) => this.onMarkerFocus(event, hit), () => {
|
|
517
|
+
this.focusedSeries.set(null);
|
|
518
|
+
this.activeMark.leave();
|
|
519
|
+
this.scales.setActiveIndex(-1);
|
|
520
|
+
});
|
|
394
521
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
522
|
+
ngOnDestroy() {
|
|
523
|
+
this.scales.releaseTooltip(this.domainId);
|
|
524
|
+
for (const axis of ['primary', 'secondary']) {
|
|
525
|
+
this.scales.releaseDomain(this.reportIdOf(axis, false));
|
|
526
|
+
this.scales.releaseDomain(this.reportIdOf(axis, true));
|
|
400
527
|
}
|
|
401
|
-
return Math.ceil(widest);
|
|
402
|
-
}
|
|
403
|
-
/** Two plots stacked on a shared category axis. */
|
|
404
|
-
stacked = computed(() => this.secondaryAxisMode() === 'split' && this.hasSecondaryAxis(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
405
|
-
viewHeight = computed(() => chartViewHeight(this.plotHeight(), this.valueSpace(), this.reachesBelowZero()) + (this.stacked() ? this.plotHeight() + CHART_STACKED_PLOT_GAP : 0), ...(ngDevMode ? [{ debugName: "viewHeight" }] : /* istanbul ignore next */ []));
|
|
406
|
-
/** One viewBox unit is one CSS pixel, so lengths inside the plot hold at every width. */
|
|
407
|
-
viewBox = computed(() => `0 0 ${this.viewWidth()} ${this.viewHeight()}`, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
408
|
-
/** Widest tick label as rendered, in CSS pixels. Zero until the first read and under SSR. */
|
|
409
|
-
measuredLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredLabelWidth" }] : /* istanbul ignore next */ []));
|
|
410
|
-
measuredCategoryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredCategoryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
411
|
-
/** `axisGutter` is the floor: compact numbers are wider in some locales and the SVG clips overflow. */
|
|
412
|
-
effectiveAxisGutter = computed(() => Math.max(this.axisGutter(), this.measuredLabelWidth() + CHART_AXIS_LABEL_GAP + this.axisTitleGutter()), ...(ngDevMode ? [{ debugName: "effectiveAxisGutter" }] : /* istanbul ignore next */ []));
|
|
413
|
-
/** A rotated axis title shares the tick gutter; its width is its line height. */
|
|
414
|
-
axisTitleGutter = computed(() => this.axisLabel() ? CHART_AXIS_TITLE_BAND : 0, ...(ngDevMode ? [{ debugName: "axisTitleGutter" }] : /* istanbul ignore next */ []));
|
|
415
|
-
axisTitleX = computed(() => CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "axisTitleX" }] : /* istanbul ignore next */ []));
|
|
416
|
-
secondaryTitleX = computed(() => this.viewWidth() - CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "secondaryTitleX" }] : /* istanbul ignore next */ []));
|
|
417
|
-
measuredSecondaryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredSecondaryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
418
|
-
/** Right-hand label room only when the second axis is drawn there; a stacked one is on the left. */
|
|
419
|
-
rightGutter = computed(() => this.hasSecondaryAxis() && !this.stacked()
|
|
420
|
-
? Math.max(this.axisGutter(), this.measuredSecondaryLabelWidth() +
|
|
421
|
-
CHART_AXIS_LABEL_GAP +
|
|
422
|
-
this.secondaryTitleGutter())
|
|
423
|
-
: CHART_EDGE_GUTTER, ...(ngDevMode ? [{ debugName: "rightGutter" }] : /* istanbul ignore next */ []));
|
|
424
|
-
secondaryTitleGutter = computed(() => this.secondaryAxisLabel() && this.hasSecondaryAxis()
|
|
425
|
-
? CHART_AXIS_TITLE_BAND
|
|
426
|
-
: 0, ...(ngDevMode ? [{ debugName: "secondaryTitleGutter" }] : /* istanbul ignore next */ []));
|
|
427
|
-
plot = computed(() => chartPlot(this.viewWidth(), this.plotHeight(), this.effectiveAxisGutter(), this.valueSpace(), this.rightGutter()), ...(ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []));
|
|
428
|
-
secondaryPlot = computed(() => {
|
|
429
|
-
const plot = this.plot();
|
|
430
|
-
return this.stacked()
|
|
431
|
-
? { ...plot, top: plot.top + plot.height + CHART_STACKED_PLOT_GAP }
|
|
432
|
-
: plot;
|
|
433
|
-
}, ...(ngDevMode ? [{ debugName: "secondaryPlot" }] : /* istanbul ignore next */ []));
|
|
434
|
-
reportedDomains = signal(new Map(), ...(ngDevMode ? [{ debugName: "reportedDomains" }] : /* istanbul ignore next */ []));
|
|
435
|
-
reportDomain(id, values, axis = 'primary') {
|
|
436
|
-
this.reportedDomains.update((reported) => new Map(reported).set(id, { axis, values }));
|
|
437
528
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (report.axis === axis) {
|
|
442
|
-
found.push(report.values);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return found;
|
|
529
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs(), () => this.scales.hoverDelayMs?.() ?? 0);
|
|
530
|
+
reportIdOf(axis, hidden) {
|
|
531
|
+
return `${this.domainId}-${axis}${hidden ? '-hidden' : ''}`;
|
|
446
532
|
}
|
|
447
|
-
|
|
448
|
-
this.
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
});
|
|
533
|
+
valuesOn(axis, hidden) {
|
|
534
|
+
return this.data()
|
|
535
|
+
.filter((series) => (series.axis ?? 'primary') === axis &&
|
|
536
|
+
(series.hidden ?? false) === hidden)
|
|
537
|
+
.flatMap((series) => series.data.filter((value) => value !== null));
|
|
453
538
|
}
|
|
454
|
-
/** A
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
539
|
+
/** A `null` past the end is a missing reading. */
|
|
540
|
+
readingsOf(series, count) {
|
|
541
|
+
const zeroed = this.gaps() === 'zero';
|
|
542
|
+
const readings = [];
|
|
543
|
+
for (let index = 0; index < count; index++) {
|
|
544
|
+
const raw = series.data[index];
|
|
545
|
+
const reading = typeof raw === 'number' && Number.isFinite(raw) ? raw : null;
|
|
546
|
+
readings.push(reading === null && zeroed ? 0 : reading);
|
|
547
|
+
}
|
|
548
|
+
return readings;
|
|
461
549
|
}
|
|
462
|
-
|
|
463
|
-
this.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
550
|
+
plotted = computed(() => {
|
|
551
|
+
const toX = this.scales.xPosition();
|
|
552
|
+
const primaryY = this.scales.yPosition();
|
|
553
|
+
const secondaryY = this.scales.secondaryYPosition();
|
|
554
|
+
const categories = this.scales.categories();
|
|
555
|
+
const keys = categoryKeys(categories);
|
|
556
|
+
let markerIndex = 0;
|
|
557
|
+
return this.data().map((series, index) => {
|
|
558
|
+
const secondary = (series.axis ?? 'primary') === 'secondary';
|
|
559
|
+
const toY = secondary ? secondaryY : primaryY;
|
|
560
|
+
const color = series.color ?? CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
561
|
+
const points = this.readingsOf(series, categories.length).map((value, categoryIndex) => value === null
|
|
562
|
+
? null
|
|
563
|
+
: {
|
|
564
|
+
categoryIndex,
|
|
565
|
+
x: toX(categoryIndex),
|
|
566
|
+
y: toY(value),
|
|
567
|
+
value,
|
|
568
|
+
});
|
|
569
|
+
const segments = lineSegments(points);
|
|
570
|
+
const format = this.valueFormat();
|
|
571
|
+
const curve = this.curve();
|
|
572
|
+
return {
|
|
573
|
+
series,
|
|
574
|
+
color,
|
|
575
|
+
seriesIndex: index,
|
|
576
|
+
linePaths: segments.map((segment) => linePath(segment, curve)),
|
|
577
|
+
areaPaths: series.area
|
|
578
|
+
? this.areaPathsFor(series, segments, toX, toY, curve)
|
|
579
|
+
: [],
|
|
580
|
+
markers: points
|
|
581
|
+
.filter((point) => point !== null)
|
|
582
|
+
.map((point) => ({
|
|
583
|
+
key: `${series.id}-${keys[point.categoryIndex]}`,
|
|
584
|
+
categoryKey: keys[point.categoryIndex],
|
|
585
|
+
markIndex: markerIndex++,
|
|
586
|
+
x: point.x,
|
|
587
|
+
y: point.y,
|
|
588
|
+
value: point.value,
|
|
589
|
+
category: categories[point.categoryIndex] ?? '',
|
|
590
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
591
|
+
seriesLabel: series.label,
|
|
592
|
+
seriesId: series.id,
|
|
593
|
+
categoryIndex: point.categoryIndex,
|
|
594
|
+
color,
|
|
595
|
+
hidden: series.hidden ?? false,
|
|
596
|
+
})),
|
|
597
|
+
};
|
|
467
598
|
});
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
599
|
+
}, ...(ngDevMode ? [{ debugName: "plotted" }] : /* istanbul ignore next */ []));
|
|
600
|
+
visibleCount = computed(() => this.data().filter((series) => !series.hidden).length, ...(ngDevMode ? [{ debugName: "visibleCount" }] : /* istanbul ignore next */ []));
|
|
601
|
+
areaPathsFor(series, segments, toX, toY, curve) {
|
|
602
|
+
const lower = series.lower;
|
|
603
|
+
if (!lower) {
|
|
604
|
+
return segments
|
|
605
|
+
.map((segment) => areaPath(segment, toY(0), curve))
|
|
606
|
+
.filter((path) => path.length > 0);
|
|
475
607
|
}
|
|
476
|
-
const
|
|
477
|
-
return this.composed() || readsCategory ? 'category' : 'none';
|
|
478
|
-
}, ...(ngDevMode ? [{ debugName: "cursorResolved" }] : /* istanbul ignore next */ []));
|
|
479
|
-
cursorOn = computed(() => this.cursorResolved() === 'category', ...(ngDevMode ? [{ debugName: "cursorOn" }] : /* istanbul ignore next */ []));
|
|
480
|
-
/** The tooltip context to show, if any; at most one mark has one at a time. */
|
|
481
|
-
activeTooltip = computed(() => [...this.tooltipSources().values()].find((source) => source.context() !== null) ?? null, ...(ngDevMode ? [{ debugName: "activeTooltip" }] : /* istanbul ignore next */ []));
|
|
482
|
-
// By source and position, not label: two marks may read under one label.
|
|
483
|
-
pickedKey = signal(null, ...(ngDevMode ? [{ debugName: "pickedKey" }] : /* istanbul ignore next */ []));
|
|
484
|
-
pickedReading = computed(() => {
|
|
485
|
-
const picked = this.pickedKey();
|
|
486
|
-
return picked === null
|
|
608
|
+
const lowerSegments = lineSegments(lower.map((value, categoryIndex) => value === null
|
|
487
609
|
? null
|
|
488
|
-
:
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
return
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
610
|
+
: {
|
|
611
|
+
categoryIndex,
|
|
612
|
+
x: toX(categoryIndex),
|
|
613
|
+
y: toY(value),
|
|
614
|
+
value,
|
|
615
|
+
}));
|
|
616
|
+
return segments
|
|
617
|
+
.map((segment, index) => lowerSegments[index]
|
|
618
|
+
? bandPath(segment, lowerSegments[index], curve)
|
|
619
|
+
: areaPath(segment, toY(0), curve))
|
|
620
|
+
.filter((path) => path.length > 0);
|
|
621
|
+
}
|
|
622
|
+
allMarkers = computed(() => this.plotted().flatMap((entry) => entry.markers), ...(ngDevMode ? [{ debugName: "allMarkers" }] : /* istanbul ignore next */ []));
|
|
623
|
+
seriesStagger(index) {
|
|
624
|
+
return `${staggerDelay(index, this.plotted().length, this.staggerMs())}ms`;
|
|
625
|
+
}
|
|
626
|
+
/** One tab stop per series, walked with the arrows: 12 categories x 2 series would be 24 stops. */
|
|
627
|
+
rovingBySeries = signal(new Map(), ...(ngDevMode ? [{ debugName: "rovingBySeries" }] : /* istanbul ignore next */ []));
|
|
628
|
+
firstMarkerBySeries = computed(() => new Map(this.plotted().map((entry) => [
|
|
629
|
+
entry.series.id,
|
|
630
|
+
entry.markers[0]?.markIndex,
|
|
631
|
+
])), ...(ngDevMode ? [{ debugName: "firstMarkerBySeries" }] : /* istanbul ignore next */ []));
|
|
632
|
+
isTabStop(seriesId, markIndex) {
|
|
633
|
+
return ((this.rovingBySeries().get(seriesId) ??
|
|
634
|
+
this.firstMarkerBySeries().get(seriesId)) === markIndex);
|
|
635
|
+
}
|
|
636
|
+
/** The series a marker holds focus on; narrows an `'axis'` panel to that reading. */
|
|
637
|
+
focusedSeries = signal(null, ...(ngDevMode ? [{ debugName: "focusedSeries" }] : /* istanbul ignore next */ []));
|
|
638
|
+
/** Active when its own marker is hovered, or its category is active while the category cursor is
|
|
639
|
+
* off; under the cursor a travelling marker answers the category instead. */
|
|
640
|
+
isActiveMarker(marker) {
|
|
641
|
+
return (marker.markIndex === this.activeMark.index() ||
|
|
642
|
+
(!this.scales.cursorOn?.() &&
|
|
643
|
+
marker.categoryIndex === this.scales.activeIndex()));
|
|
644
|
+
}
|
|
645
|
+
isOutsideRange(categoryIndex) {
|
|
646
|
+
return outsideRange(this.scales.selectedRange?.() ?? null, categoryIndex);
|
|
647
|
+
}
|
|
648
|
+
host = inject(ElementRef);
|
|
649
|
+
zone = inject(NgZone);
|
|
650
|
+
travel = new Map();
|
|
651
|
+
// One marker per series rides the line from the reading it left to the one the category cursor is
|
|
652
|
+
// on, on the panel's timing; a data change at the same category moves it on the marks' timing.
|
|
653
|
+
moveTravelMarkers() {
|
|
654
|
+
const categoryIndex = this.scales.activeIndex();
|
|
655
|
+
const host = this.host.nativeElement;
|
|
656
|
+
for (const entry of this.plotted()) {
|
|
657
|
+
const id = entry.series.id;
|
|
658
|
+
const marker = host.querySelector(`.travel-marker[data-series-id="${CSS.escape(id)}"]`);
|
|
659
|
+
const state = this.travel.get(id);
|
|
660
|
+
const target = entry.series.hidden
|
|
661
|
+
? undefined
|
|
662
|
+
: entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
663
|
+
if (!marker || !target) {
|
|
664
|
+
state?.cancel();
|
|
665
|
+
this.travel.delete(id);
|
|
666
|
+
marker?.classList.remove('is-shown');
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
if (state &&
|
|
670
|
+
state.categoryIndex === categoryIndex &&
|
|
671
|
+
state.toX === target.x &&
|
|
672
|
+
state.toY === target.y) {
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
state?.cancel();
|
|
676
|
+
const next = {
|
|
677
|
+
categoryIndex,
|
|
678
|
+
toX: target.x,
|
|
679
|
+
toY: target.y,
|
|
680
|
+
x: target.x,
|
|
681
|
+
y: target.y,
|
|
682
|
+
cancel: () => undefined,
|
|
683
|
+
};
|
|
684
|
+
const place = (x, y) => {
|
|
685
|
+
next.x = x;
|
|
686
|
+
next.y = y;
|
|
687
|
+
// `transform`, not `cx`: a geometry change re-lays out the SVG and repaints the whole page each frame.
|
|
688
|
+
marker.style.transform = `translate(${x}px, ${y}px)`;
|
|
689
|
+
};
|
|
690
|
+
this.travel.set(id, next);
|
|
691
|
+
if (!state || !marker.classList.contains('is-shown')) {
|
|
692
|
+
place(target.x, target.y);
|
|
693
|
+
marker.classList.add('is-shown');
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
next.x = state.x;
|
|
697
|
+
next.y = state.y;
|
|
698
|
+
const line = state.categoryIndex === categoryIndex
|
|
507
699
|
? null
|
|
508
|
-
: {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
700
|
+
: lineThrough(host.querySelectorAll(`.series-line[data-series-id="${CSS.escape(id)}"]:not(.mark-leave)`), state.x, target.x);
|
|
701
|
+
if (line) {
|
|
702
|
+
next.cancel = tweenMarks(marker, [lengthAt(line, state.x, state.y)], [lengthAt(line, target.x, target.y)], ([length]) => {
|
|
703
|
+
const point = pointAtLength(line, length);
|
|
704
|
+
place(point.x, point.y);
|
|
705
|
+
}, 'tooltip-move', () => place(target.x, target.y));
|
|
706
|
+
}
|
|
707
|
+
else {
|
|
708
|
+
next.cancel = tweenMarks(marker, [state.x, state.y], [target.x, target.y], ([x, y]) => place(x, y), state.categoryIndex === categoryIndex ? 'mark' : 'tooltip-move');
|
|
709
|
+
}
|
|
517
710
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
711
|
+
}
|
|
712
|
+
// Where each series' points are drawn, by category key; a morph starts from here.
|
|
713
|
+
drawnPoints = new Map();
|
|
714
|
+
drawnKeys = [];
|
|
715
|
+
// Where each series' area meets its axis, in view units.
|
|
716
|
+
drawnBaselines = new Map();
|
|
717
|
+
stopMorph = () => undefined;
|
|
718
|
+
morphing = false;
|
|
719
|
+
// CSS cannot interpolate a `d` whose point count changed, so when a category comes or goes the line
|
|
720
|
+
// morphs here, over the union of both point sets: a new point leaves its neighbour, a removed one
|
|
721
|
+
// merges into its neighbour. The markers ride the same values, so they stay on the line.
|
|
722
|
+
morphOnCategoryChange(plotted) {
|
|
723
|
+
const keys = categoryKeys(this.scales.categories());
|
|
724
|
+
const previousKeys = this.drawnKeys;
|
|
725
|
+
const previous = this.drawnPoints;
|
|
726
|
+
const targets = new Map(plotted.map((entry) => [
|
|
727
|
+
entry.series.id,
|
|
728
|
+
new Map(entry.markers.map((marker) => [
|
|
729
|
+
marker.categoryKey,
|
|
730
|
+
{ x: marker.x, y: marker.y },
|
|
731
|
+
])),
|
|
732
|
+
]));
|
|
733
|
+
const targetBaselines = new Map(plotted.map((entry) => [entry.series.id, this.baselineOf(entry.series)]));
|
|
734
|
+
const previousBaselines = this.drawnBaselines;
|
|
735
|
+
this.drawnKeys = keys;
|
|
736
|
+
const sameCategories = previousKeys.length === keys.length &&
|
|
737
|
+
keys.every((key, index) => key === previousKeys[index]);
|
|
738
|
+
// A value change belongs to the CSS transitions, unless it lands during a morph, which then
|
|
739
|
+
// retargets from where the points are.
|
|
740
|
+
if (previousKeys.length === 0 || (sameCategories && !this.morphing)) {
|
|
741
|
+
this.drawnPoints = targets;
|
|
742
|
+
this.drawnBaselines = targetBaselines;
|
|
743
|
+
return;
|
|
533
744
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
.filter((
|
|
539
|
-
.map((
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
|
|
745
|
+
this.stopMorph();
|
|
746
|
+
const merged = mergedKeys(previousKeys, keys);
|
|
747
|
+
const host = this.host.nativeElement;
|
|
748
|
+
const plans = plotted
|
|
749
|
+
.filter((entry) => entry.linePaths.length === 1 && previous.has(entry.series.id))
|
|
750
|
+
.map((entry) => {
|
|
751
|
+
const id = entry.series.id;
|
|
752
|
+
const from = previous.get(id) ?? new Map();
|
|
753
|
+
const to = targets.get(id) ?? new Map();
|
|
754
|
+
const order = merged.filter((key) => from.has(key) || to.has(key));
|
|
755
|
+
const near = (key, within) => {
|
|
756
|
+
const at = order.indexOf(key);
|
|
757
|
+
const found = order
|
|
758
|
+
.slice(0, at)
|
|
759
|
+
.reverse()
|
|
760
|
+
.find((candidate) => within.has(candidate)) ??
|
|
761
|
+
order.slice(at + 1).find((candidate) => within.has(candidate));
|
|
762
|
+
return found === undefined ? undefined : within.get(found);
|
|
763
|
+
};
|
|
764
|
+
const escaped = CSS.escape(id);
|
|
765
|
+
const baseline = targetBaselines.get(id) ?? 0;
|
|
766
|
+
// A band over `lower` has a second edge of its own; it keeps to the CSS transitions.
|
|
767
|
+
const fillsToBaseline = !!entry.series.area &&
|
|
768
|
+
!entry.series.lower &&
|
|
769
|
+
entry.areaPaths.length === 1;
|
|
770
|
+
return {
|
|
771
|
+
id,
|
|
772
|
+
order,
|
|
773
|
+
starts: order.map((key) => from.get(key) ?? near(key, from) ?? to.get(key)),
|
|
774
|
+
ends: order.map((key) => to.get(key) ?? near(key, to) ?? from.get(key)),
|
|
775
|
+
baselineFrom: previousBaselines.get(id) ?? baseline,
|
|
776
|
+
baselineTo: baseline,
|
|
777
|
+
paths: [
|
|
778
|
+
...host.querySelectorAll(`.series-line[data-series-id="${escaped}"]:not(.mark-leave), .series-halo[data-series-id="${escaped}"]`),
|
|
779
|
+
],
|
|
780
|
+
areas: fillsToBaseline
|
|
781
|
+
? [
|
|
782
|
+
...host.querySelectorAll(`.series-area[data-series-id="${escaped}"]:not(.mark-leave)`),
|
|
783
|
+
]
|
|
784
|
+
: [],
|
|
785
|
+
// A removed point is still in the DOM while it fades, and slides into its neighbour meanwhile.
|
|
786
|
+
markers: order.map((key) => host.querySelector(`.series-marker[data-point-key="${CSS.escape(id + '-' + key)}"]`)),
|
|
787
|
+
leaving: order.map((key) => !to.has(key)),
|
|
788
|
+
};
|
|
543
789
|
});
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
tooltipPinned = computed(() => (this.activeTooltip()?.pinned?.() ?? false) || this.cursorPinned(), ...(ngDevMode ? [{ debugName: "tooltipPinned" }] : /* istanbul ignore next */ []));
|
|
549
|
-
/** Compared by value: a mark that reports and reads `yPosition()` in one effect would otherwise loop forever. */
|
|
550
|
-
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 });
|
|
551
|
-
// Counts values, not reporters: a line series registers both axes, so an empty one would raise a second axis.
|
|
552
|
-
hasSecondaryAxis = computed(() => this.valuesOn('secondary').some((values) => values.length > 0), ...(ngDevMode ? [{ debugName: "hasSecondaryAxis" }] : /* istanbul ignore next */ []));
|
|
553
|
-
secondary = computed(() => secondaryAxis(this.ticks().map((tick) => tick.value), this.valuesOn('secondary'), this.tickCount(), this.secondaryAxisMode(), this.maxSecondary()), { ...(ngDevMode ? { debugName: "secondary" } : /* istanbul ignore next */ {}), equal: (a, b) => a.aligned === b.aligned &&
|
|
554
|
-
a.domain.min === b.domain.min &&
|
|
555
|
-
a.domain.max === b.domain.max &&
|
|
556
|
-
a.ticks.length === b.ticks.length &&
|
|
557
|
-
a.ticks.every((tick, index) => tick === b.ticks[index]) });
|
|
558
|
-
secondaryYPosition = computed(() => {
|
|
559
|
-
if (!this.hasSecondaryAxis()) {
|
|
560
|
-
return this.yPosition();
|
|
790
|
+
this.drawnPoints = targets;
|
|
791
|
+
this.drawnBaselines = targetBaselines;
|
|
792
|
+
if (plans.length === 0) {
|
|
793
|
+
return;
|
|
561
794
|
}
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
795
|
+
const flat = (points, baseline) => [
|
|
796
|
+
...points.flatMap((point) => [point?.x ?? 0, point?.y ?? 0]),
|
|
797
|
+
baseline,
|
|
798
|
+
];
|
|
799
|
+
const from = plans.flatMap((plan) => flat(plan.starts, plan.baselineFrom));
|
|
800
|
+
const to = plans.flatMap((plan) => flat(plan.ends, plan.baselineTo));
|
|
801
|
+
const leavingMarkers = plans.flatMap((plan) => plan.markers.filter((marker, index) => !!marker && plan.leaving[index]));
|
|
802
|
+
// A leaving marker keeps where it slid to until it is gone.
|
|
803
|
+
const styled = plans.flatMap((plan) => [
|
|
804
|
+
...plan.paths,
|
|
805
|
+
...plan.areas,
|
|
806
|
+
...plan.markers.filter((marker, index) => !!marker && !plan.leaving[index]),
|
|
807
|
+
]);
|
|
808
|
+
const curve = this.curve();
|
|
809
|
+
const live = new Map(targets);
|
|
810
|
+
const liveBaselines = new Map(targetBaselines);
|
|
811
|
+
const apply = (values) => {
|
|
812
|
+
let offset = 0;
|
|
813
|
+
for (const plan of plans) {
|
|
814
|
+
const points = plan.order.map((_, index) => ({
|
|
815
|
+
categoryIndex: index,
|
|
816
|
+
value: 0,
|
|
817
|
+
x: values[offset + 2 * index],
|
|
818
|
+
y: values[offset + 2 * index + 1],
|
|
819
|
+
}));
|
|
820
|
+
const baseline = values[offset + 2 * plan.order.length];
|
|
821
|
+
offset += 2 * plan.order.length + 1;
|
|
822
|
+
const path = `path("${linePath(points, curve)}")`;
|
|
823
|
+
for (const element of plan.paths) {
|
|
824
|
+
element.style.setProperty('d', path);
|
|
825
|
+
}
|
|
826
|
+
const area = `path("${areaPath(points, baseline, curve)}")`;
|
|
827
|
+
for (const element of plan.areas) {
|
|
828
|
+
element.style.setProperty('d', area);
|
|
829
|
+
}
|
|
830
|
+
plan.markers.forEach((marker, index) => {
|
|
831
|
+
marker?.style.setProperty('cx', `${points[index].x}px`);
|
|
832
|
+
marker?.style.setProperty('cy', `${points[index].y}px`);
|
|
833
|
+
});
|
|
834
|
+
live.set(plan.id, new Map(plan.order.map((key, index) => [key, points[index]])));
|
|
835
|
+
liveBaselines.set(plan.id, baseline);
|
|
836
|
+
}
|
|
837
|
+
this.drawnPoints = live;
|
|
838
|
+
this.drawnBaselines = liveBaselines;
|
|
839
|
+
};
|
|
840
|
+
const release = () => {
|
|
841
|
+
for (const element of styled) {
|
|
842
|
+
element.style.removeProperty('d');
|
|
843
|
+
element.style.removeProperty('cx');
|
|
844
|
+
element.style.removeProperty('cy');
|
|
845
|
+
element.style.removeProperty('transition');
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
for (const element of [...styled, ...leavingMarkers]) {
|
|
849
|
+
element.style.setProperty('transition', 'none');
|
|
850
|
+
}
|
|
851
|
+
apply(from);
|
|
852
|
+
let cancel = () => undefined;
|
|
853
|
+
this.morphing = true;
|
|
854
|
+
this.stopMorph = () => {
|
|
855
|
+
cancel();
|
|
856
|
+
release();
|
|
857
|
+
this.morphing = false;
|
|
858
|
+
};
|
|
859
|
+
cancel = tweenMarks(host, from, to, apply, 'mark', () => {
|
|
860
|
+
release();
|
|
861
|
+
this.drawnPoints = targets;
|
|
862
|
+
this.drawnBaselines = targetBaselines;
|
|
863
|
+
this.morphing = false;
|
|
864
|
+
this.stopMorph = () => undefined;
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
baselineOf(series) {
|
|
868
|
+
const toY = (series.axis ?? 'primary') === 'secondary'
|
|
869
|
+
? this.scales.secondaryYPosition()
|
|
870
|
+
: this.scales.yPosition();
|
|
871
|
+
return toY(0);
|
|
872
|
+
}
|
|
873
|
+
hoveredSeries = computed(() => this.allMarkers()[this.activeMark.index()]?.seriesId ?? null, ...(ngDevMode ? [{ debugName: "hoveredSeries" }] : /* istanbul ignore next */ []));
|
|
874
|
+
/** One rule for the legend and the markers: the series either singles out draws bold, and under
|
|
875
|
+
* `dimOthers` the others fade. */
|
|
876
|
+
spotlight = computed(() => this.highlighted() ?? this.hoveredSeries(), ...(ngDevMode ? [{ debugName: "spotlight" }] : /* istanbul ignore next */ []));
|
|
877
|
+
isSpotlit(seriesId) {
|
|
878
|
+
return this.visibleCount() > 1 && this.spotlight() === seriesId;
|
|
879
|
+
}
|
|
880
|
+
locale = injectDsLocale();
|
|
881
|
+
changes = computed(() => {
|
|
882
|
+
if (!this.showChange()) {
|
|
567
883
|
return [];
|
|
568
884
|
}
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
showSecondaryGridlines = computed(() => this.hasSecondaryAxis() &&
|
|
579
|
-
(this.stacked() || !this.secondary().aligned) &&
|
|
580
|
-
this.secondaryTicks().length > 1, ...(ngDevMode ? [{ debugName: "showSecondaryGridlines" }] : /* istanbul ignore next */ []));
|
|
581
|
-
secondaryLabelX = computed(() => this.stacked()
|
|
582
|
-
? this.plot().left - CHART_AXIS_LABEL_GAP
|
|
583
|
-
: this.plot().left + this.plot().width + CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "secondaryLabelX" }] : /* istanbul ignore next */ []));
|
|
584
|
-
secondaryLabelAnchor = computed(() => this.stacked() ? 'end' : 'start', ...(ngDevMode ? [{ debugName: "secondaryLabelAnchor" }] : /* istanbul ignore next */ []));
|
|
585
|
-
secondaryPlotBottom = computed(() => this.secondaryPlot().top + this.secondaryPlot().height, ...(ngDevMode ? [{ debugName: "secondaryPlotBottom" }] : /* istanbul ignore next */ []));
|
|
586
|
-
/** No tint on a single-scale plot. */
|
|
587
|
-
axisLabelFill = computed(() => this.hasSecondaryAxis() ? this.axisColor() : null, ...(ngDevMode ? [{ debugName: "axisLabelFill" }] : /* istanbul ignore next */ []));
|
|
588
|
-
secondaryAxisLabelFill = computed(() => this.secondaryAxisColor(), ...(ngDevMode ? [{ debugName: "secondaryAxisLabelFill" }] : /* istanbul ignore next */ []));
|
|
589
|
-
bands = computed(() => bandScale(this.categories().length, this.plot().width, CHART_BAND_PADDING), ...(ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []));
|
|
590
|
-
bandWidth = computed(() => this.bands().bandWidth, ...(ngDevMode ? [{ debugName: "bandWidth" }] : /* istanbul ignore next */ []));
|
|
591
|
-
xPosition = computed(() => {
|
|
592
|
-
const plot = this.plot();
|
|
593
|
-
const bands = this.bands();
|
|
594
|
-
return (index) => plot.left + bands.position(index) + bands.bandWidth / 2;
|
|
595
|
-
}, ...(ngDevMode ? [{ debugName: "xPosition" }] : /* istanbul ignore next */ []));
|
|
596
|
-
yPosition = computed(() => {
|
|
597
|
-
const plot = this.plot();
|
|
598
|
-
return valueScale(this.domain(), plot.top, plot.height);
|
|
599
|
-
}, ...(ngDevMode ? [{ debugName: "yPosition" }] : /* istanbul ignore next */ []));
|
|
600
|
-
zeroOffset = computed(() => this.yPosition()(0), ...(ngDevMode ? [{ debugName: "zeroOffset" }] : /* istanbul ignore next */ []));
|
|
601
|
-
bandAt(index) {
|
|
602
|
-
if (this.cursorResolved() !== 'category' || index < 0) {
|
|
603
|
-
return null;
|
|
885
|
+
const categoryIndex = this.scales.cursorOn?.()
|
|
886
|
+
? this.scales.activeIndex()
|
|
887
|
+
: (this.allMarkers()[this.activeMark.index()]?.categoryIndex ?? -1);
|
|
888
|
+
const visible = this.plotted().filter((entry) => !entry.series.hidden);
|
|
889
|
+
const seriesId = visible.length === 1 ? visible[0].series.id : this.spotlight();
|
|
890
|
+
const markers = visible.find((entry) => entry.series.id === seriesId)?.markers ?? [];
|
|
891
|
+
const current = markers.find((marker) => marker.categoryIndex === categoryIndex);
|
|
892
|
+
if (!current) {
|
|
893
|
+
return [];
|
|
604
894
|
}
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
/** The same state machine the element marks run on; here the index counts categories. */
|
|
619
|
-
cursorState = chartActiveMark(() => this.defaults.tooltipLingerMs(), () => this.hoverDelayMs());
|
|
620
|
-
activeIndex = this.cursorState.index;
|
|
621
|
-
pointerAt = signal(null, ...(ngDevMode ? [{ debugName: "pointerAt" }] : /* istanbul ignore next */ []));
|
|
622
|
-
// Set at once, not after the hover delay.
|
|
623
|
-
pointerInBand = signal(false, ...(ngDevMode ? [{ debugName: "pointerInBand" }] : /* istanbul ignore next */ []));
|
|
624
|
-
hoveredCategory = signal(-1, ...(ngDevMode ? [{ debugName: "hoveredCategory" }] : /* istanbul ignore next */ []));
|
|
625
|
-
/** Under the panel: it opens over the tallest reading, so the disc sits at that reading's head -
|
|
626
|
-
* inside a column, below a marker, and over a column too short to hold it. */
|
|
627
|
-
bandPinY = computed(() => {
|
|
628
|
-
const band = this.cursorBand();
|
|
629
|
-
const inset = CHART_PIN_RADIUS + CHART_PIN_GAP;
|
|
630
|
-
const origin = this.tooltipOrigin();
|
|
631
|
-
const canvas = this.canvasElement()?.nativeElement;
|
|
632
|
-
if (!band || !canvas || !(origin instanceof Element)) {
|
|
633
|
-
return (band?.top ?? 0) + inset;
|
|
634
|
-
}
|
|
635
|
-
const frame = canvas.getBoundingClientRect();
|
|
636
|
-
const scale = frame.height > 0 ? this.viewHeight() / frame.height : 1;
|
|
637
|
-
const head = origin.getBoundingClientRect();
|
|
638
|
-
const top = (head.top - frame.top) * scale;
|
|
639
|
-
const height = head.height * scale;
|
|
640
|
-
if (height >= 2 * inset) {
|
|
641
|
-
return top + inset;
|
|
642
|
-
}
|
|
643
|
-
if (!origin.matches('.bar')) {
|
|
644
|
-
return top + height + inset;
|
|
645
|
-
}
|
|
646
|
-
const value = origin.parentElement?.querySelector(':scope > .value');
|
|
647
|
-
const valueTop = value
|
|
648
|
-
? (value.getBoundingClientRect().top - frame.top) * scale
|
|
649
|
-
: top;
|
|
650
|
-
return Math.min(top, valueTop) - inset;
|
|
651
|
-
}, ...(ngDevMode ? [{ debugName: "bandPinY" }] : /* istanbul ignore next */ []));
|
|
652
|
-
/** How far a held pin sits above the panel's anchor; the panel rises by as much to stay over it. */
|
|
653
|
-
pinRise = signal(0, ...(ngDevMode ? [{ debugName: "pinRise" }] : /* istanbul ignore next */ []));
|
|
654
|
-
tooltipGap = computed(() => Math.max(this.tooltipExtraGap(), this.pinRise()), ...(ngDevMode ? [{ debugName: "tooltipGap" }] : /* istanbul ignore next */ []));
|
|
655
|
-
bandPins = computed(() => this.pinOnClickResolved() && this.pointerInBand(), ...(ngDevMode ? [{ debugName: "bandPins" }] : /* istanbul ignore next */ []));
|
|
656
|
-
cursorPointer = computed(() => this.activeIndex() < 0 ? null : this.pointerAt(), ...(ngDevMode ? [{ debugName: "cursorPointer" }] : /* istanbul ignore next */ []));
|
|
657
|
-
/** Whether the cursor is held. */
|
|
658
|
-
cursorPinned = this.cursorState.pinned;
|
|
659
|
-
drawsUnpin = !inject(CHART_UNPIN_DRAWN_BY_HOST, {
|
|
660
|
-
optional: true,
|
|
661
|
-
});
|
|
662
|
-
releaseCursor() {
|
|
663
|
-
this.cursorState.release();
|
|
664
|
-
}
|
|
665
|
-
canvasElement = viewChild('canvasEl', ...(ngDevMode ? [{ debugName: "canvasElement" }] : /* istanbul ignore next */ []));
|
|
666
|
-
// Read once per hover and dropped on scroll: reading on every move forces a second layout after the band update.
|
|
667
|
-
canvasRect = null;
|
|
668
|
-
plotPointer(event, canvas) {
|
|
669
|
-
this.canvasRect ??= canvas.getBoundingClientRect();
|
|
670
|
-
const plot = this.plot();
|
|
671
|
-
// Client x to view units: the canvas is scaled to its box.
|
|
672
|
-
const viewX = ((event.clientX - this.canvasRect.left) / this.canvasRect.width) *
|
|
673
|
-
this.viewWidth();
|
|
674
|
-
// Every point belongs to its nearest category, so the cursor never passes through "none".
|
|
675
|
-
const index = this.clampIndex(categoryAt(viewX, plot.left, plot.width, this.categories().length));
|
|
676
|
-
this.pointerAt.set({ x: event.clientX, y: event.clientY });
|
|
677
|
-
this.pointerInBand.set(index >= 0);
|
|
678
|
-
this.hoveredCategory.set(index);
|
|
679
|
-
if (index < 0) {
|
|
680
|
-
if (event.type === 'pointerdown' && this.cursorPinned()) {
|
|
681
|
-
this.cursorState.release();
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
this.cursorState.leave();
|
|
685
|
-
}
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
if (event.type === 'pointerdown' && this.pinOnClickResolved()) {
|
|
689
|
-
this.cursorState.pin(index, event);
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
this.cursorState.enter(index, event);
|
|
693
|
-
}
|
|
694
|
-
/** Listens only when a category cursor is drawn, outside the zone. */
|
|
695
|
-
listenForCursor(canvas) {
|
|
696
|
-
const forgetRect = () => {
|
|
697
|
-
this.canvasRect = null;
|
|
698
|
-
};
|
|
699
|
-
const onPointer = (event) => this.plotPointer(event, canvas);
|
|
700
|
-
const onEnter = () => window.addEventListener('scroll', forgetRect, {
|
|
701
|
-
capture: true,
|
|
702
|
-
passive: true,
|
|
703
|
-
});
|
|
704
|
-
const onLeave = () => {
|
|
705
|
-
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
706
|
-
forgetRect();
|
|
707
|
-
this.pointerInBand.set(false);
|
|
708
|
-
this.hoveredCategory.set(-1);
|
|
709
|
-
// The panel goes back to the band the keyboard holds, which keeps it open while focus stays.
|
|
710
|
-
if (this.keyboardFocusInside()) {
|
|
711
|
-
this.cursorState.setIndex(this.focusedCategory());
|
|
712
|
-
}
|
|
713
|
-
else {
|
|
714
|
-
this.cursorState.leave();
|
|
895
|
+
const stretches = [
|
|
896
|
+
[
|
|
897
|
+
markers.find((marker) => marker.categoryIndex === categoryIndex - 1),
|
|
898
|
+
current,
|
|
899
|
+
],
|
|
900
|
+
[
|
|
901
|
+
current,
|
|
902
|
+
markers.find((marker) => marker.categoryIndex === categoryIndex + 1),
|
|
903
|
+
],
|
|
904
|
+
];
|
|
905
|
+
return stretches.flatMap(([from, to]) => {
|
|
906
|
+
if (!from || !to) {
|
|
907
|
+
return [];
|
|
715
908
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
909
|
+
return [
|
|
910
|
+
{
|
|
911
|
+
key: `${current.seriesId}-${from.categoryIndex}`,
|
|
912
|
+
path: linePath([from, to], this.curve()),
|
|
913
|
+
...changeBetween(from.value, to.value, this.locale),
|
|
914
|
+
x: (from.x + to.x) / 2,
|
|
915
|
+
y: Math.min(from.y, to.y) - CHANGE_LABEL_GAP,
|
|
916
|
+
},
|
|
917
|
+
];
|
|
722
918
|
});
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
bandElement = viewChild('cursorBandEl', ...(ngDevMode ? [{ debugName: "bandElement" }] : /* istanbul ignore next */ []));
|
|
733
|
-
cursorOrigin = computed(() => this.cursorBand() ? (this.bandElement()?.nativeElement ?? null) : null, ...(ngDevMode ? [{ debugName: "cursorOrigin" }] : /* istanbul ignore next */ []));
|
|
734
|
-
keyboardStops = computed(() => this.cursorOn() && this.interactive(), ...(ngDevMode ? [{ debugName: "keyboardStops" }] : /* istanbul ignore next */ []));
|
|
735
|
-
roving = signal(0, ...(ngDevMode ? [{ debugName: "roving" }] : /* istanbul ignore next */ []));
|
|
736
|
-
refocusStop = false;
|
|
737
|
-
focusedCategory = computed(() => Math.min(this.roving(), Math.max(0, this.categories().length - 1)), ...(ngDevMode ? [{ debugName: "focusedCategory" }] : /* istanbul ignore next */ []));
|
|
738
|
-
categoryStops = computed(() => {
|
|
739
|
-
const toX = this.xPosition();
|
|
740
|
-
const width = this.bandWidth();
|
|
741
|
-
return this.categories().map((category, index) => ({
|
|
742
|
-
index,
|
|
743
|
-
category,
|
|
744
|
-
x: toX(index) - width / 2,
|
|
745
|
-
width,
|
|
746
|
-
}));
|
|
747
|
-
}, ...(ngDevMode ? [{ debugName: "categoryStops" }] : /* istanbul ignore next */ []));
|
|
748
|
-
// Only the active category's readings are known; a stop is named once the cursor is on it, which focusing it does first.
|
|
749
|
-
stopLabel(index) {
|
|
750
|
-
const category = this.categories()[index] ?? '';
|
|
751
|
-
const context = this.activeIndex() === index ? this.categoryContext() : null;
|
|
752
|
-
const readings = context?.entries.map((entry) => `${entry.label} ${entry.formatted ?? entry.value}`) ?? [];
|
|
753
|
-
return readings.length ? `${category}: ${readings.join(', ')}` : category;
|
|
754
|
-
}
|
|
755
|
-
onStopFocus(index, event) {
|
|
756
|
-
this.roving.set(index);
|
|
757
|
-
this.pickedKey.set(null);
|
|
758
|
-
this.cursorState.enter(index, event, null, event.target);
|
|
759
|
-
}
|
|
760
|
-
leavesChart(event) {
|
|
761
|
-
const next = event.relatedTarget;
|
|
762
|
-
return (!(next instanceof Element) || !this.host.nativeElement.contains(next));
|
|
763
|
-
}
|
|
764
|
-
onStopBlur(event) {
|
|
765
|
-
if (this.leavesChart(event)) {
|
|
766
|
-
this.cursorState.leave();
|
|
919
|
+
}, ...(ngDevMode ? [{ debugName: "changes" }] : /* istanbul ignore next */ []));
|
|
920
|
+
pinnedMarkers = this.activeMark.pinnedAt((index) => this.allMarkers()[index]);
|
|
921
|
+
pinLift = CHART_PIN_RADIUS + CHART_PIN_GAP + PIN_MARKER_CLEARANCE;
|
|
922
|
+
onMarkerOver(event) {
|
|
923
|
+
const hit = markOf(event);
|
|
924
|
+
if (hit && !this.scales.cursorOn?.()) {
|
|
925
|
+
this.activeMark.enter(hit.index, event, undefined, hit.element);
|
|
767
926
|
}
|
|
768
927
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
928
|
+
onMarkerOut(event) {
|
|
929
|
+
const hit = markOf(event);
|
|
930
|
+
if (!hit || this.scales.cursorOn?.()) {
|
|
931
|
+
return;
|
|
772
932
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
// Moving to another band lets a pin go; returning to the held band keeps it.
|
|
776
|
-
focusStop(index) {
|
|
777
|
-
this.roving.set(index);
|
|
778
|
-
this.host.nativeElement
|
|
779
|
-
.querySelector(`.category-stop[data-category-index="${index}"]`)
|
|
780
|
-
?.focus();
|
|
781
|
-
if (this.cursorPinned() && this.activeIndex() !== index) {
|
|
782
|
-
this.cursorState.release();
|
|
933
|
+
if (leftMark(event, hit)) {
|
|
934
|
+
this.activeMark.leave();
|
|
783
935
|
}
|
|
784
|
-
this.cursorState.setIndex(index);
|
|
785
936
|
}
|
|
786
|
-
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
this.
|
|
791
|
-
|
|
937
|
+
onMarkerFocus(event, hit) {
|
|
938
|
+
const marker = this.allMarkers()[hit.index];
|
|
939
|
+
if (marker) {
|
|
940
|
+
this.rovingBySeries.update((roving) => new Map(roving).set(marker.seriesId, hit.index));
|
|
941
|
+
this.focusedSeries.set(marker.seriesId);
|
|
942
|
+
this.scales.setActiveIndex(marker.categoryIndex);
|
|
943
|
+
}
|
|
944
|
+
this.activeMark.enter(hit.index, event, undefined, hit.element);
|
|
792
945
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
if (!this.isBrowser) {
|
|
946
|
+
onMarkerKey(event) {
|
|
947
|
+
const hit = markOf(event);
|
|
948
|
+
if (!hit) {
|
|
797
949
|
return;
|
|
798
950
|
}
|
|
799
|
-
|
|
800
|
-
const onKey = (event) => {
|
|
801
|
-
const target = event.target;
|
|
802
|
-
if (event.key !== 'Escape' ||
|
|
803
|
-
!this.keyboardStops() ||
|
|
804
|
-
!this.cursorPinned() ||
|
|
805
|
-
!(target instanceof Element) ||
|
|
806
|
-
!this.host.nativeElement.contains(target) ||
|
|
807
|
-
target.closest('.category-stop') !== null ||
|
|
808
|
-
target.closest('[data-mark-index]') === null) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
event.stopImmediatePropagation();
|
|
951
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
812
952
|
event.preventDefault();
|
|
813
|
-
this.
|
|
814
|
-
this.focusStop(this.focusedCategory());
|
|
815
|
-
};
|
|
816
|
-
document.addEventListener('keydown', onKey, true);
|
|
817
|
-
inject(DestroyRef).onDestroy(() => document.removeEventListener('keydown', onKey, true));
|
|
818
|
-
}
|
|
819
|
-
// Held by the canvas, as a pointer pin is: a press on the band then releases it instead of re-pinning.
|
|
820
|
-
pinFromKeyboard(index, event) {
|
|
821
|
-
const canvas = this.canvasElement()?.nativeElement;
|
|
822
|
-
this.cursorState.pin(index, event, null, canvas);
|
|
823
|
-
}
|
|
824
|
-
readingsTopDown() {
|
|
825
|
-
return ([...this.tooltipSources()]
|
|
826
|
-
.flatMap(([sourceId, source]) => {
|
|
827
|
-
const elements = source.axisPointElements?.() ?? [];
|
|
828
|
-
return (source.axisEntries?.() ?? []).map((entry, index) => ({
|
|
829
|
-
key: `${sourceId}:${index}`,
|
|
830
|
-
entry,
|
|
831
|
-
element: elements[index] ?? null,
|
|
832
|
-
}));
|
|
833
|
-
})
|
|
834
|
-
// A mark without `interactive` has no tabindex and would swallow the focus call.
|
|
835
|
-
.filter((reading) => reading.element?.hasAttribute('tabindex') ?? false)
|
|
836
|
-
.sort((a, b) => (a.entry.y ?? 0) - (b.entry.y ?? 0)));
|
|
837
|
-
}
|
|
838
|
-
onChartKey(event) {
|
|
839
|
-
if (!this.keyboardStops() || !(event.target instanceof Element)) {
|
|
953
|
+
this.selectMarker(hit.index);
|
|
840
954
|
return;
|
|
841
955
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
if (!onStop && !fromMarker) {
|
|
956
|
+
// The category cursor's `ds-chart` owns the other keys.
|
|
957
|
+
if (this.scales.cursorOn?.()) {
|
|
845
958
|
return;
|
|
846
959
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
this.cursorState.release();
|
|
853
|
-
}
|
|
854
|
-
this.cursorState.setIndex(this.focusedCategory());
|
|
855
|
-
const readings = this.readingsTopDown();
|
|
856
|
-
if (readings.length === 0) {
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
const at = readings.findIndex((reading) => reading.key === this.pickedKey());
|
|
860
|
-
const step = event.key === 'ArrowDown' ? 1 : readings.length - 1;
|
|
861
|
-
const next = at < 0
|
|
862
|
-
? event.key === 'ArrowDown'
|
|
863
|
-
? 0
|
|
864
|
-
: readings.length - 1
|
|
865
|
-
: (at + step) % readings.length;
|
|
866
|
-
this.pickedKey.set(readings[next].key);
|
|
867
|
-
readings[next].element.focus();
|
|
960
|
+
const marker = this.allMarkers()[hit.index];
|
|
961
|
+
const strand = this.allMarkers().filter((candidate) => candidate.seriesId === marker?.seriesId);
|
|
962
|
+
const current = strand.findIndex((candidate) => candidate.markIndex === hit.index);
|
|
963
|
+
const next = nextRovingIndex(event.key, current, strand.length);
|
|
964
|
+
if (next === null) {
|
|
868
965
|
return;
|
|
869
966
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
967
|
+
event.preventDefault();
|
|
968
|
+
focusMark(hit.element.closest('.lines'), strand[next].markIndex);
|
|
969
|
+
}
|
|
970
|
+
isDimmed(seriesId) {
|
|
971
|
+
return dimmedBy(this.dimOthers(), this.spotlight(), seriesId);
|
|
972
|
+
}
|
|
973
|
+
onMarkerClick(event) {
|
|
974
|
+
const hit = markOf(event);
|
|
975
|
+
if (!hit) {
|
|
876
976
|
return;
|
|
877
977
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
: nextRovingIndex(event.key, this.focusedCategory(), this.categories().length);
|
|
881
|
-
if (next !== null) {
|
|
882
|
-
event.preventDefault();
|
|
883
|
-
this.focusStop(next);
|
|
978
|
+
if (this.pins()) {
|
|
979
|
+
this.activeMark.pin(hit.index, event, '.series-marker', hit.element);
|
|
884
980
|
}
|
|
981
|
+
this.selectMarker(hit.index);
|
|
885
982
|
}
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
983
|
+
selectMarker(markIndex) {
|
|
984
|
+
const marker = this.allMarkers()[markIndex];
|
|
985
|
+
const series = this.data().find((entry) => entry.id === marker?.seriesId);
|
|
986
|
+
if (marker && series) {
|
|
987
|
+
this.pointClicked.emit({
|
|
988
|
+
series,
|
|
989
|
+
categoryIndex: marker.categoryIndex,
|
|
990
|
+
value: marker.value,
|
|
991
|
+
});
|
|
895
992
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
993
|
+
}
|
|
994
|
+
markerLabel(marker) {
|
|
995
|
+
return `${marker.seriesLabel}, ${marker.category}, ${marker.formattedValue}`;
|
|
996
|
+
}
|
|
997
|
+
/** What this series reads at the cursor's category, whatever `tooltip` says; feeds the category panel. */
|
|
998
|
+
axisEntries = computed(() => this.readingsAtCursor().map(({ reading }) => reading), ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
999
|
+
readingsAtCursor = computed(() => {
|
|
1000
|
+
const categoryIndex = this.scales.activeIndex();
|
|
1001
|
+
if (categoryIndex < 0) {
|
|
1002
|
+
return [];
|
|
1003
|
+
}
|
|
1004
|
+
return this.plotted().flatMap((entry) => {
|
|
1005
|
+
const marker = entry.series.hidden
|
|
1006
|
+
? undefined
|
|
1007
|
+
: entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
1008
|
+
return marker
|
|
1009
|
+
? [
|
|
1010
|
+
{
|
|
1011
|
+
seriesId: entry.series.id,
|
|
1012
|
+
markIndex: marker.markIndex,
|
|
1013
|
+
reading: {
|
|
1014
|
+
label: marker.seriesLabel,
|
|
1015
|
+
value: marker.value,
|
|
1016
|
+
formatted: marker.formattedValue,
|
|
1017
|
+
color: marker.color,
|
|
1018
|
+
y: marker.y,
|
|
1019
|
+
axis: entry.series.axis ?? 'primary',
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
]
|
|
1023
|
+
: [];
|
|
1024
|
+
});
|
|
1025
|
+
}, ...(ngDevMode ? [{ debugName: "readingsAtCursor" }] : /* istanbul ignore next */ []));
|
|
1026
|
+
tooltipContext = computed(() => {
|
|
1027
|
+
if (this.tooltip() === 'none') {
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
if (this.tooltip() === 'axis') {
|
|
1031
|
+
return this.axisTooltipContext();
|
|
1032
|
+
}
|
|
1033
|
+
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1034
|
+
if (!marker || marker.hidden) {
|
|
1035
|
+
return null;
|
|
1036
|
+
}
|
|
1037
|
+
return {
|
|
1038
|
+
category: marker.category,
|
|
1039
|
+
entries: [
|
|
1040
|
+
{
|
|
1041
|
+
label: marker.seriesLabel,
|
|
1042
|
+
value: marker.value,
|
|
1043
|
+
formatted: marker.formattedValue,
|
|
1044
|
+
color: marker.color,
|
|
1045
|
+
},
|
|
1046
|
+
],
|
|
1047
|
+
};
|
|
1048
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1049
|
+
markerElements = viewChildren('markerEl', ...(ngDevMode ? [{ debugName: "markerElements" }] : /* istanbul ignore next */ []));
|
|
1050
|
+
axisPointElements = computed(() => this.readingsAtCursor().map(({ markIndex }) => this.markerElements()[markIndex]?.nativeElement ?? null), ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
1051
|
+
topReading = computed(() => {
|
|
1052
|
+
const categoryIndex = this.scales.activeIndex();
|
|
1053
|
+
if (categoryIndex < 0) {
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
return this.allMarkers()
|
|
1057
|
+
.filter((marker) => marker.categoryIndex === categoryIndex && !marker.hidden)
|
|
1058
|
+
.reduce((top, marker) => (top === null || marker.y < top.y ? marker : top), null);
|
|
1059
|
+
}, ...(ngDevMode ? [{ debugName: "topReading" }] : /* istanbul ignore next */ []));
|
|
1060
|
+
/** The topmost reading at the active category, as an element; the cursor band spans the plot and would open an `'axis'` panel at the top. */
|
|
1061
|
+
topReadingElement = computed(() => {
|
|
1062
|
+
const highest = this.topReading();
|
|
1063
|
+
return highest
|
|
1064
|
+
? (this.markerElements()[highest.markIndex]?.nativeElement ?? null)
|
|
1065
|
+
: null;
|
|
1066
|
+
}, ...(ngDevMode ? [{ debugName: "topReadingElement" }] : /* istanbul ignore next */ []));
|
|
1067
|
+
topReadingY = computed(() => this.topReadingElement() ? null : (this.topReading()?.y ?? null), ...(ngDevMode ? [{ debugName: "topReadingY" }] : /* istanbul ignore next */ []));
|
|
1068
|
+
axisReadout = computed(() => {
|
|
1069
|
+
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1070
|
+
const series = marker && this.data().find((entry) => entry.id === marker.seriesId);
|
|
1071
|
+
return marker && !marker.hidden
|
|
1072
|
+
? {
|
|
1073
|
+
categoryIndex: marker.categoryIndex,
|
|
1074
|
+
y: marker.y,
|
|
1075
|
+
axis: series?.axis ?? 'primary',
|
|
1076
|
+
}
|
|
1077
|
+
: null;
|
|
1078
|
+
}, ...(ngDevMode ? [{ debugName: "axisReadout" }] : /* istanbul ignore next */ []));
|
|
1079
|
+
valuesByCategory = computed(() => {
|
|
1080
|
+
const perCategory = this.scales.categories().map(() => []);
|
|
1081
|
+
for (const marker of this.allMarkers()) {
|
|
1082
|
+
if (!marker.hidden) {
|
|
1083
|
+
perCategory[marker.categoryIndex]?.push(marker.value);
|
|
900
1084
|
}
|
|
901
1085
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1086
|
+
return perCategory;
|
|
1087
|
+
}, ...(ngDevMode ? [{ debugName: "valuesByCategory" }] : /* istanbul ignore next */ []));
|
|
1088
|
+
tooltipOrigin = computed(() => {
|
|
1089
|
+
if (this.tooltip() !== 'axis') {
|
|
1090
|
+
return this.activeMark.origin();
|
|
905
1091
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
this.cursorState.setIndex(this.clampIndex(index));
|
|
909
|
-
}
|
|
910
|
-
clampIndex(index) {
|
|
911
|
-
const last = this.categories().length - 1;
|
|
912
|
-
return Number.isFinite(index)
|
|
913
|
-
? Math.min(Math.max(Math.trunc(index), -1), last)
|
|
914
|
-
: -1;
|
|
915
|
-
}
|
|
916
|
-
plotRight = computed(() => this.plot().left + this.plot().width, ...(ngDevMode ? [{ debugName: "plotRight" }] : /* istanbul ignore next */ []));
|
|
917
|
-
plotBottom = computed(() => this.plot().top + this.plot().height, ...(ngDevMode ? [{ debugName: "plotBottom" }] : /* istanbul ignore next */ []));
|
|
918
|
-
axisLabelX = computed(() => this.plot().left - CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "axisLabelX" }] : /* istanbul ignore next */ []));
|
|
919
|
-
/** Clears the reservation the view height budgets, only when it is there; otherwise the labels fall past the viewBox. */
|
|
920
|
-
categoryLabelY = computed(() => this.secondaryPlotBottom() +
|
|
921
|
-
(this.reachesBelowZero() ? this.valueSpace() : 0) +
|
|
922
|
-
CHART_CATEGORY_LABEL_OFFSET, ...(ngDevMode ? [{ debugName: "categoryLabelY" }] : /* istanbul ignore next */ []));
|
|
923
|
-
ticks = computed(() => {
|
|
924
|
-
const domain = this.domain();
|
|
925
|
-
const toY = this.yPosition();
|
|
926
|
-
const format = this.valueFormatResolved();
|
|
927
|
-
return tickValues(domain.min, domain.max, this.tickCount()).map((value) => ({
|
|
928
|
-
value,
|
|
929
|
-
y: toY(value),
|
|
930
|
-
label: format(value, 'tick'),
|
|
931
|
-
}));
|
|
932
|
-
}, ...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
933
|
-
labelTexts = computed(() => [
|
|
934
|
-
...this.ticks().map((tick) => tick.label),
|
|
935
|
-
...this.secondaryTicks().map((tick) => tick.label),
|
|
936
|
-
...this.categories(),
|
|
937
|
-
].join('\n'), ...(ngDevMode ? [{ debugName: "labelTexts" }] : /* istanbul ignore next */ []));
|
|
938
|
-
/** Rotation is tried before thinning; both use the widest label as rendered. */
|
|
939
|
-
categoryLabelsRotated = computed(() => rotationWouldFit([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length)), ...(ngDevMode ? [{ debugName: "categoryLabelsRotated" }] : /* istanbul ignore next */ []));
|
|
940
|
-
categoryLabelInterval = computed(() => labelInterval([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length), this.categoryLabelsRotated()), ...(ngDevMode ? [{ debugName: "categoryLabelInterval" }] : /* istanbul ignore next */ []));
|
|
941
|
-
labelHovered = signal(null, ...(ngDevMode ? [{ debugName: "labelHovered" }] : /* istanbul ignore next */ []));
|
|
942
|
-
categoryLabelHover = this.labelHovered.asReadonly();
|
|
943
|
-
onCategoryLabelEnter(index, event) {
|
|
944
|
-
if (!this.cursorOn()) {
|
|
945
|
-
this.labelHovered.set({ index, event });
|
|
1092
|
+
if (this.tooltipAnchor() === 'pointer') {
|
|
1093
|
+
return this.scales.cursorPointer() ?? this.scales.cursorOrigin();
|
|
946
1094
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
], viewQueries: [{ propertyName: "canvasElement", first: true, predicate: ["canvasEl"], descendants: true, isSignal: true }, { propertyName: "bandElement", first: true, predicate: ["cursorBandEl"], descendants: true, isSignal: true }], exportAs: ["dsChart"], usesInheritance: true, ngImport: i0, template: "<figure\n class=\"chart\"\n dsChartStates\n messageAxes\n [unpin]=\"drawsUnpin\"\n [pinned]=\"cursorPinned()\"\n [caption]=\"caption()\"\n [error]=\"error()\"\n [errorText]=\"errorTextResolved()\"\n [pending]=\"(loading() && isEmpty()) || !renderReady()\"\n [reloading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <ds-chart-skeleton\n [count]=\"skeletonMarks()\"\n [plotHeight]=\"plotHeight() + 'px'\"\n [valueSpace]=\"valueSpace()\"\n [axisGutter]=\"axisGutter()\"\n [shimmer]=\"loading()\" />\n</ng-template>\n\n<ng-template #body>\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipSwatches]=\"tooltipSwatchesResolved()\"\n [dsChartTooltipExtraGap]=\"tooltipGap()\"\n [dsChartTooltipPinned]=\"tooltipPinned()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate()\">\n <svg\n #canvasEl\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [class.pins]=\"bandPins()\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <rect\n class=\"plot-bg\"\n [attr.x]=\"plot().left\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"plot().width\"\n [attr.height]=\"plot().height\" />\n\n @if (secondaryPlot().top !== plot().top) {\n <rect\n class=\"plot-bg\"\n [attr.x]=\"secondaryPlot().left\"\n [attr.y]=\"secondaryPlot().top\"\n [attr.width]=\"secondaryPlot().width\"\n [attr.height]=\"secondaryPlot().height\" />\n }\n\n @if (cursorBand(); as band) {\n <rect\n #cursorBandEl\n class=\"cursor-anchor\"\n aria-hidden=\"true\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n }\n\n @if (highlightBand(); as band) {\n <g\n class=\"cursor\"\n aria-hidden=\"true\"\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\">\n <rect\n class=\"category-band\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n\n <line\n class=\"cursor-line\"\n [attr.x1]=\"band.x + band.width / 2\"\n [attr.x2]=\"band.x + band.width / 2\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n </g>\n }\n\n <!-- Not on the svg: an aria-hidden ancestor leaves a focusable projected mark\n reachable by Tab yet 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 so a reference line paints under the marks in any source order. Both stay\n inside `.marks`, which the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <!-- After the marks, so a stop's ring paints over them. -->\n @if (keyboardStops()) {\n <g\n class=\"category-stops\"\n (keydown)=\"onStopKey($event)\">\n @for (stop of categoryStops(); track stop.index) {\n <rect\n class=\"category-stop\"\n [attr.data-category-index]=\"stop.index\"\n [attr.x]=\"stop.x\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"stop.width\"\n [attr.height]=\"plot().height\"\n [attr.tabindex]=\"stop.index === focusedCategory() ? 0 : -1\"\n [attr.aria-label]=\"stopLabel(stop.index)\"\n (focus)=\"onStopFocus(stop.index, $event)\"\n (blur)=\"onStopBlur($event)\" />\n }\n </g>\n }\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @if (axisLabel()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"axisLabelFill()\"\n [attr.transform]=\"\n 'rotate(-90 ' +\n axisTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"axisTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ axisLabel() }}\n </text>\n }\n\n @if (secondaryAxisLabel() && hasSecondaryAxis()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.transform]=\"\n 'rotate(90 ' +\n secondaryTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"secondaryTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ secondaryAxisLabel() }}\n </text>\n }\n\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 label.index) {\n <text\n class=\"category-label\"\n [class.is-rotated]=\"categoryLabelsRotated()\"\n [attr.text-anchor]=\"categoryLabelsRotated() ? 'end' : 'middle'\"\n [attr.x]=\"label.x\"\n [attr.y]=\"categoryLabelY()\"\n [attr.transform]=\"\n categoryLabelsRotated()\n ? 'rotate(-45 ' + label.x + ' ' + categoryLabelY() + ')'\n : null\n \"\n (pointerenter)=\"onCategoryLabelEnter(label.index, $event)\"\n (pointerleave)=\"onCategoryLabelLeave()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks so an annotation's name survives a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel], [dsSeriesAnnotation]\" />\n </g>\n\n @if (cursorPinned() && cursorBand(); as band) {\n <g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' +\n (band.x + band.width / 2) +\n ',' +\n bandPinY() +\n ')'\n \">\n </g>\n }\n </svg>\n </div>\n</ng-template>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),: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, var(--ds-chart-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{-webkit-user-select:text;user-select:text}.empty-text.is-error{color:var(--error)}:host{position:relative}:host(.framed){--_chart-pin-reset-inset: var(--ds-chart-frame-padding)}.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}:host{--_chart-message-height: var(--_chart-view-height)}.canvas{display:block;inline-size:100%}.canvas.pins{cursor:pointer}: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)}.category-label.is-rotated{dominant-baseline:middle}.axis-title{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold)}.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}}.cursor.cursor-in{animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.cursor.cursor-out{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.category-band{fill:var(--ds-chart-hover-bg-color)}.cursor-anchor{fill:none;pointer-events:none}.category-stop{fill:transparent;pointer-events:none}@media not (forced-colors:active){.category-stop:focus{outline:none}}@media not (forced-colors:active){.category-stop:focus-visible{outline:none}}.category-stop: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, var(--ds-chart-bg-color)))}.cursor-line{stroke:var(--ds-chart-cursor-line-color);stroke-width:1}.plot-bg{fill:var(--ds-chart-plot-bg-color, transparent);pointer-events:none}\n"], dependencies: [{ kind: "component", type: ChartSkeletonComponent, selector: "ds-chart-skeleton", inputs: ["marks", "count", "plotHeight", "valueSpace", "axisGutter", "shimmer"] }, { kind: "directive", type: ChartTooltipDirective, selector: "[dsChartTooltip]", inputs: ["dsChartTooltip", "dsChartTooltipOrigin", "dsChartTooltipTemplate", "dsChartTooltipExtraGap", "dsChartTooltipPinned", "dsChartTooltipSwatches"] }, { kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }, { kind: "component", type: ChartStatesComponent, selector: "figure[dsChartStates]", inputs: ["unpin", "pinned", "caption", "error", "errorText", "pending", "dataTable", "shimmer", "reloading", "empty", "emptyText", "messageAxes", "skeleton", "body", "message"], outputs: ["release"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1095
|
+
return this.topReadingElement() ?? this.scales.cursorOrigin();
|
|
1096
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1097
|
+
/** Every series' reading at the active category; a series with none contributes no row. */
|
|
1098
|
+
axisTooltipContext = computed(() => {
|
|
1099
|
+
const categoryIndex = this.scales.activeIndex();
|
|
1100
|
+
if (categoryIndex < 0) {
|
|
1101
|
+
return null;
|
|
1102
|
+
}
|
|
1103
|
+
const focused = this.focusedSeries();
|
|
1104
|
+
const entries = topDown(this.readingsAtCursor()
|
|
1105
|
+
.filter(({ seriesId }) => !focused || seriesId === focused)
|
|
1106
|
+
.map(({ reading }) => reading));
|
|
1107
|
+
if (!entries.length) {
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
return {
|
|
1111
|
+
category: this.scales.categories()[categoryIndex] ?? '',
|
|
1112
|
+
entries,
|
|
1113
|
+
};
|
|
1114
|
+
}, ...(ngDevMode ? [{ debugName: "axisTooltipContext" }] : /* istanbul ignore next */ []));
|
|
1115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1116
|
+
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 }, outline: { classPropertyName: "outline", publicName: "outline", 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 }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null }, showChange: { classPropertyName: "showChange", publicName: "showChange", isSignal: true, isRequired: false, transformFunction: null }, patterns: { classPropertyName: "patterns", publicName: "patterns", isSignal: true, isRequired: false, transformFunction: null }, stacked: { classPropertyName: "stacked", publicName: "stacked", 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 }, curve: { classPropertyName: "curve", publicName: "curve", 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 } }, outputs: { pointClicked: "pointClicked" }, viewQueries: [{ propertyName: "markerElements", predicate: ["markerEl"], descendants: true, isSignal: true }], exportAs: ["dsLineSeries"], ngImport: i0, template: "<svg:g\n class=\"lines\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-outlined]=\"outline()\"\n (pointerover)=\"onMarkerOver($event)\"\n (pointerout)=\"onMarkerOut($event)\"\n (keydown)=\"onMarkerKey($event)\"\n (click)=\"onMarkerClick($event)\">\n @for (entry of plotted(); track entry.series.id) {\n @let fades = entry.series.area === 'fade';\n\n @if (fades && entry.areaPaths.length) {\n <svg:defs>\n <svg:linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n [attr.id]=\"fadeId(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\">\n <svg:stop\n class=\"fade-start\"\n offset=\"0\" />\n\n <svg:stop\n class=\"fade-end\"\n offset=\"1\" />\n </svg:linearGradient>\n </svg:defs>\n }\n\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n [attr.data-series-id]=\"entry.series.id\"\n [class.is-fade]=\"fades\"\n [class.is-stacked]=\"stacked()\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\"\n [style.fill]=\"fades ? 'url(#' + fadeId(entry.seriesIndex) + ')' : null\"\n [attr.d]=\"path\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (outline()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-halo\"\n data-morph=\"hold\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [attr.data-series-id]=\"entry.series.id\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\" />\n }\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-line\"\n data-morph=\"line\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-spotlit]=\"isSpotlit(entry.series.id)\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [attr.data-series-id]=\"entry.series.id\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.stroke]=\"entry.color\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @for (change of changes(); track change.key) {\n <svg:g\n class=\"change\"\n aria-hidden=\"true\"\n [class.is-falling]=\"!change.rising\"\n (animate.leave)=\"leaveMark($event)\">\n <svg:path\n class=\"change-stretch\"\n [attr.d]=\"change.path\" />\n\n @if (change.label) {\n <svg:text\n class=\"change-label\"\n text-anchor=\"middle\"\n [attr.x]=\"change.x\"\n [attr.y]=\"change.y\">\n {{ change.label }}\n </svg:text>\n }\n </svg:g>\n }\n\n @if (\n showMarkers() ||\n interactive() ||\n pins()\n ) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n #markerEl\n class=\"series-marker\"\n data-morph=\"hold\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-collapsed]=\"marker.hidden\"\n [class.is-out]=\"isOutsideRange(marker.categoryIndex)\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"isActiveMarker(marker)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [attr.fill]=\"entry.color\"\n [attr.data-mark-index]=\"marker.hidden ? null : marker.markIndex\"\n [attr.data-point-key]=\"marker.key\"\n [attr.role]=\"interactive() && !marker.hidden ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() && !marker.hidden\n ? !scales.cursorOn?.() &&\n isTabStop(entry.series.id, marker.markIndex)\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"\n interactive() && !marker.hidden ? markerLabel(marker) : null\n \"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n }\n\n @if (scales.cursorOn?.()) {\n @for (entry of plotted(); track entry.series.id) {\n @if (!entry.series.hidden) {\n <svg:circle\n class=\"travel-marker\"\n aria-hidden=\"true\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [attr.data-series-id]=\"entry.series.id\"\n [attr.fill]=\"entry.color\" />\n }\n }\n }\n\n @for (pinned of pinnedMarkers(); track pinned.index) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' + pinned.value.x + ',' + (pinned.value.y - pinLift) + ')'\n \" />\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.series-line:not(.is-dashed){stroke-dasharray:1}.series-line:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line:not(.is-dashed){animation-delay:0ms}}.series-line:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo:not(.is-dashed){stroke-dasharray:1}.series-halo:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo:not(.is-dashed){animation-delay:0ms}}.series-halo:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-line.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line.is-dashed{animation-delay:0ms}}.series-line.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo.is-dashed{animation-delay:0ms}}.series-halo.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area{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(--duration-base) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-area{animation-delay:0ms}}.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{animation:ds-chart-mark-settle var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-sweep-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-marker{animation-delay:0ms}}@media not (forced-colors:active){.series-marker:focus{outline:none}}.series-marker.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.change{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.change{animation-delay:0ms}}.change.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.lines{--_chart-line-width: var(--ds-chart-line-width);--_chart-line-width-bold: var(--ds-chart-line-width-bold);--_chart-dot-radius: var(--ds-chart-dot-radius);--_chart-dot-radius-active: var(--ds-chart-dot-radius-active);--_chart-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),d var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),stroke-width var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),stroke-dashoffset var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-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),cx var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),cy 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,.series-marker.pins{cursor:pointer}.series-area{transition:d var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing);fill:var(--ds-chart-area-color, var(--_series-area-color));fill-opacity:var(--_chart-area-opacity);stroke:none}.series-area.is-fade{fill-opacity:1}.fade-start,.fade-end{stop-color:var(--ds-chart-area-color, var(--_series-area-color))}.fade-start{stop-opacity:var(--ds-chart-area-fade-opacity)}.fade-end{stop-opacity:0}.series-area.is-stacked{stroke:var(--ds-chart-bg-color);stroke-width:2;stroke-linejoin:round}.series-line.is-spotlit{stroke-width:var(--_chart-line-width-bold)}.series-line.is-collapsed:not(.is-dashed),.series-halo.is-collapsed:not(.is-dashed){stroke-dashoffset:1}.series-line.is-collapsed.is-dashed,.series-halo.is-collapsed.is-dashed,.series-area.is-collapsed,.series-marker.is-collapsed{opacity:0;pointer-events:none}.series-marker.is-out{opacity:var(--ds-chart-dim-opacity)}.travel-marker{r:var(--_chart-dot-radius-active);opacity:0;pointer-events:none;transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.travel-marker.is-shown{opacity:1}.travel-marker.is-shown.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.lines.is-outlined .travel-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.change{--_chart-change-label-color: var(--success-text);pointer-events:none}.change-stretch{fill:none;stroke:var(--ds-chart-positive-color);stroke-width:calc(2 * var(--_chart-line-width));stroke-linecap:round;stroke-linejoin:round}.change.is-falling .change-stretch{stroke:var(--ds-chart-negative-color)}.change.is-falling{--_chart-change-label-color: var(--error-text)}.change-label{fill:var(--_chart-change-label-color);font-size:var(--font-size-xs);font-weight:var(--font-weight-bold);paint-order:stroke;stroke:var(--ds-chart-bg-color);stroke-width:3px;stroke-linejoin:round}@media(forced-colors:active){.change-label{fill:CanvasText;stroke:Canvas}}.series-halo{transition:stroke-dashoffset var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing);fill:none;stroke:var(--ds-chart-bg-color);stroke-width:calc(var(--_chart-line-width) + var(--_chart-line-outline, 3px));stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-halo.is-dimmed{opacity:0}.series-line{fill:none;stroke-width:var(--_chart-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{transform-box:fill-box;transform-origin:center;r:var(--_chart-dot-radius)}.lines.is-outlined .series-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.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(--_chart-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, var(--ds-chart-bg-color)));r:var(--_chart-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"], dependencies: [{ kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
969
1117
|
}
|
|
970
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type:
|
|
1118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
971
1119
|
type: Component,
|
|
972
|
-
args: [{ selector: 'ds-chart', standalone: true, exportAs: 'dsChart', imports: [
|
|
973
|
-
|
|
974
|
-
ChartTooltipDirective,
|
|
975
|
-
ChartPinMarkerComponent,
|
|
976
|
-
ChartStatesComponent,
|
|
977
|
-
], host: {
|
|
978
|
-
'[class.framed]': "frameResolved() === 'auto'",
|
|
979
|
-
'[class.measuring]': '!settled()',
|
|
980
|
-
'[style.--_chart-view-height]': "viewHeight() + 'px'",
|
|
981
|
-
'(keydown)': 'onChartKey($event)',
|
|
982
|
-
'(focusout)': 'onChartFocusOut($event)',
|
|
983
|
-
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
984
|
-
{
|
|
985
|
-
provide: CHART_SCALES,
|
|
986
|
-
useExisting: forwardRef(() => ChartComponent),
|
|
987
|
-
},
|
|
988
|
-
], template: "<figure\n class=\"chart\"\n dsChartStates\n messageAxes\n [unpin]=\"drawsUnpin\"\n [pinned]=\"cursorPinned()\"\n [caption]=\"caption()\"\n [error]=\"error()\"\n [errorText]=\"errorTextResolved()\"\n [pending]=\"(loading() && isEmpty()) || !renderReady()\"\n [reloading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <ds-chart-skeleton\n [count]=\"skeletonMarks()\"\n [plotHeight]=\"plotHeight() + 'px'\"\n [valueSpace]=\"valueSpace()\"\n [axisGutter]=\"axisGutter()\"\n [shimmer]=\"loading()\" />\n</ng-template>\n\n<ng-template #body>\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipSwatches]=\"tooltipSwatchesResolved()\"\n [dsChartTooltipExtraGap]=\"tooltipGap()\"\n [dsChartTooltipPinned]=\"tooltipPinned()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate()\">\n <svg\n #canvasEl\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [class.pins]=\"bandPins()\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <rect\n class=\"plot-bg\"\n [attr.x]=\"plot().left\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"plot().width\"\n [attr.height]=\"plot().height\" />\n\n @if (secondaryPlot().top !== plot().top) {\n <rect\n class=\"plot-bg\"\n [attr.x]=\"secondaryPlot().left\"\n [attr.y]=\"secondaryPlot().top\"\n [attr.width]=\"secondaryPlot().width\"\n [attr.height]=\"secondaryPlot().height\" />\n }\n\n @if (cursorBand(); as band) {\n <rect\n #cursorBandEl\n class=\"cursor-anchor\"\n aria-hidden=\"true\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n }\n\n @if (highlightBand(); as band) {\n <g\n class=\"cursor\"\n aria-hidden=\"true\"\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\">\n <rect\n class=\"category-band\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n\n <line\n class=\"cursor-line\"\n [attr.x1]=\"band.x + band.width / 2\"\n [attr.x2]=\"band.x + band.width / 2\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n </g>\n }\n\n <!-- Not on the svg: an aria-hidden ancestor leaves a focusable projected mark\n reachable by Tab yet 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 so a reference line paints under the marks in any source order. Both stay\n inside `.marks`, which the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <!-- After the marks, so a stop's ring paints over them. -->\n @if (keyboardStops()) {\n <g\n class=\"category-stops\"\n (keydown)=\"onStopKey($event)\">\n @for (stop of categoryStops(); track stop.index) {\n <rect\n class=\"category-stop\"\n [attr.data-category-index]=\"stop.index\"\n [attr.x]=\"stop.x\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"stop.width\"\n [attr.height]=\"plot().height\"\n [attr.tabindex]=\"stop.index === focusedCategory() ? 0 : -1\"\n [attr.aria-label]=\"stopLabel(stop.index)\"\n (focus)=\"onStopFocus(stop.index, $event)\"\n (blur)=\"onStopBlur($event)\" />\n }\n </g>\n }\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @if (axisLabel()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"axisLabelFill()\"\n [attr.transform]=\"\n 'rotate(-90 ' +\n axisTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"axisTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ axisLabel() }}\n </text>\n }\n\n @if (secondaryAxisLabel() && hasSecondaryAxis()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.transform]=\"\n 'rotate(90 ' +\n secondaryTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"secondaryTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ secondaryAxisLabel() }}\n </text>\n }\n\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 label.index) {\n <text\n class=\"category-label\"\n [class.is-rotated]=\"categoryLabelsRotated()\"\n [attr.text-anchor]=\"categoryLabelsRotated() ? 'end' : 'middle'\"\n [attr.x]=\"label.x\"\n [attr.y]=\"categoryLabelY()\"\n [attr.transform]=\"\n categoryLabelsRotated()\n ? 'rotate(-45 ' + label.x + ' ' + categoryLabelY() + ')'\n : null\n \"\n (pointerenter)=\"onCategoryLabelEnter(label.index, $event)\"\n (pointerleave)=\"onCategoryLabelLeave()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks so an annotation's name survives a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel], [dsSeriesAnnotation]\" />\n </g>\n\n @if (cursorPinned() && cursorBand(); as band) {\n <g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' +\n (band.x + band.width / 2) +\n ',' +\n bandPinY() +\n ')'\n \">\n </g>\n }\n </svg>\n </div>\n</ng-template>\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),: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, var(--ds-chart-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{-webkit-user-select:text;user-select:text}.empty-text.is-error{color:var(--error)}:host{position:relative}:host(.framed){--_chart-pin-reset-inset: var(--ds-chart-frame-padding)}.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}:host{--_chart-message-height: var(--_chart-view-height)}.canvas{display:block;inline-size:100%}.canvas.pins{cursor:pointer}: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)}.category-label.is-rotated{dominant-baseline:middle}.axis-title{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold)}.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}}.cursor.cursor-in{animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.cursor.cursor-out{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.category-band{fill:var(--ds-chart-hover-bg-color)}.cursor-anchor{fill:none;pointer-events:none}.category-stop{fill:transparent;pointer-events:none}@media not (forced-colors:active){.category-stop:focus{outline:none}}@media not (forced-colors:active){.category-stop:focus-visible{outline:none}}.category-stop: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, var(--ds-chart-bg-color)))}.cursor-line{stroke:var(--ds-chart-cursor-line-color);stroke-width:1}.plot-bg{fill:var(--ds-chart-plot-bg-color, transparent);pointer-events:none}\n"] }]
|
|
989
|
-
}], ctorParameters: () => [], propDecorators: { categories: [{ type: i0.Input, args: [{ isSignal: true, alias: "categories", required: false }] }], skeletonCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "skeletonCount", 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 }] }], cursor: [{ type: i0.Input, args: [{ isSignal: true, alias: "cursor", required: false }] }], maxSecondary: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSecondary", 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 }] }], 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 }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisLabel", required: false }] }], secondaryAxisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryAxisLabel", required: false }] }], tooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipTemplate", required: false }] }], tooltipExtraGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipExtraGap", required: false }] }], canvasElement: [{ type: i0.ViewChild, args: ['canvasEl', { isSignal: true }] }], bandElement: [{ type: i0.ViewChild, args: ['cursorBandEl', { isSignal: true }] }] } });
|
|
1120
|
+
args: [{ selector: 'g[dsLineSeries]', standalone: true, imports: [ChartPinMarkerComponent], exportAs: 'dsLineSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"lines\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-outlined]=\"outline()\"\n (pointerover)=\"onMarkerOver($event)\"\n (pointerout)=\"onMarkerOut($event)\"\n (keydown)=\"onMarkerKey($event)\"\n (click)=\"onMarkerClick($event)\">\n @for (entry of plotted(); track entry.series.id) {\n @let fades = entry.series.area === 'fade';\n\n @if (fades && entry.areaPaths.length) {\n <svg:defs>\n <svg:linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n [attr.id]=\"fadeId(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\">\n <svg:stop\n class=\"fade-start\"\n offset=\"0\" />\n\n <svg:stop\n class=\"fade-end\"\n offset=\"1\" />\n </svg:linearGradient>\n </svg:defs>\n }\n\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n [attr.data-series-id]=\"entry.series.id\"\n [class.is-fade]=\"fades\"\n [class.is-stacked]=\"stacked()\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\"\n [style.fill]=\"fades ? 'url(#' + fadeId(entry.seriesIndex) + ')' : null\"\n [attr.d]=\"path\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (outline()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-halo\"\n data-morph=\"hold\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [attr.data-series-id]=\"entry.series.id\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\" />\n }\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-line\"\n data-morph=\"line\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-spotlit]=\"isSpotlit(entry.series.id)\"\n [class.is-collapsed]=\"entry.series.hidden\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [attr.data-series-id]=\"entry.series.id\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.stroke]=\"entry.color\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @for (change of changes(); track change.key) {\n <svg:g\n class=\"change\"\n aria-hidden=\"true\"\n [class.is-falling]=\"!change.rising\"\n (animate.leave)=\"leaveMark($event)\">\n <svg:path\n class=\"change-stretch\"\n [attr.d]=\"change.path\" />\n\n @if (change.label) {\n <svg:text\n class=\"change-label\"\n text-anchor=\"middle\"\n [attr.x]=\"change.x\"\n [attr.y]=\"change.y\">\n {{ change.label }}\n </svg:text>\n }\n </svg:g>\n }\n\n @if (\n showMarkers() ||\n interactive() ||\n pins()\n ) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n #markerEl\n class=\"series-marker\"\n data-morph=\"hold\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-collapsed]=\"marker.hidden\"\n [class.is-out]=\"isOutsideRange(marker.categoryIndex)\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"isActiveMarker(marker)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.cx]=\"marker.x\"\n [attr.cy]=\"marker.y\"\n [attr.fill]=\"entry.color\"\n [attr.data-mark-index]=\"marker.hidden ? null : marker.markIndex\"\n [attr.data-point-key]=\"marker.key\"\n [attr.role]=\"interactive() && !marker.hidden ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() && !marker.hidden\n ? !scales.cursorOn?.() &&\n isTabStop(entry.series.id, marker.markIndex)\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"\n interactive() && !marker.hidden ? markerLabel(marker) : null\n \"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n }\n\n @if (scales.cursorOn?.()) {\n @for (entry of plotted(); track entry.series.id) {\n @if (!entry.series.hidden) {\n <svg:circle\n class=\"travel-marker\"\n aria-hidden=\"true\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [attr.data-series-id]=\"entry.series.id\"\n [attr.fill]=\"entry.color\" />\n }\n }\n }\n\n @for (pinned of pinnedMarkers(); track pinned.index) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' + pinned.value.x + ',' + (pinned.value.y - pinLift) + ')'\n \" />\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.series-line:not(.is-dashed){stroke-dasharray:1}.series-line:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line:not(.is-dashed){animation-delay:0ms}}.series-line:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo:not(.is-dashed){stroke-dasharray:1}.series-halo:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo:not(.is-dashed){animation-delay:0ms}}.series-halo:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-line.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line.is-dashed{animation-delay:0ms}}.series-line.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo.is-dashed{animation-delay:0ms}}.series-halo.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area{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(--duration-base) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-area{animation-delay:0ms}}.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{animation:ds-chart-mark-settle var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-sweep-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-marker{animation-delay:0ms}}@media not (forced-colors:active){.series-marker:focus{outline:none}}.series-marker.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.change{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.change{animation-delay:0ms}}.change.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.lines{--_chart-line-width: var(--ds-chart-line-width);--_chart-line-width-bold: var(--ds-chart-line-width-bold);--_chart-dot-radius: var(--ds-chart-dot-radius);--_chart-dot-radius-active: var(--ds-chart-dot-radius-active);--_chart-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),d var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),stroke-width var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),stroke-dashoffset var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-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),cx var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),cy 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,.series-marker.pins{cursor:pointer}.series-area{transition:d var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing);fill:var(--ds-chart-area-color, var(--_series-area-color));fill-opacity:var(--_chart-area-opacity);stroke:none}.series-area.is-fade{fill-opacity:1}.fade-start,.fade-end{stop-color:var(--ds-chart-area-color, var(--_series-area-color))}.fade-start{stop-opacity:var(--ds-chart-area-fade-opacity)}.fade-end{stop-opacity:0}.series-area.is-stacked{stroke:var(--ds-chart-bg-color);stroke-width:2;stroke-linejoin:round}.series-line.is-spotlit{stroke-width:var(--_chart-line-width-bold)}.series-line.is-collapsed:not(.is-dashed),.series-halo.is-collapsed:not(.is-dashed){stroke-dashoffset:1}.series-line.is-collapsed.is-dashed,.series-halo.is-collapsed.is-dashed,.series-area.is-collapsed,.series-marker.is-collapsed{opacity:0;pointer-events:none}.series-marker.is-out{opacity:var(--ds-chart-dim-opacity)}.travel-marker{r:var(--_chart-dot-radius-active);opacity:0;pointer-events:none;transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.travel-marker.is-shown{opacity:1}.travel-marker.is-shown.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.lines.is-outlined .travel-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.change{--_chart-change-label-color: var(--success-text);pointer-events:none}.change-stretch{fill:none;stroke:var(--ds-chart-positive-color);stroke-width:calc(2 * var(--_chart-line-width));stroke-linecap:round;stroke-linejoin:round}.change.is-falling .change-stretch{stroke:var(--ds-chart-negative-color)}.change.is-falling{--_chart-change-label-color: var(--error-text)}.change-label{fill:var(--_chart-change-label-color);font-size:var(--font-size-xs);font-weight:var(--font-weight-bold);paint-order:stroke;stroke:var(--ds-chart-bg-color);stroke-width:3px;stroke-linejoin:round}@media(forced-colors:active){.change-label{fill:CanvasText;stroke:Canvas}}.series-halo{transition:stroke-dashoffset var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing);fill:none;stroke:var(--ds-chart-bg-color);stroke-width:calc(var(--_chart-line-width) + var(--_chart-line-outline, 3px));stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-halo.is-dimmed{opacity:0}.series-line{fill:none;stroke-width:var(--_chart-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{transform-box:fill-box;transform-origin:center;r:var(--_chart-dot-radius)}.lines.is-outlined .series-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.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(--_chart-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, var(--ds-chart-bg-color)));r:var(--_chart-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"] }]
|
|
1121
|
+
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], showMarkers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMarkers", required: false }] }], outline: [{ type: i0.Input, args: [{ isSignal: true, alias: "outline", 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 }] }], highlighted: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlighted", required: false }] }], showChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "showChange", required: false }] }], patterns: [{ type: i0.Input, args: [{ isSignal: true, alias: "patterns", required: false }] }], stacked: [{ type: i0.Input, args: [{ isSignal: true, alias: "stacked", required: false }] }], staggerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "staggerMs", required: false }] }], gaps: [{ type: i0.Input, args: [{ isSignal: true, alias: "gaps", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", 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 }] }], pointClicked: [{ type: i0.Output, args: ["pointClicked"] }], markerElements: [{ type: i0.ViewChildren, args: ['markerEl', { isSignal: true }] }] } });
|
|
990
1122
|
|
|
991
|
-
|
|
992
|
-
const
|
|
993
|
-
//
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
* One column per datum, drawn against the scales `ds-chart` supplies.
|
|
1000
|
-
*
|
|
1001
|
-
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants. Written
|
|
1002
|
-
* as `<svg:g dsColumnSeries>`.
|
|
1003
|
-
*/
|
|
1004
|
-
class ColumnSeriesComponent {
|
|
1123
|
+
// Between the value axis and the pill that prints the reading there.
|
|
1124
|
+
const READOUT_PILL_GAP = 2;
|
|
1125
|
+
// Text to edge, either side, of a pill drawn on the canvas.
|
|
1126
|
+
const PILL_PADDING = 6;
|
|
1127
|
+
const RANGE_BAND_INSET = 2;
|
|
1128
|
+
// Above the plot's top edge, inside the value space reserved there.
|
|
1129
|
+
const RANGE_PILL_RISE = 10;
|
|
1130
|
+
class ChartComponent extends DsChartBase {
|
|
1005
1131
|
leaveMark = leaveMark;
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
* a
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
spans = computed(() => {
|
|
1072
|
-
const given = this.offsets();
|
|
1073
|
-
return this.data().map((point, index) => given?.[index] ?? {
|
|
1074
|
-
from: 0,
|
|
1075
|
-
to: Number.isFinite(point.value) ? point.value : 0,
|
|
1076
|
-
});
|
|
1077
|
-
}, ...(ngDevMode ? [{ debugName: "spans" }] : /* istanbul ignore next */ []));
|
|
1132
|
+
renderReady = chartRenderGate();
|
|
1133
|
+
/** One band per category; every projected mark is positioned against them. */
|
|
1134
|
+
categories = input([], ...(ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []));
|
|
1135
|
+
/** How many columns the loading skeleton draws before the categories are known. */
|
|
1136
|
+
skeletonCount = input(CHART_SKELETON_COUNT, { ...(ngDevMode ? { debugName: "skeletonCount" } : /* istanbul ignore next */ {}), transform: (raw) => numberAttribute(raw, CHART_SKELETON_COUNT) });
|
|
1137
|
+
skeletonMarks = computed(() => skeletonMarkCount(this.categories().length, this.skeletonCount()), ...(ngDevMode ? [{ debugName: "skeletonMarks" }] : /* istanbul ignore next */ []));
|
|
1138
|
+
/** How many value-axis ticks to aim for; ticks snap to a round step, so the count may differ by one. */
|
|
1139
|
+
tickCount = input(CHART_DEFAULT_TICK_COUNT, { ...(ngDevMode ? { debugName: "tickCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1140
|
+
/** Pins the floor of the value axis. It only opens the axis further; a floor above the data is ignored. */
|
|
1141
|
+
min = input(null, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1142
|
+
/** Pins the ceiling of the value axis. See `min`. */
|
|
1143
|
+
max = input(null, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1144
|
+
/** Draws a band and crosshair down the category under the pointer and reports it to every mark
|
|
1145
|
+
* through `activeIndex`; the panel then names every reading at that category. `'auto'` (default)
|
|
1146
|
+
* is `'category'` with two or more tooltip-showing marks or a mark with `tooltip="axis"`, else
|
|
1147
|
+
* `'none'`. */
|
|
1148
|
+
cursor = input('auto', ...(ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []));
|
|
1149
|
+
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
1150
|
+
/** Whether hiding a series re-scales the value axes to what is left. Off holds them where they
|
|
1151
|
+
* stand with every series shown. */
|
|
1152
|
+
rescaleOnHide = input(true, { ...(ngDevMode ? { debugName: "rescaleOnHide" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1153
|
+
/** Pins the ceiling of the SECOND value axis, the way `max` pins the first. */
|
|
1154
|
+
maxSecondary = input(null, { ...(ngDevMode ? { debugName: "maxSecondary" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1155
|
+
/** Plot height in CSS pixels, axis labels and headroom excluded; fixed across card widths. */
|
|
1156
|
+
plotHeight = input(CHART_DEFAULT_PLOT_HEIGHT, { ...(ngDevMode ? { debugName: "plotHeight" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1157
|
+
/** Width in CSS pixels of the left gutter that carries the value-axis labels. */
|
|
1158
|
+
axisGutter = input(CHART_DEFAULT_AXIS_GUTTER, { ...(ngDevMode ? { debugName: "axisGutter" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1159
|
+
/** Pixels reserved at each end of the plot for a value label, drawn or not. */
|
|
1160
|
+
valueSpace = input(CHART_DEFAULT_VALUE_SPACE, { ...(ngDevMode ? { debugName: "valueSpace" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1161
|
+
/** How the second value axis relates to the first, once a mark has reported against it. */
|
|
1162
|
+
secondaryAxisMode = input('aligned', ...(ngDevMode ? [{ debugName: "secondaryAxisMode" }] : /* istanbul ignore next */ []));
|
|
1163
|
+
/** Colours the first axis's tick labels like the marks measured against it. */
|
|
1164
|
+
axisColor = input(null, ...(ngDevMode ? [{ debugName: "axisColor" }] : /* istanbul ignore next */ []));
|
|
1165
|
+
/** `axisColor` for the second axis. */
|
|
1166
|
+
secondaryAxisColor = input(null, ...(ngDevMode ? [{ debugName: "secondaryAxisColor" }] : /* istanbul ignore next */ []));
|
|
1167
|
+
/** Names the first axis's unit beside it. */
|
|
1168
|
+
axisLabel = input(null, ...(ngDevMode ? [{ debugName: "axisLabel" }] : /* istanbul ignore next */ []));
|
|
1169
|
+
/** `axisLabel` for the second axis. */
|
|
1170
|
+
secondaryAxisLabel = input(null, ...(ngDevMode ? [{ debugName: "secondaryAxisLabel" }] : /* istanbul ignore next */ []));
|
|
1171
|
+
/** Lets a press dragged across categories select them: a band over the range, the sum and mean of
|
|
1172
|
+
* every reading in it, and the marks outside it faded. Escape or a press outside clears it; a
|
|
1173
|
+
* press released in its own category still pins. Off by default. */
|
|
1174
|
+
selectRange = input(false, { ...(ngDevMode ? { debugName: "selectRange" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1175
|
+
/** Answers the pointer on the axes: the category label in bold, a guide from the value axis and
|
|
1176
|
+
* the value there in a pill on the axis. On by default. */
|
|
1177
|
+
showAxisReadout = input(true, { ...(ngDevMode ? { debugName: "showAxisReadout" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1178
|
+
tooltipSwatchesResolved = this.defaults.tooltipSwatches;
|
|
1179
|
+
hoverDelayMs = this.defaults.hoverDelayMs;
|
|
1180
|
+
host = inject(ElementRef);
|
|
1181
|
+
zone = inject(NgZone);
|
|
1182
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
1183
|
+
/** The `<svg>`'s rendered width: the host's content box, since `:host(.framed)` carries the padding. */
|
|
1184
|
+
measuredWidth = elementWidth(this.host);
|
|
1185
|
+
/** True under SSR, which draws at the fallback width. */
|
|
1186
|
+
measured = computed(() => !this.isBrowser || this.measuredWidth() > 0, ...(ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []));
|
|
1187
|
+
viewWidth = computed(() => this.measuredWidth() || CHART_FALLBACK_WIDTH, ...(ngDevMode ? [{ debugName: "viewWidth" }] : /* istanbul ignore next */ []));
|
|
1188
|
+
/** The geometry a resize redraws; marks hold still while it changes. A category coming or going is
|
|
1189
|
+
* not part of it: the marks glide sideways and a line morphs to its new point count. */
|
|
1190
|
+
layout = computed(() => `${this.measuredWidth()}`, ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
1191
|
+
settledLayout = signal('', ...(ngDevMode ? [{ debugName: "settledLayout" }] : /* istanbul ignore next */ []));
|
|
1192
|
+
/** Whether the marks may animate: the correction after measuring and a resize must not, or the plot
|
|
1193
|
+
* drags behind the pointer. Derived from the layout, so the hold lands in the same render as the new
|
|
1194
|
+
* geometry. Two frames, because after one the corrected geometry is unstyled and `transitionrun`
|
|
1195
|
+
* fires on `x` and `width`. */
|
|
1196
|
+
settled = computed(() => this.measuredWidth() > 0 && this.layout() === this.settledLayout(), ...(ngDevMode ? [{ debugName: "settled" }] : /* istanbul ignore next */ []));
|
|
1078
1197
|
constructor() {
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
1085
|
-
axisOrigin: computed(() => {
|
|
1086
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1087
|
-
return categoryIndex < 0
|
|
1088
|
-
? null
|
|
1089
|
-
: (this.barElements()[categoryIndex]?.nativeElement ?? null);
|
|
1090
|
-
}),
|
|
1091
|
-
axisEntries: this.axisEntries,
|
|
1092
|
-
axisPointElements: this.axisPointElements,
|
|
1093
|
-
});
|
|
1094
|
-
const host = this.host;
|
|
1095
|
-
listenForMarkFocus(host, (event, hit) => this.onMarkFocus(event, hit), () => {
|
|
1096
|
-
this.activeMark.leave();
|
|
1097
|
-
if (this.scales.cursorOn?.()) {
|
|
1098
|
-
this.scales.setActiveIndex(-1);
|
|
1198
|
+
super();
|
|
1199
|
+
effect((onCleanup) => {
|
|
1200
|
+
const layout = this.layout();
|
|
1201
|
+
if (this.measuredWidth() === 0 || layout === this.settledLayout()) {
|
|
1202
|
+
return;
|
|
1099
1203
|
}
|
|
1204
|
+
onCleanup(afterTwoFrames(this.zone, () => this.settledLayout.set(layout)));
|
|
1100
1205
|
});
|
|
1101
|
-
|
|
1206
|
+
// Before the view drops the stops past the new end, while the focused one is still in the DOM.
|
|
1102
1207
|
effect(() => {
|
|
1103
|
-
const
|
|
1208
|
+
const last = this.categories().length - 1;
|
|
1104
1209
|
untracked(() => {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
answeringLabel = true;
|
|
1109
|
-
this.activeMark.enter(hover.index, hover.event, this.tooltipMark(), mark);
|
|
1210
|
+
if (this.activeIndex() > last) {
|
|
1211
|
+
this.cursorState.release();
|
|
1212
|
+
this.cursorState.setIndex(last);
|
|
1110
1213
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1214
|
+
if (this.roving() > last && this.keyboardFocusInside()) {
|
|
1215
|
+
this.refocusStop = true;
|
|
1216
|
+
}
|
|
1217
|
+
if ((this.range()?.to ?? -1) > last) {
|
|
1218
|
+
this.range.set(null);
|
|
1114
1219
|
}
|
|
1115
1220
|
});
|
|
1116
1221
|
});
|
|
1222
|
+
afterRenderEffect(() => {
|
|
1223
|
+
this.categories();
|
|
1224
|
+
if (this.refocusStop) {
|
|
1225
|
+
this.refocusStop = false;
|
|
1226
|
+
untracked(() => this.focusStop(this.focusedCategory()));
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
effect((onCleanup) => {
|
|
1230
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1231
|
+
if (canvas && this.cursorResolved() === 'category') {
|
|
1232
|
+
onCleanup(this.listenForCursor(canvas));
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
effect((onCleanup) => {
|
|
1236
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1237
|
+
if (canvas && this.selectRange()) {
|
|
1238
|
+
onCleanup(this.listenForRange(canvas));
|
|
1239
|
+
}
|
|
1240
|
+
else {
|
|
1241
|
+
untracked(() => this.range.set(null));
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
// Read phase: every `getComputedTextLength` before any write, or each label forces a layout.
|
|
1245
|
+
afterRenderEffect({
|
|
1246
|
+
read: () => {
|
|
1247
|
+
this.labelTexts();
|
|
1248
|
+
this.measuredLabelWidth.set(this.widestLabel('.axis-label.is-primary'));
|
|
1249
|
+
this.measuredSecondaryLabelWidth.set(this.widestLabel('.axis-label.is-secondary'));
|
|
1250
|
+
this.measuredCategoryLabelWidth.set(this.widestLabel('.category-label'));
|
|
1251
|
+
},
|
|
1252
|
+
});
|
|
1253
|
+
afterRenderEffect({
|
|
1254
|
+
read: () => {
|
|
1255
|
+
this.shownReadout();
|
|
1256
|
+
this.rangeTotal();
|
|
1257
|
+
this.readoutTextWidth.set(this.widestLabel('.readout-text'));
|
|
1258
|
+
this.rangeTextWidth.set(this.widestLabel('.range-text'));
|
|
1259
|
+
},
|
|
1260
|
+
});
|
|
1261
|
+
// The readings and the scales change with the data, so a held pin follows its category's new geometry.
|
|
1262
|
+
afterRenderEffect({
|
|
1263
|
+
read: () => {
|
|
1264
|
+
this.tooltipContext();
|
|
1265
|
+
this.yPosition();
|
|
1266
|
+
this.secondaryYPosition();
|
|
1267
|
+
this.bandPinY.set(this.measureBandPinY());
|
|
1268
|
+
},
|
|
1269
|
+
});
|
|
1270
|
+
// Where the pin and the anchor land, not their boxes: a pin moving to another mark is mid-glide here.
|
|
1271
|
+
afterRenderEffect({
|
|
1272
|
+
read: () => {
|
|
1273
|
+
this.tooltipContext();
|
|
1274
|
+
this.bandPinY();
|
|
1275
|
+
const origin = this.tooltipOrigin();
|
|
1276
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1277
|
+
const pin = this.tooltipPinned()
|
|
1278
|
+
? this.host.nativeElement.querySelector('[dschartpinmarker]')
|
|
1279
|
+
: null;
|
|
1280
|
+
const viewHeight = this.viewHeight();
|
|
1281
|
+
if (!(origin instanceof Element) ||
|
|
1282
|
+
!pin ||
|
|
1283
|
+
!canvas ||
|
|
1284
|
+
viewHeight <= 0) {
|
|
1285
|
+
this.pinRise.set(0);
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
const pixelsPerUnit = canvas.getBoundingClientRect().height / viewHeight;
|
|
1289
|
+
const pinTop = landedTranslateY(pin) - CHART_PIN_RADIUS;
|
|
1290
|
+
const rise = (landedExtent(origin, canvas, viewHeight).top - pinTop) *
|
|
1291
|
+
pixelsPerUnit;
|
|
1292
|
+
this.pinRise.set(Math.max(0, Math.round(rise)));
|
|
1293
|
+
},
|
|
1294
|
+
});
|
|
1117
1295
|
}
|
|
1118
|
-
|
|
1119
|
-
this.
|
|
1120
|
-
|
|
1296
|
+
widestLabel(selector) {
|
|
1297
|
+
const labels = this.host.nativeElement.querySelectorAll(selector);
|
|
1298
|
+
let widest = 0;
|
|
1299
|
+
for (const label of labels) {
|
|
1300
|
+
widest = Math.max(widest, label.getComputedTextLength());
|
|
1301
|
+
}
|
|
1302
|
+
return Math.ceil(widest);
|
|
1121
1303
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
/**
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1304
|
+
/** Two plots stacked on a shared category axis. */
|
|
1305
|
+
stacked = computed(() => this.secondaryAxisMode() === 'split' && this.hasSecondaryAxis(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
1306
|
+
viewHeight = computed(() => chartViewHeight(this.plotHeight(), this.valueSpace(), this.reachesBelowZero()) + (this.stacked() ? this.plotHeight() + CHART_STACKED_PLOT_GAP : 0), ...(ngDevMode ? [{ debugName: "viewHeight" }] : /* istanbul ignore next */ []));
|
|
1307
|
+
/** One viewBox unit is one CSS pixel, so lengths inside the plot hold at every width. */
|
|
1308
|
+
viewBox = computed(() => `0 0 ${this.viewWidth()} ${this.viewHeight()}`, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
1309
|
+
/** Widest tick label as rendered, in CSS pixels. Zero until the first read and under SSR. */
|
|
1310
|
+
measuredLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1311
|
+
measuredCategoryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredCategoryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1312
|
+
/** `axisGutter` is the floor: compact numbers are wider in some locales and the SVG clips overflow. */
|
|
1313
|
+
effectiveAxisGutter = computed(() => Math.max(this.axisGutter(), this.measuredLabelWidth() + CHART_AXIS_LABEL_GAP + this.axisTitleGutter()), ...(ngDevMode ? [{ debugName: "effectiveAxisGutter" }] : /* istanbul ignore next */ []));
|
|
1314
|
+
/** A rotated axis title shares the tick gutter; its width is its line height. */
|
|
1315
|
+
axisTitleGutter = computed(() => this.axisLabel() ? CHART_AXIS_TITLE_BAND : 0, ...(ngDevMode ? [{ debugName: "axisTitleGutter" }] : /* istanbul ignore next */ []));
|
|
1316
|
+
axisTitleX = computed(() => CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "axisTitleX" }] : /* istanbul ignore next */ []));
|
|
1317
|
+
secondaryTitleX = computed(() => this.viewWidth() - CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "secondaryTitleX" }] : /* istanbul ignore next */ []));
|
|
1318
|
+
measuredSecondaryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredSecondaryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1319
|
+
/** Right-hand label room only when the second axis is drawn there; a stacked one is on the left. */
|
|
1320
|
+
rightGutter = computed(() => this.hasSecondaryAxis() && !this.stacked()
|
|
1321
|
+
? Math.max(this.axisGutter(), this.measuredSecondaryLabelWidth() +
|
|
1322
|
+
CHART_AXIS_LABEL_GAP +
|
|
1323
|
+
this.secondaryTitleGutter())
|
|
1324
|
+
: CHART_EDGE_GUTTER, ...(ngDevMode ? [{ debugName: "rightGutter" }] : /* istanbul ignore next */ []));
|
|
1325
|
+
secondaryTitleGutter = computed(() => this.secondaryAxisLabel() && this.hasSecondaryAxis()
|
|
1326
|
+
? CHART_AXIS_TITLE_BAND
|
|
1327
|
+
: 0, ...(ngDevMode ? [{ debugName: "secondaryTitleGutter" }] : /* istanbul ignore next */ []));
|
|
1328
|
+
plot = computed(() => chartPlot(this.viewWidth(), this.plotHeight(), this.effectiveAxisGutter(), this.valueSpace(), this.rightGutter()), ...(ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []));
|
|
1329
|
+
secondaryPlot = computed(() => {
|
|
1330
|
+
const plot = this.plot();
|
|
1331
|
+
return this.stacked()
|
|
1332
|
+
? { ...plot, top: plot.top + plot.height + CHART_STACKED_PLOT_GAP }
|
|
1333
|
+
: plot;
|
|
1334
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryPlot" }] : /* istanbul ignore next */ []));
|
|
1335
|
+
reportedDomains = signal(new Map(), ...(ngDevMode ? [{ debugName: "reportedDomains" }] : /* istanbul ignore next */ []));
|
|
1336
|
+
reportDomain(id, values, axis = 'primary', hidden = false) {
|
|
1337
|
+
this.reportedDomains.update((reported) => new Map(reported).set(id, { axis, values, hidden }));
|
|
1338
|
+
}
|
|
1339
|
+
valuesOn(axis, withHidden = false) {
|
|
1340
|
+
const found = [];
|
|
1341
|
+
for (const report of this.reportedDomains().values()) {
|
|
1342
|
+
if (report.axis === axis && (withHidden || !report.hidden)) {
|
|
1343
|
+
found.push(report.values);
|
|
1344
|
+
}
|
|
1144
1345
|
}
|
|
1145
|
-
|
|
1146
|
-
const overflow = height - mark.height;
|
|
1147
|
-
return { y: mark.top - overflow / 2, height };
|
|
1346
|
+
return found;
|
|
1148
1347
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
: this.scales.yPosition();
|
|
1155
|
-
const spans = this.spans();
|
|
1156
|
-
const format = this.valueFormat();
|
|
1157
|
-
return this.data().map((point, index) => {
|
|
1158
|
-
const span = spans[index];
|
|
1159
|
-
const foot = toY(span.from);
|
|
1160
|
-
const tip = toY(span.to);
|
|
1161
|
-
const below = tip > foot;
|
|
1162
|
-
// Only a segment with one under it gives up the gap; the baseline segment would lift the stack off the axis.
|
|
1163
|
-
const gap = span.from === 0 ? 0 : Math.min(STACK_SEGMENT_GAP, Math.abs(tip - foot));
|
|
1164
|
-
const baseline = below ? foot + gap : foot - gap;
|
|
1165
|
-
const color = point.color ??
|
|
1166
|
-
this.seriesColor() ??
|
|
1167
|
-
CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
1168
|
-
return {
|
|
1169
|
-
key: point.id ?? String(index),
|
|
1170
|
-
point,
|
|
1171
|
-
x: toX(index),
|
|
1172
|
-
tip,
|
|
1173
|
-
below,
|
|
1174
|
-
baseline,
|
|
1175
|
-
top: Math.min(tip, baseline),
|
|
1176
|
-
height: Math.abs(tip - baseline),
|
|
1177
|
-
labelY: below ? tip + VALUE_LABEL_GAP : tip - VALUE_LABEL_GAP,
|
|
1178
|
-
pinY: this.pinYOf(tip, baseline, below),
|
|
1179
|
-
origin: below ? 'top' : 'bottom',
|
|
1180
|
-
formattedValue: format(point.value, 'tooltip'),
|
|
1181
|
-
color,
|
|
1182
|
-
hatched: (point.fill ?? this.seriesFill()) === 'hatched',
|
|
1183
|
-
};
|
|
1348
|
+
releaseDomain(id) {
|
|
1349
|
+
this.reportedDomains.update((reported) => {
|
|
1350
|
+
const next = new Map(reported);
|
|
1351
|
+
next.delete(id);
|
|
1352
|
+
return next;
|
|
1184
1353
|
});
|
|
1185
|
-
}
|
|
1186
|
-
/**
|
|
1187
|
-
|
|
1188
|
-
|
|
1354
|
+
}
|
|
1355
|
+
/** A template that replaces the panel's body. */
|
|
1356
|
+
tooltipTemplate = input(null, ...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
1357
|
+
/** Extra clearance between the mark and the panel, for a value label printed in that gap. */
|
|
1358
|
+
tooltipExtraGap = input(0, { ...(ngDevMode ? { debugName: "tooltipExtraGap" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1359
|
+
tooltipSources = signal(new Map(), ...(ngDevMode ? [{ debugName: "tooltipSources" }] : /* istanbul ignore next */ []));
|
|
1360
|
+
reportTooltip(id, source) {
|
|
1361
|
+
this.tooltipSources.update((sources) => new Map(sources).set(id, source));
|
|
1362
|
+
}
|
|
1363
|
+
releaseTooltip(id) {
|
|
1364
|
+
this.tooltipSources.update((sources) => {
|
|
1365
|
+
const next = new Map(sources);
|
|
1366
|
+
next.delete(id);
|
|
1367
|
+
return next;
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
/** Two or more marks that show a tooltip: the panel is about the category, not the mark under the pointer. */
|
|
1371
|
+
composed = computed(() => [...this.tooltipSources().values()].filter((source) => source.offersTooltip?.() ?? true).length > 1, ...(ngDevMode ? [{ debugName: "composed" }] : /* istanbul ignore next */ []));
|
|
1372
|
+
cursorResolved = computed(() => {
|
|
1373
|
+
const cursor = this.cursor();
|
|
1374
|
+
if (cursor !== 'auto') {
|
|
1375
|
+
return cursor;
|
|
1376
|
+
}
|
|
1377
|
+
const readsCategory = [...this.tooltipSources().values()].some((source) => source.readsCategory?.() ?? false);
|
|
1378
|
+
return this.composed() || readsCategory ? 'category' : 'none';
|
|
1379
|
+
}, ...(ngDevMode ? [{ debugName: "cursorResolved" }] : /* istanbul ignore next */ []));
|
|
1380
|
+
cursorOn = computed(() => this.cursorResolved() === 'category', ...(ngDevMode ? [{ debugName: "cursorOn" }] : /* istanbul ignore next */ []));
|
|
1381
|
+
/** The tooltip context to show, if any; at most one mark has one at a time. */
|
|
1382
|
+
activeTooltip = computed(() => [...this.tooltipSources().values()].find((source) => source.context() !== null) ?? null, ...(ngDevMode ? [{ debugName: "activeTooltip" }] : /* istanbul ignore next */ []));
|
|
1383
|
+
// By source and position, not label: two marks may read under one label.
|
|
1384
|
+
pickedKey = signal(null, ...(ngDevMode ? [{ debugName: "pickedKey" }] : /* istanbul ignore next */ []));
|
|
1385
|
+
pickedReading = computed(() => {
|
|
1386
|
+
const picked = this.pickedKey();
|
|
1387
|
+
return picked === null
|
|
1388
|
+
? null
|
|
1389
|
+
: (this.readingsTopDown().find((reading) => reading.key === picked) ??
|
|
1390
|
+
null);
|
|
1391
|
+
}, ...(ngDevMode ? [{ debugName: "pickedReading" }] : /* istanbul ignore next */ []));
|
|
1392
|
+
tooltipContext = computed(() => {
|
|
1393
|
+
const merged = this.categoryContext();
|
|
1394
|
+
const picked = this.pickedReading();
|
|
1395
|
+
return picked === null || !this.cursorOn() || merged === null
|
|
1396
|
+
? merged
|
|
1397
|
+
: { ...merged, entries: [picked.entry] };
|
|
1398
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1399
|
+
categoryContext = computed(() => {
|
|
1400
|
+
const base = this.activeTooltip()?.context() ?? null;
|
|
1401
|
+
const categoryIndex = this.activeIndex();
|
|
1402
|
+
if (this.cursorResolved() !== 'category' || categoryIndex < 0) {
|
|
1403
|
+
return base;
|
|
1404
|
+
}
|
|
1405
|
+
const readings = [...this.tooltipSources().values()].flatMap((source) => source.axisEntries?.() ?? []);
|
|
1406
|
+
if (base === null) {
|
|
1407
|
+
return readings.length === 0
|
|
1408
|
+
? null
|
|
1409
|
+
: {
|
|
1410
|
+
category: this.categories()[categoryIndex] ?? '',
|
|
1411
|
+
entries: topDown(readings),
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
// The panel is about the category, so every other mark's reading joins it, matched by label; the offering mark keeps its own row and detail.
|
|
1415
|
+
const named = new Map(base.entries.map((entry) => [entry.label, entry]));
|
|
1416
|
+
if (readings.every((reading) => named.has(reading.label))) {
|
|
1417
|
+
return base;
|
|
1418
|
+
}
|
|
1419
|
+
const drawn = new Set(readings.map((reading) => reading.label));
|
|
1420
|
+
return {
|
|
1421
|
+
...base,
|
|
1422
|
+
entries: [
|
|
1423
|
+
...base.entries.filter((entry) => !drawn.has(entry.label)),
|
|
1424
|
+
...topDown(readings).map((reading) => named.get(reading.label) ?? reading),
|
|
1425
|
+
],
|
|
1426
|
+
};
|
|
1427
|
+
}, ...(ngDevMode ? [{ debugName: "categoryContext" }] : /* istanbul ignore next */ []));
|
|
1428
|
+
tooltipOrigin = computed(() => this.pickedReading()?.element ?? this.categoryOrigin(), ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1429
|
+
categoryOrigin = computed(() => {
|
|
1430
|
+
const own = this.activeTooltip()?.origin() ?? null;
|
|
1431
|
+
if (this.activeTooltip()?.stacked?.() && own instanceof Element) {
|
|
1432
|
+
return this.stackTop(own);
|
|
1433
|
+
}
|
|
1434
|
+
if (this.cursorResolved() !== 'category' ||
|
|
1435
|
+
(own !== null && !(own instanceof Element))) {
|
|
1436
|
+
return own;
|
|
1437
|
+
}
|
|
1438
|
+
// Anchor over the tallest reading at the category, pointer over it or not: the opening mark
|
|
1439
|
+
// puts the panel low under a column, and pointer-only readings make it jump at the column's edge.
|
|
1440
|
+
const boxes = [...this.tooltipSources().values()]
|
|
1441
|
+
.map((source) => (source.axisOrigin ?? source.origin)())
|
|
1442
|
+
.filter((origin) => origin instanceof Element)
|
|
1443
|
+
.map((element) => ({ element, top: element.getBoundingClientRect().top }))
|
|
1444
|
+
.filter(({ element }) => {
|
|
1445
|
+
const box = element.getBoundingClientRect();
|
|
1446
|
+
return box.width > 0 && box.height > 0;
|
|
1447
|
+
});
|
|
1448
|
+
const reading = this.readingAnchorTop();
|
|
1449
|
+
if (reading !== null && boxes.every(({ top }) => reading <= top)) {
|
|
1450
|
+
return this.cursorOrigin();
|
|
1451
|
+
}
|
|
1452
|
+
return boxes.length === 0
|
|
1453
|
+
? (own ?? this.cursorOrigin())
|
|
1454
|
+
: boxes.reduce((highest, candidate) => candidate.top < highest.top ? candidate : highest).element;
|
|
1455
|
+
}, ...(ngDevMode ? [{ debugName: "categoryOrigin" }] : /* istanbul ignore next */ []));
|
|
1456
|
+
/** The highest reading a mark reports without an element; the cursor band shrinks to a marker's
|
|
1457
|
+
* box there, so the panel and the pin anchor to it as to a marker. */
|
|
1458
|
+
readingY = computed(() => {
|
|
1459
|
+
let highest = null;
|
|
1460
|
+
for (const source of this.tooltipSources().values()) {
|
|
1461
|
+
const y = source.axisReadingY?.() ?? null;
|
|
1462
|
+
if (y !== null && (highest === null || y < highest)) {
|
|
1463
|
+
highest = y;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
return highest;
|
|
1467
|
+
}, ...(ngDevMode ? [{ debugName: "readingY" }] : /* istanbul ignore next */ []));
|
|
1468
|
+
// In client pixels, as the boxes it is compared with; from the reading, not the anchor's box, which may not have moved yet.
|
|
1469
|
+
readingAnchorTop() {
|
|
1470
|
+
const y = this.readingY();
|
|
1471
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1472
|
+
const viewHeight = this.viewHeight();
|
|
1473
|
+
if (y === null || !canvas || viewHeight <= 0) {
|
|
1474
|
+
return null;
|
|
1475
|
+
}
|
|
1476
|
+
const frame = canvas.getBoundingClientRect();
|
|
1477
|
+
const radius = parseFloat(getComputedStyle(this.host.nativeElement).getPropertyValue('--ds-chart-dot-radius')) || 0;
|
|
1478
|
+
return frame.top + ((y - radius) * frame.height) / viewHeight;
|
|
1479
|
+
}
|
|
1480
|
+
tooltipPinned = computed(() => (this.activeTooltip()?.pinned?.() ?? false) || this.cursorPinned(), ...(ngDevMode ? [{ debugName: "tooltipPinned" }] : /* istanbul ignore next */ []));
|
|
1481
|
+
/** Compared by value: a mark that reports and reads `yPosition()` in one effect would otherwise loop forever. */
|
|
1482
|
+
domain = computed(() => axisDomain(this.valuesOn('primary', !this.rescaleOnHide()), this.tickCount(), this.min(), this.max()), { ...(ngDevMode ? { debugName: "domain" } : /* istanbul ignore next */ {}), equal: (a, b) => a.min === b.min && a.max === b.max });
|
|
1483
|
+
// Counts values, not reporters: a line series registers both axes, so an empty one would raise a second axis.
|
|
1484
|
+
hasSecondaryAxis = computed(() => this.valuesOn('secondary').some((values) => values.length > 0), ...(ngDevMode ? [{ debugName: "hasSecondaryAxis" }] : /* istanbul ignore next */ []));
|
|
1485
|
+
secondary = computed(() => secondaryAxis(this.ticks().map((tick) => tick.value), this.valuesOn('secondary', !this.rescaleOnHide()), this.tickCount(), this.secondaryAxisMode(), this.maxSecondary()), { ...(ngDevMode ? { debugName: "secondary" } : /* istanbul ignore next */ {}), equal: (a, b) => a.aligned === b.aligned &&
|
|
1486
|
+
a.domain.min === b.domain.min &&
|
|
1487
|
+
a.domain.max === b.domain.max &&
|
|
1488
|
+
a.ticks.length === b.ticks.length &&
|
|
1489
|
+
a.ticks.every((tick, index) => tick === b.ticks[index]) });
|
|
1490
|
+
secondaryYPosition = computed(() => {
|
|
1491
|
+
if (!this.hasSecondaryAxis()) {
|
|
1492
|
+
return this.yPosition();
|
|
1493
|
+
}
|
|
1494
|
+
const plot = this.secondaryPlot();
|
|
1495
|
+
return valueScale(this.secondary().domain, plot.top, plot.height);
|
|
1496
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryYPosition" }] : /* istanbul ignore next */ []));
|
|
1497
|
+
secondaryTicks = computed(() => {
|
|
1498
|
+
if (!this.hasSecondaryAxis()) {
|
|
1499
|
+
return [];
|
|
1500
|
+
}
|
|
1501
|
+
const toY = this.secondaryYPosition();
|
|
1502
|
+
const format = this.valueFormatResolved();
|
|
1503
|
+
return this.secondary().ticks.map((value) => ({
|
|
1504
|
+
value,
|
|
1505
|
+
y: toY(value),
|
|
1506
|
+
label: format(value, 'tick'),
|
|
1507
|
+
}));
|
|
1508
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryTicks" }] : /* istanbul ignore next */ []));
|
|
1509
|
+
/** Second gridlines only where the scales do not share rows; an aligned axis would double every stroke. */
|
|
1510
|
+
showSecondaryGridlines = computed(() => this.hasSecondaryAxis() &&
|
|
1511
|
+
(this.stacked() || !this.secondary().aligned) &&
|
|
1512
|
+
this.secondaryTicks().length > 1, ...(ngDevMode ? [{ debugName: "showSecondaryGridlines" }] : /* istanbul ignore next */ []));
|
|
1513
|
+
secondaryLabelX = computed(() => this.stacked()
|
|
1514
|
+
? this.plot().left - CHART_AXIS_LABEL_GAP
|
|
1515
|
+
: this.plot().left + this.plot().width + CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "secondaryLabelX" }] : /* istanbul ignore next */ []));
|
|
1516
|
+
secondaryLabelAnchor = computed(() => this.stacked() ? 'end' : 'start', ...(ngDevMode ? [{ debugName: "secondaryLabelAnchor" }] : /* istanbul ignore next */ []));
|
|
1517
|
+
secondaryPlotBottom = computed(() => this.secondaryPlot().top + this.secondaryPlot().height, ...(ngDevMode ? [{ debugName: "secondaryPlotBottom" }] : /* istanbul ignore next */ []));
|
|
1518
|
+
/** No tint on a single-scale plot. */
|
|
1519
|
+
axisLabelFill = computed(() => this.hasSecondaryAxis() ? this.axisColor() : null, ...(ngDevMode ? [{ debugName: "axisLabelFill" }] : /* istanbul ignore next */ []));
|
|
1520
|
+
secondaryAxisLabelFill = computed(() => this.secondaryAxisColor(), ...(ngDevMode ? [{ debugName: "secondaryAxisLabelFill" }] : /* istanbul ignore next */ []));
|
|
1521
|
+
bands = computed(() => bandScale(this.categories().length, this.plot().width, CHART_BAND_PADDING), ...(ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []));
|
|
1522
|
+
bandWidth = computed(() => this.bands().bandWidth, ...(ngDevMode ? [{ debugName: "bandWidth" }] : /* istanbul ignore next */ []));
|
|
1523
|
+
xPosition = computed(() => {
|
|
1524
|
+
const plot = this.plot();
|
|
1525
|
+
const bands = this.bands();
|
|
1526
|
+
return (index) => plot.left + bands.position(index) + bands.bandWidth / 2;
|
|
1527
|
+
}, ...(ngDevMode ? [{ debugName: "xPosition" }] : /* istanbul ignore next */ []));
|
|
1528
|
+
yPosition = computed(() => {
|
|
1529
|
+
const plot = this.plot();
|
|
1530
|
+
return valueScale(this.domain(), plot.top, plot.height);
|
|
1531
|
+
}, ...(ngDevMode ? [{ debugName: "yPosition" }] : /* istanbul ignore next */ []));
|
|
1532
|
+
zeroOffset = computed(() => this.yPosition()(0), ...(ngDevMode ? [{ debugName: "zeroOffset" }] : /* istanbul ignore next */ []));
|
|
1533
|
+
bandAt(index) {
|
|
1534
|
+
if (this.cursorResolved() !== 'category' || index < 0) {
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
const width = this.bandWidth();
|
|
1538
|
+
const plot = this.plot();
|
|
1539
|
+
return {
|
|
1540
|
+
x: this.xPosition()(index) - width / 2,
|
|
1541
|
+
width,
|
|
1542
|
+
top: plot.top,
|
|
1543
|
+
bottom: plot.top + plot.height,
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
/** The band the panel reads from, drawn invisible as its fallback anchor. */
|
|
1547
|
+
cursorBand = computed(() => this.bandAt(this.activeIndex()), ...(ngDevMode ? [{ debugName: "cursorBand" }] : /* istanbul ignore next */ []));
|
|
1548
|
+
// A held band is not highlighted: under a pin the highlight follows the pointer alone.
|
|
1549
|
+
highlightBand = computed(() => this.bandAt(this.tooltipPinned() ? this.hoveredCategory() : this.activeIndex()), ...(ngDevMode ? [{ debugName: "highlightBand" }] : /* istanbul ignore next */ []));
|
|
1550
|
+
/** The same state machine the element marks run on; here the index counts categories. */
|
|
1551
|
+
cursorState = chartActiveMark(() => this.defaults.tooltipLingerMs(), () => this.hoverDelayMs());
|
|
1552
|
+
activeIndex = this.cursorState.index;
|
|
1553
|
+
pointerAt = signal(null, ...(ngDevMode ? [{ debugName: "pointerAt" }] : /* istanbul ignore next */ []));
|
|
1554
|
+
// Set at once, not after the hover delay.
|
|
1555
|
+
pointerInBand = signal(false, ...(ngDevMode ? [{ debugName: "pointerInBand" }] : /* istanbul ignore next */ []));
|
|
1556
|
+
hoveredCategory = signal(-1, ...(ngDevMode ? [{ debugName: "hoveredCategory" }] : /* istanbul ignore next */ []));
|
|
1557
|
+
/** Under the panel: it opens over the tallest reading, so the disc sits at that reading's head -
|
|
1558
|
+
* inside a column, below a marker, and over a column too short to hold it. */
|
|
1559
|
+
bandPinY = signal(0, ...(ngDevMode ? [{ debugName: "bandPinY" }] : /* istanbul ignore next */ []));
|
|
1560
|
+
// The highest segment at the mark's category, by where each lands: a segment glides after a data change.
|
|
1561
|
+
stackTop(segment) {
|
|
1562
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1563
|
+
const index = segment
|
|
1564
|
+
.closest('[data-mark-index]')
|
|
1565
|
+
?.getAttribute('data-mark-index');
|
|
1566
|
+
if (!canvas || index == null) {
|
|
1567
|
+
return segment;
|
|
1568
|
+
}
|
|
1569
|
+
const segments = this.host.nativeElement.querySelectorAll(`[data-mark-index="${index}"] > .bar`);
|
|
1570
|
+
let highest = segment;
|
|
1571
|
+
let highestTop = landedExtent(segment, canvas, this.viewHeight()).top;
|
|
1572
|
+
for (const candidate of segments) {
|
|
1573
|
+
const top = landedExtent(candidate, canvas, this.viewHeight()).top;
|
|
1574
|
+
if (top < highestTop) {
|
|
1575
|
+
highest = candidate;
|
|
1576
|
+
highestTop = top;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return highest;
|
|
1580
|
+
}
|
|
1581
|
+
// Read from the marks' bound geometry, not their boxes: after a data change the boxes are mid-glide,
|
|
1582
|
+
// and the pin glides to where the reading lands.
|
|
1583
|
+
measureBandPinY() {
|
|
1584
|
+
const band = this.cursorBand();
|
|
1189
1585
|
const inset = CHART_PIN_RADIUS + CHART_PIN_GAP;
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1586
|
+
const origin = this.tooltipOrigin();
|
|
1587
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1588
|
+
if (!band || !canvas || !(origin instanceof Element)) {
|
|
1589
|
+
return (band?.top ?? 0) + inset;
|
|
1590
|
+
}
|
|
1591
|
+
const { top, height } = landedExtent(origin, canvas, this.viewHeight());
|
|
1592
|
+
if (height < 2 * inset && !origin.matches('.bar')) {
|
|
1593
|
+
return top + height + inset;
|
|
1594
|
+
}
|
|
1595
|
+
const value = origin.parentElement?.querySelector(':scope > .value');
|
|
1596
|
+
return pinYAbove(top, height, value ? landedTextTop(value) : null, inset);
|
|
1597
|
+
}
|
|
1598
|
+
/** How far a held pin sits above the panel's anchor; the panel rises by as much to stay over it. */
|
|
1599
|
+
pinRise = signal(0, ...(ngDevMode ? [{ debugName: "pinRise" }] : /* istanbul ignore next */ []));
|
|
1600
|
+
tooltipGap = computed(() => Math.max(this.tooltipExtraGap(), this.pinRise()), ...(ngDevMode ? [{ debugName: "tooltipGap" }] : /* istanbul ignore next */ []));
|
|
1601
|
+
pinnedCategories = computed(() => this.cursorPinned() && this.cursorBand() ? [this.activeIndex()] : [], ...(ngDevMode ? [{ debugName: "pinnedCategories" }] : /* istanbul ignore next */ []));
|
|
1602
|
+
lineSeries = contentChildren(LineSeriesComponent, { ...(ngDevMode ? { debugName: "lineSeries" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1603
|
+
pinnedLine = computed(() => this.lineSeries().length > 0, ...(ngDevMode ? [{ debugName: "pinnedLine" }] : /* istanbul ignore next */ []));
|
|
1604
|
+
bandPins = computed(() => this.pinOnClickResolved() && this.pointerInBand(), ...(ngDevMode ? [{ debugName: "bandPins" }] : /* istanbul ignore next */ []));
|
|
1605
|
+
cursorPointer = computed(() => this.activeIndex() < 0 ? null : this.pointerAt(), ...(ngDevMode ? [{ debugName: "cursorPointer" }] : /* istanbul ignore next */ []));
|
|
1606
|
+
/** Whether the cursor is held. */
|
|
1607
|
+
cursorPinned = this.cursorState.pinned;
|
|
1608
|
+
drawsUnpin = !inject(CHART_UNPIN_DRAWN_BY_HOST, {
|
|
1609
|
+
optional: true,
|
|
1610
|
+
});
|
|
1611
|
+
releaseCursor() {
|
|
1612
|
+
this.cursorState.release();
|
|
1613
|
+
}
|
|
1614
|
+
canvasElement = viewChild('canvasEl', ...(ngDevMode ? [{ debugName: "canvasElement" }] : /* istanbul ignore next */ []));
|
|
1615
|
+
// Read once per hover and dropped on scroll: reading on every move forces a second layout after the band update.
|
|
1616
|
+
canvasRect = null;
|
|
1617
|
+
forgetCanvasRect = () => {
|
|
1618
|
+
this.canvasRect = null;
|
|
1619
|
+
};
|
|
1620
|
+
// Client x to view units: the canvas is scaled to its box.
|
|
1621
|
+
viewXOf(event, canvas) {
|
|
1622
|
+
this.canvasRect ??= canvas.getBoundingClientRect();
|
|
1623
|
+
return (((event.clientX - this.canvasRect.left) / this.canvasRect.width) *
|
|
1624
|
+
this.viewWidth());
|
|
1625
|
+
}
|
|
1626
|
+
plotPointer(event, canvas) {
|
|
1627
|
+
const plot = this.plot();
|
|
1628
|
+
const viewX = this.viewXOf(event, canvas);
|
|
1629
|
+
// Every point belongs to its nearest category, so the cursor never passes through "none".
|
|
1630
|
+
const index = this.clampIndex(categoryAt(viewX, plot.left, plot.width, this.categories().length));
|
|
1631
|
+
this.pointerAt.set({ x: event.clientX, y: event.clientY });
|
|
1632
|
+
this.pointerInBand.set(index >= 0);
|
|
1633
|
+
this.hoveredCategory.set(index);
|
|
1634
|
+
if (index < 0) {
|
|
1635
|
+
if (event.type === 'pointerdown' && this.cursorPinned()) {
|
|
1636
|
+
this.cursorState.release();
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
this.cursorState.leave();
|
|
1640
|
+
}
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
// Under `selectRange` a press may become a drag; the range listener pins on a release in place.
|
|
1644
|
+
if (event.type === 'pointerdown' &&
|
|
1645
|
+
this.pinOnClickResolved() &&
|
|
1646
|
+
!this.selectRange()) {
|
|
1647
|
+
this.cursorState.pin(index, event);
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
this.cursorState.enter(index, event);
|
|
1651
|
+
}
|
|
1652
|
+
/** Listens only when a category cursor is drawn, outside the zone. */
|
|
1653
|
+
listenForCursor(canvas) {
|
|
1654
|
+
const forgetRect = this.forgetCanvasRect;
|
|
1655
|
+
const onPointer = (event) => {
|
|
1656
|
+
if (event.type === 'pointerdown' && !isPrimaryPress(event)) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
this.plotPointer(event, canvas);
|
|
1660
|
+
};
|
|
1661
|
+
const onEnter = () => window.addEventListener('scroll', forgetRect, {
|
|
1662
|
+
capture: true,
|
|
1663
|
+
passive: true,
|
|
1664
|
+
});
|
|
1665
|
+
const onLeave = () => {
|
|
1666
|
+
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
1667
|
+
forgetRect();
|
|
1668
|
+
this.pointerInBand.set(false);
|
|
1669
|
+
this.hoveredCategory.set(-1);
|
|
1670
|
+
// The panel goes back to the band the keyboard holds, which keeps it open while focus stays.
|
|
1671
|
+
if (this.keyboardFocusInside()) {
|
|
1672
|
+
this.cursorState.setIndex(this.focusedCategory());
|
|
1673
|
+
}
|
|
1674
|
+
else {
|
|
1675
|
+
this.cursorState.leave();
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
this.zone.runOutsideAngular(() => {
|
|
1679
|
+
canvas.addEventListener('pointerenter', onEnter);
|
|
1680
|
+
canvas.addEventListener('pointermove', onPointer);
|
|
1681
|
+
canvas.addEventListener('pointerdown', onPointer);
|
|
1682
|
+
canvas.addEventListener('pointerleave', onLeave);
|
|
1683
|
+
});
|
|
1684
|
+
return () => {
|
|
1685
|
+
canvas.removeEventListener('pointerenter', onEnter);
|
|
1686
|
+
canvas.removeEventListener('pointermove', onPointer);
|
|
1687
|
+
canvas.removeEventListener('pointerdown', onPointer);
|
|
1688
|
+
canvas.removeEventListener('pointerleave', onLeave);
|
|
1689
|
+
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
1690
|
+
forgetRect();
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
range = signal(null, ...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
1694
|
+
/** The categories a drag selected, both ends included; `null` when none are. */
|
|
1695
|
+
selectedRange = this.range.asReadonly();
|
|
1696
|
+
listenForRange(canvas) {
|
|
1697
|
+
const document = canvas.ownerDocument;
|
|
1698
|
+
const view = document.defaultView ?? window;
|
|
1699
|
+
let anchor = -1;
|
|
1700
|
+
let dragged = false;
|
|
1701
|
+
const forgetRectWhileDragging = () => this.forgetCanvasRect();
|
|
1702
|
+
// Past either end of the plot a drag holds the nearest category.
|
|
1703
|
+
const categoryOf = (event, clamp) => {
|
|
1704
|
+
const plot = this.plot();
|
|
1705
|
+
const viewX = this.viewXOf(event, canvas);
|
|
1706
|
+
const x = clamp
|
|
1707
|
+
? Math.min(Math.max(viewX, plot.left), plot.left + plot.width)
|
|
1708
|
+
: viewX;
|
|
1709
|
+
return categoryAt(x, plot.left, plot.width, this.categories().length);
|
|
1710
|
+
};
|
|
1711
|
+
const onMove = (event) => {
|
|
1712
|
+
const index = categoryOf(event, true);
|
|
1713
|
+
if (index < 0 || (index === anchor && !dragged)) {
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
dragged = true;
|
|
1717
|
+
this.range.set({
|
|
1718
|
+
from: Math.min(anchor, index),
|
|
1719
|
+
to: Math.max(anchor, index),
|
|
1720
|
+
});
|
|
1721
|
+
};
|
|
1722
|
+
const stopDrag = () => {
|
|
1723
|
+
view.removeEventListener('pointermove', onMove);
|
|
1724
|
+
view.removeEventListener('pointerup', onUp);
|
|
1725
|
+
view.removeEventListener('scroll', forgetRectWhileDragging, {
|
|
1726
|
+
capture: true,
|
|
1727
|
+
});
|
|
1728
|
+
anchor = -1;
|
|
1729
|
+
};
|
|
1730
|
+
const onUp = (event) => {
|
|
1731
|
+
if (!dragged && this.cursorOn() && this.pinOnClickResolved()) {
|
|
1732
|
+
this.cursorState.pin(anchor, event, null, canvas);
|
|
1733
|
+
}
|
|
1734
|
+
stopDrag();
|
|
1735
|
+
};
|
|
1736
|
+
const onDown = (event) => {
|
|
1737
|
+
if (!isPrimaryPress(event)) {
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
stopDrag();
|
|
1741
|
+
this.range.set(null);
|
|
1742
|
+
dragged = false;
|
|
1743
|
+
this.forgetCanvasRect();
|
|
1744
|
+
anchor = categoryOf(event, false);
|
|
1745
|
+
if (anchor >= 0) {
|
|
1746
|
+
view.addEventListener('pointermove', onMove);
|
|
1747
|
+
view.addEventListener('pointerup', onUp);
|
|
1748
|
+
view.addEventListener('scroll', forgetRectWhileDragging, {
|
|
1749
|
+
capture: true,
|
|
1750
|
+
passive: true,
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
const onOutside = (event) => {
|
|
1755
|
+
if (!(event.target instanceof Node) || !canvas.contains(event.target)) {
|
|
1756
|
+
this.range.set(null);
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1759
|
+
const onEscape = (event) => {
|
|
1760
|
+
if (event.key === 'Escape') {
|
|
1761
|
+
this.range.set(null);
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
this.zone.runOutsideAngular(() => {
|
|
1765
|
+
canvas.addEventListener('pointerdown', onDown);
|
|
1766
|
+
document.addEventListener('pointerdown', onOutside, true);
|
|
1767
|
+
document.addEventListener('keydown', onEscape);
|
|
1768
|
+
});
|
|
1769
|
+
return () => {
|
|
1770
|
+
stopDrag();
|
|
1771
|
+
canvas.removeEventListener('pointerdown', onDown);
|
|
1772
|
+
document.removeEventListener('pointerdown', onOutside, true);
|
|
1773
|
+
document.removeEventListener('keydown', onEscape);
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
rangeTotal = computed(() => {
|
|
1777
|
+
const range = this.range();
|
|
1778
|
+
if (!range) {
|
|
1779
|
+
return null;
|
|
1780
|
+
}
|
|
1781
|
+
const perSource = [...this.tooltipSources().values()].map((source) => source.valuesByCategory?.() ?? []);
|
|
1782
|
+
let total = 0;
|
|
1783
|
+
let count = 0;
|
|
1784
|
+
for (let index = range.from; index <= range.to; index++) {
|
|
1785
|
+
for (const values of perSource) {
|
|
1786
|
+
for (const value of values[index] ?? []) {
|
|
1787
|
+
total += value;
|
|
1788
|
+
count++;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
const categories = this.categories();
|
|
1793
|
+
const name = range.from === range.to
|
|
1794
|
+
? (categories[range.from] ?? '')
|
|
1795
|
+
: `${categories[range.from] ?? ''}-${categories[range.to] ?? ''}`;
|
|
1796
|
+
const format = this.valueFormatResolved();
|
|
1797
|
+
const rangeTotal = this.intl().chart.rangeTotal ?? DS_INTL_DEFAULTS.chart.rangeTotal;
|
|
1798
|
+
return rangeTotal(name, format(total, 'tooltip'), format(count > 0 ? total / count : 0, 'tooltip'));
|
|
1799
|
+
}, ...(ngDevMode ? [{ debugName: "rangeTotal" }] : /* istanbul ignore next */ []));
|
|
1800
|
+
rangeTextWidth = signal(0, ...(ngDevMode ? [{ debugName: "rangeTextWidth" }] : /* istanbul ignore next */ []));
|
|
1801
|
+
rangeBand = computed(() => {
|
|
1802
|
+
const range = this.range();
|
|
1803
|
+
const label = this.rangeTotal();
|
|
1804
|
+
const count = this.categories().length;
|
|
1805
|
+
if (!range || label === null || count === 0) {
|
|
1806
|
+
return null;
|
|
1807
|
+
}
|
|
1808
|
+
const plot = this.plot();
|
|
1809
|
+
const step = plot.width / count;
|
|
1810
|
+
const x = plot.left + step * range.from + RANGE_BAND_INSET;
|
|
1811
|
+
const width = step * (range.to - range.from + 1) - 2 * RANGE_BAND_INSET;
|
|
1812
|
+
const pillWidth = this.rangeTextWidth() + 2 * PILL_PADDING;
|
|
1813
|
+
const half = Math.min(pillWidth, plot.width) / 2;
|
|
1814
|
+
return {
|
|
1815
|
+
x,
|
|
1816
|
+
width,
|
|
1817
|
+
top: plot.top,
|
|
1818
|
+
height: plot.height,
|
|
1819
|
+
label,
|
|
1820
|
+
pillWidth,
|
|
1821
|
+
pillX: Math.min(Math.max(x + width / 2, plot.left + half), plot.left + plot.width - half),
|
|
1822
|
+
pillY: plot.top - RANGE_PILL_RISE,
|
|
1823
|
+
};
|
|
1824
|
+
}, ...(ngDevMode ? [{ debugName: "rangeBand" }] : /* istanbul ignore next */ []));
|
|
1825
|
+
/** Under the category cursor the highest reading at the category, or the one the keyboard picked;
|
|
1826
|
+
* otherwise the reading of the mark answering the pointer or focus. */
|
|
1827
|
+
activeReadout = computed(() => {
|
|
1828
|
+
if (this.cursorOn()) {
|
|
1829
|
+
const categoryIndex = this.activeIndex();
|
|
1830
|
+
if (categoryIndex < 0) {
|
|
1831
|
+
return null;
|
|
1832
|
+
}
|
|
1833
|
+
const top = this.pickedReading()?.entry ??
|
|
1834
|
+
highestReading([...this.tooltipSources().values()].flatMap((source) => source.axisEntries?.() ?? []));
|
|
1835
|
+
return top?.y === undefined
|
|
1836
|
+
? null
|
|
1837
|
+
: { categoryIndex, y: top.y, axis: top.axis };
|
|
1838
|
+
}
|
|
1839
|
+
for (const source of this.tooltipSources().values()) {
|
|
1840
|
+
const readout = source.axisReadout?.();
|
|
1841
|
+
if (readout) {
|
|
1842
|
+
return readout;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return null;
|
|
1846
|
+
}, ...(ngDevMode ? [{ debugName: "activeReadout" }] : /* istanbul ignore next */ []));
|
|
1847
|
+
readoutTextWidth = signal(0, ...(ngDevMode ? [{ debugName: "readoutTextWidth" }] : /* istanbul ignore next */ []));
|
|
1848
|
+
/** A guide from the value axis at the active reading, and the axis value there in a pill on the axis. */
|
|
1849
|
+
shownReadout = computed(() => {
|
|
1850
|
+
const readout = this.showAxisReadout() ? this.activeReadout() : null;
|
|
1851
|
+
if (!readout) {
|
|
1852
|
+
return null;
|
|
1853
|
+
}
|
|
1854
|
+
const secondary = readout.axis === 'secondary' && this.hasSecondaryAxis();
|
|
1855
|
+
const plot = secondary ? this.secondaryPlot() : this.plot();
|
|
1856
|
+
const domain = secondary ? this.secondary().domain : this.domain();
|
|
1857
|
+
const share = plot.height > 0 ? (plot.top + plot.height - readout.y) / plot.height : 0;
|
|
1858
|
+
// Rounded off the float noise the inversion adds, so a reading of 620 prints as 620.
|
|
1859
|
+
const value = Math.round((domain.min + share * (domain.max - domain.min)) * 1e6) / 1e6;
|
|
1860
|
+
const onRight = secondary && !this.stacked();
|
|
1861
|
+
const half = this.bandWidth() / 2;
|
|
1862
|
+
const centre = this.xPosition()(readout.categoryIndex);
|
|
1863
|
+
const toMark = readout.reach === 'mark';
|
|
1864
|
+
const pillWidth = this.readoutTextWidth() + 2 * PILL_PADDING;
|
|
1865
|
+
const format = this.valueFormatResolved();
|
|
1866
|
+
return {
|
|
1867
|
+
categoryIndex: readout.categoryIndex,
|
|
1868
|
+
y: readout.y,
|
|
1869
|
+
label: format(value, format.handlesReadout ? 'readout' : 'tooltip'),
|
|
1870
|
+
x1: onRight && toMark ? centre - half : this.plot().left,
|
|
1871
|
+
x2: !onRight && toMark ? centre + half : this.plotRight(),
|
|
1872
|
+
pillWidth,
|
|
1873
|
+
pillX: onRight
|
|
1874
|
+
? this.plotRight() + READOUT_PILL_GAP
|
|
1875
|
+
: this.plot().left - READOUT_PILL_GAP - pillWidth,
|
|
1876
|
+
};
|
|
1877
|
+
}, ...(ngDevMode ? [{ debugName: "shownReadout" }] : /* istanbul ignore next */ []));
|
|
1878
|
+
hotCategory = computed(() => this.shownReadout()?.categoryIndex ?? -1, ...(ngDevMode ? [{ debugName: "hotCategory" }] : /* istanbul ignore next */ []));
|
|
1879
|
+
bandElement = viewChild('cursorBandEl', ...(ngDevMode ? [{ debugName: "bandElement" }] : /* istanbul ignore next */ []));
|
|
1880
|
+
cursorOrigin = computed(() => this.cursorBand() ? (this.bandElement()?.nativeElement ?? null) : null, ...(ngDevMode ? [{ debugName: "cursorOrigin" }] : /* istanbul ignore next */ []));
|
|
1881
|
+
keyboardStops = computed(() => this.cursorOn() && this.interactive(), ...(ngDevMode ? [{ debugName: "keyboardStops" }] : /* istanbul ignore next */ []));
|
|
1882
|
+
roving = signal(0, ...(ngDevMode ? [{ debugName: "roving" }] : /* istanbul ignore next */ []));
|
|
1883
|
+
refocusStop = false;
|
|
1884
|
+
focusedCategory = computed(() => Math.min(this.roving(), Math.max(0, this.categories().length - 1)), ...(ngDevMode ? [{ debugName: "focusedCategory" }] : /* istanbul ignore next */ []));
|
|
1885
|
+
focusedStopX = computed(() => this.xPosition()(this.focusedCategory()) - this.bandWidth() / 2, ...(ngDevMode ? [{ debugName: "focusedStopX" }] : /* istanbul ignore next */ []));
|
|
1886
|
+
categoryStops = computed(() => {
|
|
1887
|
+
const toX = this.xPosition();
|
|
1888
|
+
const width = this.bandWidth();
|
|
1889
|
+
return this.categories().map((category, index) => ({
|
|
1890
|
+
index,
|
|
1891
|
+
category,
|
|
1892
|
+
x: toX(index) - width / 2,
|
|
1893
|
+
width,
|
|
1894
|
+
}));
|
|
1895
|
+
}, ...(ngDevMode ? [{ debugName: "categoryStops" }] : /* istanbul ignore next */ []));
|
|
1896
|
+
// Only the active category's readings are known; a stop is named once the cursor is on it, which focusing it does first.
|
|
1897
|
+
stopLabel(index) {
|
|
1898
|
+
const category = this.categories()[index] ?? '';
|
|
1899
|
+
const context = this.activeIndex() === index ? this.categoryContext() : null;
|
|
1900
|
+
const readings = context?.entries.map((entry) => `${entry.label} ${entry.formatted ?? entry.value}`) ?? [];
|
|
1901
|
+
return readings.length ? `${category}: ${readings.join(', ')}` : category;
|
|
1902
|
+
}
|
|
1903
|
+
onStopFocus(index, event) {
|
|
1904
|
+
this.roving.set(index);
|
|
1905
|
+
this.pickedKey.set(null);
|
|
1906
|
+
this.cursorState.enter(index, event, null, event.target);
|
|
1907
|
+
}
|
|
1908
|
+
leavesChart(event) {
|
|
1909
|
+
const next = event.relatedTarget;
|
|
1910
|
+
return (!(next instanceof Element) || !this.host.nativeElement.contains(next));
|
|
1911
|
+
}
|
|
1912
|
+
onStopBlur(event) {
|
|
1913
|
+
if (this.leavesChart(event)) {
|
|
1914
|
+
this.cursorState.leave();
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
onChartFocusOut(event) {
|
|
1918
|
+
if (this.leavesChart(event)) {
|
|
1919
|
+
this.pickedKey.set(null);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
// Index after focus: the marker losing focus clears the series' cursor index on its way out.
|
|
1923
|
+
// Moving to another band lets a pin go; returning to the held band keeps it.
|
|
1924
|
+
focusStop(index) {
|
|
1925
|
+
this.roving.set(index);
|
|
1926
|
+
this.host.nativeElement
|
|
1927
|
+
.querySelector(`.category-stop[data-category-index="${index}"]`)
|
|
1928
|
+
?.focus();
|
|
1929
|
+
if (this.cursorPinned() && this.activeIndex() !== index) {
|
|
1930
|
+
this.cursorState.release();
|
|
1931
|
+
}
|
|
1932
|
+
this.cursorState.setIndex(index);
|
|
1933
|
+
}
|
|
1934
|
+
keyboardFocusInside() {
|
|
1935
|
+
const focused = this.host.nativeElement.ownerDocument.activeElement;
|
|
1936
|
+
return (this.keyboardStops() &&
|
|
1937
|
+
focused !== null &&
|
|
1938
|
+
this.host.nativeElement.contains(focused) &&
|
|
1939
|
+
focused.closest('.category-stop, [data-mark-index]') !== null);
|
|
1940
|
+
}
|
|
1941
|
+
// Ahead of the pin's own document-capture Escape, which would release the pin before the marker steps back.
|
|
1942
|
+
stepBackOnEscape = this.listenForEscapeFromMarker();
|
|
1943
|
+
listenForEscapeFromMarker() {
|
|
1944
|
+
if (!this.isBrowser) {
|
|
1945
|
+
return;
|
|
1193
1946
|
}
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1947
|
+
const document = this.host.nativeElement.ownerDocument;
|
|
1948
|
+
const onKey = (event) => {
|
|
1949
|
+
const target = event.target;
|
|
1950
|
+
if (event.key !== 'Escape' ||
|
|
1951
|
+
!this.keyboardStops() ||
|
|
1952
|
+
!this.cursorPinned() ||
|
|
1953
|
+
!(target instanceof Element) ||
|
|
1954
|
+
!this.host.nativeElement.contains(target) ||
|
|
1955
|
+
target.closest('.category-stop') !== null ||
|
|
1956
|
+
target.closest('[data-mark-index]') === null) {
|
|
1957
|
+
return;
|
|
1958
|
+
}
|
|
1959
|
+
event.stopImmediatePropagation();
|
|
1960
|
+
event.preventDefault();
|
|
1961
|
+
this.pickedKey.set(null);
|
|
1962
|
+
this.focusStop(this.focusedCategory());
|
|
1963
|
+
};
|
|
1964
|
+
document.addEventListener('keydown', onKey, true);
|
|
1965
|
+
inject(DestroyRef).onDestroy(() => document.removeEventListener('keydown', onKey, true));
|
|
1196
1966
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1967
|
+
// Held by the canvas, as a pointer pin is: a press on the band then releases it instead of re-pinning.
|
|
1968
|
+
pinFromKeyboard(index, event) {
|
|
1969
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1970
|
+
this.cursorState.pin(index, event, null, canvas);
|
|
1199
1971
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1972
|
+
readingsTopDown() {
|
|
1973
|
+
return ([...this.tooltipSources()]
|
|
1974
|
+
.flatMap(([sourceId, source]) => {
|
|
1975
|
+
const elements = source.axisPointElements?.() ?? [];
|
|
1976
|
+
return (source.axisEntries?.() ?? []).map((entry, index) => ({
|
|
1977
|
+
key: `${sourceId}:${index}`,
|
|
1978
|
+
entry,
|
|
1979
|
+
element: elements[index] ?? null,
|
|
1980
|
+
}));
|
|
1981
|
+
})
|
|
1982
|
+
// A mark without `interactive` has no tabindex and would swallow the focus call.
|
|
1983
|
+
.filter((reading) => reading.element?.hasAttribute('tabindex') ?? false)
|
|
1984
|
+
.sort((a, b) => (a.entry.y ?? 0) - (b.entry.y ?? 0)));
|
|
1985
|
+
}
|
|
1986
|
+
onChartKey(event) {
|
|
1987
|
+
if (!this.keyboardStops() || !(event.target instanceof Element)) {
|
|
1205
1988
|
return;
|
|
1206
1989
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1990
|
+
const onStop = event.target.closest('.category-stop') !== null;
|
|
1991
|
+
const fromMarker = !onStop && event.target.closest('[data-mark-index]') !== null;
|
|
1992
|
+
if (!onStop && !fromMarker) {
|
|
1993
|
+
return;
|
|
1210
1994
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1995
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
1996
|
+
event.preventDefault();
|
|
1997
|
+
// The pointer may have moved or pinned the cursor elsewhere, or Escape cleared it, since the stop took focus.
|
|
1998
|
+
if (this.cursorPinned() &&
|
|
1999
|
+
this.activeIndex() !== this.focusedCategory()) {
|
|
2000
|
+
this.cursorState.release();
|
|
2001
|
+
}
|
|
2002
|
+
this.cursorState.setIndex(this.focusedCategory());
|
|
2003
|
+
const readings = this.readingsTopDown();
|
|
2004
|
+
if (readings.length === 0) {
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
const at = readings.findIndex((reading) => reading.key === this.pickedKey());
|
|
2008
|
+
const step = event.key === 'ArrowDown' ? 1 : readings.length - 1;
|
|
2009
|
+
const next = at < 0
|
|
2010
|
+
? event.key === 'ArrowDown'
|
|
2011
|
+
? 0
|
|
2012
|
+
: readings.length - 1
|
|
2013
|
+
: (at + step) % readings.length;
|
|
2014
|
+
this.pickedKey.set(readings[next].key);
|
|
2015
|
+
readings[next].element.focus();
|
|
2016
|
+
return;
|
|
1216
2017
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
const hit = markOf(event);
|
|
1220
|
-
const next = event.relatedTarget instanceof Element
|
|
1221
|
-
? event.relatedTarget.closest('[data-mark-index]')
|
|
1222
|
-
: null;
|
|
1223
|
-
if (hit && next !== hit.element && !this.scales.cursorOn?.()) {
|
|
1224
|
-
this.activeMark.leave();
|
|
2018
|
+
if (!fromMarker) {
|
|
2019
|
+
return;
|
|
1225
2020
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
2021
|
+
if (event.key === 'Tab') {
|
|
2022
|
+
// Moved before the browser acts, so Tab leaves from the stop: a marker sits before it in the DOM.
|
|
2023
|
+
this.focusStop(this.focusedCategory());
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
const next = event.key === 'Escape'
|
|
2027
|
+
? this.focusedCategory()
|
|
2028
|
+
: nextRovingIndex(event.key, this.focusedCategory(), this.categories().length);
|
|
2029
|
+
if (next !== null) {
|
|
2030
|
+
event.preventDefault();
|
|
2031
|
+
this.focusStop(next);
|
|
1232
2032
|
}
|
|
1233
|
-
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1234
2033
|
}
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
|
|
2034
|
+
onStopKey(event) {
|
|
2035
|
+
const current = this.focusedCategory();
|
|
2036
|
+
const next = event.key === 'ArrowUp' || event.key === 'ArrowDown'
|
|
2037
|
+
? null
|
|
2038
|
+
: nextRovingIndex(event.key, current, this.categories().length);
|
|
2039
|
+
if (next !== null) {
|
|
2040
|
+
event.preventDefault();
|
|
2041
|
+
this.focusStop(next);
|
|
1238
2042
|
return;
|
|
1239
2043
|
}
|
|
1240
2044
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
event.preventDefault();
|
|
1245
|
-
this.pointClicked.emit(mark.point);
|
|
2045
|
+
event.preventDefault();
|
|
2046
|
+
if (this.pinOnClickResolved()) {
|
|
2047
|
+
this.pinFromKeyboard(current, event);
|
|
1246
2048
|
}
|
|
1247
|
-
return;
|
|
1248
2049
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
2050
|
+
else if (event.key === 'Escape') {
|
|
2051
|
+
this.cursorState.release();
|
|
2052
|
+
this.cursorState.leave();
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
// Captured ahead of a series' own arrow keys, which would otherwise move focus without the range.
|
|
2056
|
+
extendRangeFromKeys = this.listenForRangeKeys();
|
|
2057
|
+
listenForRangeKeys() {
|
|
2058
|
+
if (!this.isBrowser) {
|
|
1251
2059
|
return;
|
|
1252
2060
|
}
|
|
1253
|
-
|
|
2061
|
+
const host = this.host.nativeElement;
|
|
2062
|
+
const onKey = (event) => {
|
|
2063
|
+
const target = event.target;
|
|
2064
|
+
if (!this.selectRange() ||
|
|
2065
|
+
!event.shiftKey ||
|
|
2066
|
+
(event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') ||
|
|
2067
|
+
!(target instanceof Element)) {
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
2070
|
+
const stop = target.closest('.category-stop');
|
|
2071
|
+
const mark = stop ? null : target.closest('[data-mark-index]');
|
|
2072
|
+
// A column's mark index is its category; a line marker reports its category as it takes focus.
|
|
2073
|
+
const current = stop
|
|
2074
|
+
? this.focusedCategory()
|
|
2075
|
+
: mark?.hasAttribute('data-point-key')
|
|
2076
|
+
? this.activeIndex()
|
|
2077
|
+
: Number(mark?.getAttribute('data-mark-index') ?? -1);
|
|
2078
|
+
if ((!stop && !mark) || current < 0) {
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
event.preventDefault();
|
|
2082
|
+
event.stopPropagation();
|
|
2083
|
+
const next = this.extendRange(current, event.key === 'ArrowRight' ? 1 : -1);
|
|
2084
|
+
if (next === current) {
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
if (stop) {
|
|
2088
|
+
this.focusStop(next);
|
|
2089
|
+
}
|
|
2090
|
+
else if (mark) {
|
|
2091
|
+
this.markInCategory(mark, current, next)?.focus();
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
host.addEventListener('keydown', onKey, true);
|
|
2095
|
+
inject(DestroyRef).onDestroy(() => host.removeEventListener('keydown', onKey, true));
|
|
2096
|
+
}
|
|
2097
|
+
// Grows or shrinks the range from its far end; from a category outside the range's ends, a new one
|
|
2098
|
+
// starts there. Returns the category the far end moved to.
|
|
2099
|
+
extendRange(current, step) {
|
|
2100
|
+
const next = Math.min(Math.max(current + step, 0), this.categories().length - 1);
|
|
2101
|
+
const range = this.range();
|
|
2102
|
+
const anchor = range && current === range.to
|
|
2103
|
+
? range.from
|
|
2104
|
+
: range && current === range.from
|
|
2105
|
+
? range.to
|
|
2106
|
+
: current;
|
|
2107
|
+
this.range.set({
|
|
2108
|
+
from: Math.min(anchor, next),
|
|
2109
|
+
to: Math.max(anchor, next),
|
|
2110
|
+
});
|
|
2111
|
+
return next;
|
|
1254
2112
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
2113
|
+
// The same series' mark at another category: a column is indexed by its category, a line marker keyed by it.
|
|
2114
|
+
markInCategory(mark, current, next) {
|
|
2115
|
+
const pointKey = mark.getAttribute('data-point-key');
|
|
2116
|
+
if (pointKey === null) {
|
|
2117
|
+
return (mark.parentElement?.querySelector(`:scope > [data-mark-index="${next}"]`) ?? null);
|
|
2118
|
+
}
|
|
2119
|
+
const keys = categoryKeys(this.categories());
|
|
2120
|
+
const seriesId = pointKey.slice(0, -(keys[current].length + 1));
|
|
2121
|
+
return (mark.parentElement?.querySelector(`[data-point-key="${CSS.escape(`${seriesId}-${keys[next]}`)}"]`) ?? null);
|
|
1257
2122
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
2123
|
+
setActiveIndex(index) {
|
|
2124
|
+
this.cursorState.setIndex(this.clampIndex(index));
|
|
2125
|
+
}
|
|
2126
|
+
clampIndex(index) {
|
|
2127
|
+
const last = this.categories().length - 1;
|
|
2128
|
+
return Number.isFinite(index)
|
|
2129
|
+
? Math.min(Math.max(Math.trunc(index), -1), last)
|
|
2130
|
+
: -1;
|
|
2131
|
+
}
|
|
2132
|
+
plotRight = computed(() => this.plot().left + this.plot().width, ...(ngDevMode ? [{ debugName: "plotRight" }] : /* istanbul ignore next */ []));
|
|
2133
|
+
plotBottom = computed(() => this.plot().top + this.plot().height, ...(ngDevMode ? [{ debugName: "plotBottom" }] : /* istanbul ignore next */ []));
|
|
2134
|
+
axisLabelX = computed(() => this.plot().left - CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "axisLabelX" }] : /* istanbul ignore next */ []));
|
|
2135
|
+
/** Clears the reservation the view height budgets, only when it is there; otherwise the labels fall past the viewBox. */
|
|
2136
|
+
categoryLabelY = computed(() => this.secondaryPlotBottom() +
|
|
2137
|
+
(this.reachesBelowZero() ? this.valueSpace() : 0) +
|
|
2138
|
+
CHART_CATEGORY_LABEL_OFFSET, ...(ngDevMode ? [{ debugName: "categoryLabelY" }] : /* istanbul ignore next */ []));
|
|
2139
|
+
ticks = computed(() => {
|
|
2140
|
+
const domain = this.domain();
|
|
2141
|
+
const toY = this.yPosition();
|
|
2142
|
+
const format = this.valueFormatResolved();
|
|
2143
|
+
return tickValues(domain.min, domain.max, this.tickCount()).map((value) => ({
|
|
2144
|
+
value,
|
|
2145
|
+
y: toY(value),
|
|
2146
|
+
label: format(value, 'tick'),
|
|
2147
|
+
}));
|
|
2148
|
+
}, ...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
2149
|
+
labelTexts = computed(() => [
|
|
2150
|
+
...this.ticks().map((tick) => tick.label),
|
|
2151
|
+
...this.secondaryTicks().map((tick) => tick.label),
|
|
2152
|
+
...this.categories(),
|
|
2153
|
+
].join('\n'), ...(ngDevMode ? [{ debugName: "labelTexts" }] : /* istanbul ignore next */ []));
|
|
2154
|
+
/** Rotation is tried before thinning; both use the widest label as rendered. */
|
|
2155
|
+
categoryLabelsRotated = computed(() => rotationWouldFit([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length)), ...(ngDevMode ? [{ debugName: "categoryLabelsRotated" }] : /* istanbul ignore next */ []));
|
|
2156
|
+
categoryLabelInterval = computed(() => labelInterval([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length), this.categoryLabelsRotated()), ...(ngDevMode ? [{ debugName: "categoryLabelInterval" }] : /* istanbul ignore next */ []));
|
|
2157
|
+
labelHovered = signal(null, ...(ngDevMode ? [{ debugName: "labelHovered" }] : /* istanbul ignore next */ []));
|
|
2158
|
+
categoryLabelHover = this.labelHovered.asReadonly();
|
|
2159
|
+
onCategoryLabelEnter(index, event) {
|
|
2160
|
+
if (!this.cursorOn()) {
|
|
2161
|
+
this.labelHovered.set({ index, event });
|
|
1264
2162
|
}
|
|
1265
|
-
|
|
2163
|
+
}
|
|
2164
|
+
onCategoryLabelLeave() {
|
|
2165
|
+
this.labelHovered.set(null);
|
|
2166
|
+
}
|
|
2167
|
+
categoryLabels = computed(() => {
|
|
2168
|
+
const toX = this.xPosition();
|
|
2169
|
+
const interval = this.categoryLabelInterval();
|
|
2170
|
+
const keys = categoryKeys(this.categories());
|
|
2171
|
+
return this.categories()
|
|
2172
|
+
.map((text, index) => ({ x: toX(index), text, index, key: keys[index] }))
|
|
2173
|
+
.filter((label) => label.index % interval === 0);
|
|
2174
|
+
}, ...(ngDevMode ? [{ debugName: "categoryLabels" }] : /* istanbul ignore next */ []));
|
|
2175
|
+
reachesBelowZero = computed(() => this.domain().min < 0, ...(ngDevMode ? [{ debugName: "reachesBelowZero" }] : /* istanbul ignore next */ []));
|
|
2176
|
+
/** Read off `categories` alone: the marks are projected into the branch this decides, so waiting for a report would deadlock. */
|
|
2177
|
+
isEmpty = computed(() => this.categories().length === 0, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
2178
|
+
accessibleName = computed(() => this.summary() ?? this.caption() ?? this.intl().chart.title, ...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
2179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2180
|
+
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 }, skeletonCount: { classPropertyName: "skeletonCount", publicName: "skeletonCount", 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 }, cursor: { classPropertyName: "cursor", publicName: "cursor", isSignal: true, isRequired: false, transformFunction: null }, rescaleOnHide: { classPropertyName: "rescaleOnHide", publicName: "rescaleOnHide", isSignal: true, isRequired: false, transformFunction: null }, maxSecondary: { classPropertyName: "maxSecondary", publicName: "maxSecondary", 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 }, 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 }, axisLabel: { classPropertyName: "axisLabel", publicName: "axisLabel", isSignal: true, isRequired: false, transformFunction: null }, secondaryAxisLabel: { classPropertyName: "secondaryAxisLabel", publicName: "secondaryAxisLabel", isSignal: true, isRequired: false, transformFunction: null }, selectRange: { classPropertyName: "selectRange", publicName: "selectRange", isSignal: true, isRequired: false, transformFunction: null }, showAxisReadout: { classPropertyName: "showAxisReadout", publicName: "showAxisReadout", isSignal: true, isRequired: false, transformFunction: null }, tooltipTemplate: { classPropertyName: "tooltipTemplate", publicName: "tooltipTemplate", isSignal: true, isRequired: false, transformFunction: null }, tooltipExtraGap: { classPropertyName: "tooltipExtraGap", publicName: "tooltipExtraGap", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onChartKey($event)", "focusout": "onChartFocusOut($event)" }, properties: { "class.framed": "frameResolved() === 'auto'", "class.measuring": "!settled()", "style.--_chart-view-height": "viewHeight() + 'px'" } }, providers: [
|
|
1266
2181
|
{
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
formatted: mark.formattedValue,
|
|
1270
|
-
color: mark.color,
|
|
1271
|
-
hatched: mark.hatched,
|
|
1272
|
-
detail: this.shareDetail(categoryIndex),
|
|
1273
|
-
y: mark.tip,
|
|
2182
|
+
provide: CHART_SCALES,
|
|
2183
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
1274
2184
|
},
|
|
1275
|
-
];
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
{
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
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 }, soleSeries: { classPropertyName: "soleSeries", publicName: "soleSeries", isSignal: true, isRequired: false, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", 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 }, seriesKey: { classPropertyName: "seriesKey", publicName: "seriesKey", isSignal: true, isRequired: false, transformFunction: null }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClicked: "pointClicked" }, viewQueries: [{ propertyName: "barElements", predicate: ["barEl"], descendants: true, isSignal: true }], exportAs: ["dsColumnSeries"], ngImport: i0, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-dimmed]=\"dimmedBySeries()\"\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 (pointerover)=\"onMarkOver($event)\"\n (pointerout)=\"onMarkOut($event)\"\n (keydown)=\"onMarkKey($event)\"\n (click)=\"onMarkClick($event)\">\n <!-- `userSpaceOnUse` keeps the stripe pitch equal on tall and short columns (the object bounding box\n scales it per mark). The stripe runs down the tile's middle: on its edge the tile clips it to half. -->\n @if (hatchInUse()) {\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=\"4\"\n y1=\"0\"\n x2=\"4\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n }\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"activeMark.index() === index\"\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()\n ? !scales.cursorOn?.() && index === roving.tabStop()\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() ? entryLabel(mark) : null\"\n (animate.leave)=\"leaveMark($event)\">\n <!-- The pointer target is the whole category slot, so a two-pixel column stays reachable. -->\n @let hit = hitBox(mark);\n\n <svg:rect\n class=\"hit-area\"\n [attr.y]=\"hit.y\"\n [attr.height]=\"hit.height\" />\n\n <svg:g\n #barEl\n class=\"bar\"\n [style.transform-origin]=\"mark.origin\">\n <!-- `rx` rounds all four corners but the cap belongs on the free end alone; this rect fills the\n two baseline corners back in. Unlike a `<path>`, both keep `y` and `height` interpolable. -->\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 as its fill: a pattern carries its own colour,\n so one shared definition could not take each mark's. -->\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 dsChartPinMarker\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\" />\n }\n </svg:g>\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.column .bar{transform-origin:bottom}.bar{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-grow-duration) var(--ds-motion-chart-mark-grow-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.bar{animation-delay:0ms}}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.value{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-grow-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.value{animation-delay:0ms}}@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.is-active) .column:not(.is-active),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive,.columns .column.pins{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) );--_chart-hatch-color: var( --ds-chart-hatch-color, var(--ds-chart-bg-color) );--_chart-hatch-width: var(--ds-chart-hatch-width, 1.5px)}.column{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_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{--_column-hit-start: calc( var(--_column-chart-slot-step) * (var(--_column-slot, 0) - var(--_column-slots, 1) / 2) );width:var(--_column-chart-slot-step);x:calc(var(--_column-hit-start) - var(--_column-slot-offset));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(--_chart-hatch-color);stroke-width:var(--_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, var(--ds-chart-bg-color)))}@media(forced-colors:active){.column.interactive:focus-visible .bar-cap{stroke:Highlight;filter:none}}.columns.is-dimmed{opacity:var(--ds-chart-dim-opacity);transition:opacity var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}\n"], dependencies: [{ kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2185
|
+
], queries: [{ propertyName: "lineSeries", predicate: LineSeriesComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "canvasElement", first: true, predicate: ["canvasEl"], descendants: true, isSignal: true }, { propertyName: "bandElement", first: true, predicate: ["cursorBandEl"], descendants: true, isSignal: true }], exportAs: ["dsChart"], usesInheritance: true, ngImport: i0, template: "<figure\n class=\"chart\"\n dsChartStates\n morphGrowth=\"up\"\n messageAxes\n [unpin]=\"drawsUnpin\"\n [pinned]=\"cursorPinned()\"\n [caption]=\"caption()\"\n [error]=\"error()\"\n [errorText]=\"errorTextResolved()\"\n [pending]=\"(loading() && isEmpty()) || !renderReady()\"\n [reloading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <ds-chart-skeleton\n [count]=\"skeletonMarks()\"\n [plotHeight]=\"plotHeight() + 'px'\"\n [valueSpace]=\"valueSpace()\"\n [axisGutter]=\"axisGutter()\"\n [shimmer]=\"loading()\" />\n</ng-template>\n\n<ng-template #body>\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipSwatches]=\"tooltipSwatchesResolved()\"\n [dsChartTooltipExtraGap]=\"tooltipGap()\"\n [dsChartTooltipPinned]=\"tooltipPinned()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate()\">\n <svg\n #canvasEl\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [class.pins]=\"bandPins()\"\n [class.selects-range]=\"selectRange()\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <rect\n class=\"plot-bg\"\n [attr.x]=\"plot().left\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"plot().width\"\n [attr.height]=\"plot().height\" />\n\n @if (secondaryPlot().top !== plot().top) {\n <rect\n class=\"plot-bg\"\n [attr.x]=\"secondaryPlot().left\"\n [attr.y]=\"secondaryPlot().top\"\n [attr.width]=\"secondaryPlot().width\"\n [attr.height]=\"secondaryPlot().height\" />\n }\n\n @if (cursorBand(); as band) {\n <rect\n #cursorBandEl\n class=\"cursor-anchor\"\n aria-hidden=\"true\"\n [class.on-reading]=\"readingY() !== null\"\n [style.--_reading-y.px]=\"readingY()\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n }\n\n @if (highlightBand(); as band) {\n <g\n class=\"cursor\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateX(' + band.x + 'px)'\">\n <rect\n class=\"category-band\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n\n <line\n class=\"cursor-line\"\n [attr.x1]=\"band.width / 2\"\n [attr.x2]=\"band.width / 2\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n </g>\n }\n\n @if (\n pinnedLine() &&\n cursorPinned() &&\n cursorBand(); as band\n ) {\n <line\n class=\"cursor-line pinned-line\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateX(' + (band.x + band.width / 2) + 'px)'\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n }\n\n <!-- Not on the svg: an aria-hidden ancestor leaves a focusable projected mark\n reachable by Tab yet 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 [style.transform]=\"'translateY(' + tick.y + 'px)'\" />\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\" />\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 @if (rangeBand(); as range) {\n <rect\n class=\"range-band\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [attr.x]=\"range.x\"\n [attr.y]=\"range.top\"\n [attr.width]=\"range.width\"\n [attr.height]=\"range.height\" />\n }\n\n @if (shownReadout(); as readout) {\n <g\n class=\"readout\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateY(' + readout.y + 'px)'\">\n <line\n class=\"readout-guide\"\n [attr.x1]=\"readout.x1\"\n [attr.x2]=\"readout.x2\" />\n </g>\n }\n\n <!-- Two slots so a reference line paints under the marks in any source order. Both stay\n inside `.marks`, which the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <!-- After the marks, so a stop's ring paints over them. -->\n @if (keyboardStops()) {\n <g\n class=\"category-stops\"\n (keydown)=\"onStopKey($event)\">\n @for (stop of categoryStops(); track stop.index) {\n <rect\n class=\"category-stop\"\n [attr.data-category-index]=\"stop.index\"\n [attr.x]=\"stop.x\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"stop.width\"\n [attr.height]=\"plot().height\"\n [attr.tabindex]=\"stop.index === focusedCategory() ? 0 : -1\"\n [attr.aria-label]=\"stopLabel(stop.index)\"\n (focus)=\"onStopFocus(stop.index, $event)\"\n (blur)=\"onStopBlur($event)\" />\n }\n\n <!-- One ring for every stop, so focus glides to the next category with the panel. -->\n <rect\n class=\"stop-ring\"\n aria-hidden=\"true\"\n dsChartPlaced\n [attr.y]=\"plot().top\"\n [attr.width]=\"bandWidth()\"\n [attr.height]=\"plot().height\"\n [style.transform]=\"'translateX(' + focusedStopX() + 'px)'\" />\n </g>\n }\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @if (axisLabel()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"axisLabelFill()\"\n [attr.transform]=\"\n 'rotate(-90 ' +\n axisTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"axisTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ axisLabel() }}\n </text>\n }\n\n @if (secondaryAxisLabel() && hasSecondaryAxis()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.transform]=\"\n 'rotate(90 ' +\n secondaryTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"secondaryTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ secondaryAxisLabel() }}\n </text>\n }\n\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\">\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\">\n {{ tick.label }}\n </text>\n }\n\n <!-- Keyed by category and placed by `transform`, so a label glides with its column when\n another category comes or goes. -->\n @for (label of categoryLabels(); track label.key) {\n <text\n class=\"category-label\"\n [class.is-hot]=\"label.index === hotCategory()\"\n [class.is-rotated]=\"categoryLabelsRotated()\"\n [attr.text-anchor]=\"categoryLabelsRotated() ? 'end' : 'middle'\"\n [style.transform]=\"\n 'translate(' +\n label.x +\n 'px, ' +\n categoryLabelY() +\n 'px)' +\n (categoryLabelsRotated() ? ' rotate(-45deg)' : '')\n \"\n (animate.leave)=\"leaveMark($event)\"\n (pointerenter)=\"onCategoryLabelEnter(label.index, $event)\"\n (pointerleave)=\"onCategoryLabelLeave()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks so an annotation's name survives a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel], [dsSeriesAnnotation]\" />\n </g>\n\n <!-- Over the tick labels it covers; its guide stays under the marks. -->\n @if (shownReadout(); as readout) {\n <g\n class=\"readout\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateY(' + readout.y + 'px)'\">\n <rect\n class=\"pill\"\n [attr.x]=\"readout.pillX\"\n [attr.width]=\"readout.pillWidth\" />\n\n <text\n class=\"readout-text pill-text\"\n text-anchor=\"middle\"\n [attr.x]=\"readout.pillX + readout.pillWidth / 2\">\n {{ readout.label }}\n </text>\n </g>\n }\n\n @if (rangeBand(); as range) {\n <g\n class=\"range-pill\"\n aria-hidden=\"true\"\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"\n 'translate(' + range.pillX + 'px, ' + range.pillY + 'px)'\n \">\n <rect\n class=\"pill\"\n [attr.x]=\"-range.pillWidth / 2\"\n [attr.width]=\"range.pillWidth\" />\n\n <text\n class=\"range-text pill-text\"\n text-anchor=\"middle\">\n {{ range.label }}\n </text>\n </g>\n }\n\n <!-- Keyed by category: another category takes a new pin that pops in; the same one glides with the data. -->\n @for (pinnedCategory of pinnedCategories(); track pinnedCategory) {\n @if (cursorBand(); as band) {\n <g\n class=\"band-pin\"\n [style.transform]=\"\n 'translateX(' + (band.x + band.width / 2) + 'px)'\n \">\n <g\n dsChartPinMarker\n [attr.transform]=\"'translate(0,' + bandPinY() + ')'\">\n </g>\n </g>\n }\n }\n </svg>\n </div>\n</ng-template>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),: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, var(--ds-chart-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{-webkit-user-select:text;user-select:text}.empty-text.is-error{color:var(--error)}:host{position:relative}:host(.framed){--_chart-pin-reset-inset: var(--ds-chart-frame-padding)}.category-label.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.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}:host{--_chart-message-height: var(--_chart-view-height)}.canvas{display:block;inline-size:100%}.canvas.pins{cursor:pointer}:host(.measuring) .marks ::ng-deep *,:host(.measuring) .axes *,:host(.measuring) .labels *,:host(.measuring) .cursor,:host(.measuring) .cursor *,:host(.measuring) .band-pin,:host(.measuring) .band-pin *,:host(.measuring) .readout,:host(.measuring) .range-band,:host(.measuring) .stop-ring{transition-duration:0ms!important}.grid-line,.axis-label{transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.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)}.category-label.is-rotated{dominant-baseline:middle}.axis-title{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold)}.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}}.cursor.placed,.pinned-line.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.cursor-in{animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.cursor-out{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.category-band{fill:var(--ds-chart-hover-bg-color)}.cursor-anchor{fill:none;pointer-events:none}.cursor-anchor.on-reading{y:calc(var(--_reading-y) - var(--ds-chart-dot-radius));height:calc(2 * var(--ds-chart-dot-radius))}.category-stop{fill:transparent;pointer-events:none}@media not (forced-colors:active){.category-stop:focus{outline:none}}@media not (forced-colors:active){.category-stop:focus-visible{outline:none}}.stop-ring{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, var(--ds-chart-bg-color)));fill:none;opacity:0;pointer-events:none;transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.stop-ring.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.category-stops:has(.category-stop:focus-visible) .stop-ring{opacity:1}@media(forced-colors:active){.stop-ring{display:none}}.category-label{transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),fill var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),font-weight var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.category-label.is-hot{fill:var(--text-primary);font-weight:var(--font-weight-bold)}.readout.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.readout,.range-pill{pointer-events:none}.readout-guide{stroke:var(--ds-chart-cursor-line-color);stroke-width:1;stroke-dasharray:3 3}.pill{y:-8px;height:16px;rx:var(--radius-sm);fill:var(--text-primary)}.pill-text{fill:var(--surface-default);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold);dominant-baseline:central}.range-band{rx:var(--radius-sm);fill:var(--accent);fill-opacity:.08;stroke:var(--accent);stroke-opacity:.4;pointer-events:none}.range-band.placed{transition:x var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),width var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.canvas.selects-range{touch-action:pan-y}@media(forced-colors:active){.pill{fill:CanvasText}.pill-text{fill:Canvas}.range-band{stroke:Highlight}}.cursor-line{stroke:var(--ds-chart-cursor-line-color);stroke-width:1}.plot-bg{fill:var(--ds-chart-plot-bg-color, transparent);pointer-events:none}\n"], dependencies: [{ kind: "component", type: ChartSkeletonComponent, selector: "ds-chart-skeleton", inputs: ["marks", "count", "plotHeight", "valueSpace", "axisGutter", "shimmer"] }, { kind: "directive", type: ChartTooltipDirective, selector: "[dsChartTooltip]", inputs: ["dsChartTooltip", "dsChartTooltipOrigin", "dsChartTooltipTemplate", "dsChartTooltipExtraGap", "dsChartTooltipPinned", "dsChartTooltipSwatches"] }, { kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }, { kind: "directive", type: ChartPlacedDirective, selector: "[dsChartPlaced]" }, { kind: "component", type: ChartStatesComponent, selector: "figure[dsChartStates]", inputs: ["unpin", "pinned", "caption", "error", "errorText", "pending", "dataTable", "shimmer", "reloading", "empty", "emptyText", "messageAxes", "skeleton", "body", "message", "morphGrowth"], outputs: ["release"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2186
|
+
}
|
|
2187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, decorators: [{
|
|
2188
|
+
type: Component,
|
|
2189
|
+
args: [{ selector: 'ds-chart', standalone: true, exportAs: 'dsChart', imports: [
|
|
2190
|
+
ChartSkeletonComponent,
|
|
2191
|
+
ChartTooltipDirective,
|
|
2192
|
+
ChartPinMarkerComponent,
|
|
2193
|
+
ChartPlacedDirective,
|
|
2194
|
+
ChartStatesComponent,
|
|
2195
|
+
], host: {
|
|
2196
|
+
'[class.framed]': "frameResolved() === 'auto'",
|
|
2197
|
+
'[class.measuring]': '!settled()',
|
|
2198
|
+
'[style.--_chart-view-height]': "viewHeight() + 'px'",
|
|
2199
|
+
'(keydown)': 'onChartKey($event)',
|
|
2200
|
+
'(focusout)': 'onChartFocusOut($event)',
|
|
2201
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
2202
|
+
{
|
|
2203
|
+
provide: CHART_SCALES,
|
|
2204
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
2205
|
+
},
|
|
2206
|
+
], template: "<figure\n class=\"chart\"\n dsChartStates\n morphGrowth=\"up\"\n messageAxes\n [unpin]=\"drawsUnpin\"\n [pinned]=\"cursorPinned()\"\n [caption]=\"caption()\"\n [error]=\"error()\"\n [errorText]=\"errorTextResolved()\"\n [pending]=\"(loading() && isEmpty()) || !renderReady()\"\n [reloading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <ds-chart-skeleton\n [count]=\"skeletonMarks()\"\n [plotHeight]=\"plotHeight() + 'px'\"\n [valueSpace]=\"valueSpace()\"\n [axisGutter]=\"axisGutter()\"\n [shimmer]=\"loading()\" />\n</ng-template>\n\n<ng-template #body>\n <div\n class=\"plot\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipSwatches]=\"tooltipSwatchesResolved()\"\n [dsChartTooltipExtraGap]=\"tooltipGap()\"\n [dsChartTooltipPinned]=\"tooltipPinned()\"\n [dsChartTooltipOrigin]=\"tooltipOrigin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate()\">\n <svg\n #canvasEl\n class=\"canvas\"\n preserveAspectRatio=\"xMidYMid meet\"\n [class.pins]=\"bandPins()\"\n [class.selects-range]=\"selectRange()\"\n [style.block-size.px]=\"viewHeight()\"\n [attr.viewBox]=\"viewBox()\">\n <rect\n class=\"plot-bg\"\n [attr.x]=\"plot().left\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"plot().width\"\n [attr.height]=\"plot().height\" />\n\n @if (secondaryPlot().top !== plot().top) {\n <rect\n class=\"plot-bg\"\n [attr.x]=\"secondaryPlot().left\"\n [attr.y]=\"secondaryPlot().top\"\n [attr.width]=\"secondaryPlot().width\"\n [attr.height]=\"secondaryPlot().height\" />\n }\n\n @if (cursorBand(); as band) {\n <rect\n #cursorBandEl\n class=\"cursor-anchor\"\n aria-hidden=\"true\"\n [class.on-reading]=\"readingY() !== null\"\n [style.--_reading-y.px]=\"readingY()\"\n [attr.x]=\"band.x\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n }\n\n @if (highlightBand(); as band) {\n <g\n class=\"cursor\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateX(' + band.x + 'px)'\">\n <rect\n class=\"category-band\"\n [attr.y]=\"band.top\"\n [attr.width]=\"band.width\"\n [attr.height]=\"band.bottom - band.top\" />\n\n <line\n class=\"cursor-line\"\n [attr.x1]=\"band.width / 2\"\n [attr.x2]=\"band.width / 2\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n </g>\n }\n\n @if (\n pinnedLine() &&\n cursorPinned() &&\n cursorBand(); as band\n ) {\n <line\n class=\"cursor-line pinned-line\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateX(' + (band.x + band.width / 2) + 'px)'\"\n [attr.y1]=\"band.top\"\n [attr.y2]=\"band.bottom\" />\n }\n\n <!-- Not on the svg: an aria-hidden ancestor leaves a focusable projected mark\n reachable by Tab yet 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 [style.transform]=\"'translateY(' + tick.y + 'px)'\" />\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\" />\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 @if (rangeBand(); as range) {\n <rect\n class=\"range-band\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [attr.x]=\"range.x\"\n [attr.y]=\"range.top\"\n [attr.width]=\"range.width\"\n [attr.height]=\"range.height\" />\n }\n\n @if (shownReadout(); as readout) {\n <g\n class=\"readout\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateY(' + readout.y + 'px)'\">\n <line\n class=\"readout-guide\"\n [attr.x1]=\"readout.x1\"\n [attr.x2]=\"readout.x2\" />\n </g>\n }\n\n <!-- Two slots so a reference line paints under the marks in any source order. Both stay\n inside `.marks`, which the boot transition guard is keyed on. -->\n <g class=\"marks\">\n <ng-content select=\"[dsReferenceLine]\" />\n\n <ng-content />\n </g>\n\n <!-- After the marks, so a stop's ring paints over them. -->\n @if (keyboardStops()) {\n <g\n class=\"category-stops\"\n (keydown)=\"onStopKey($event)\">\n @for (stop of categoryStops(); track stop.index) {\n <rect\n class=\"category-stop\"\n [attr.data-category-index]=\"stop.index\"\n [attr.x]=\"stop.x\"\n [attr.y]=\"plot().top\"\n [attr.width]=\"stop.width\"\n [attr.height]=\"plot().height\"\n [attr.tabindex]=\"stop.index === focusedCategory() ? 0 : -1\"\n [attr.aria-label]=\"stopLabel(stop.index)\"\n (focus)=\"onStopFocus(stop.index, $event)\"\n (blur)=\"onStopBlur($event)\" />\n }\n\n <!-- One ring for every stop, so focus glides to the next category with the panel. -->\n <rect\n class=\"stop-ring\"\n aria-hidden=\"true\"\n dsChartPlaced\n [attr.y]=\"plot().top\"\n [attr.width]=\"bandWidth()\"\n [attr.height]=\"plot().height\"\n [style.transform]=\"'translateX(' + focusedStopX() + 'px)'\" />\n </g>\n }\n\n <g\n class=\"labels\"\n aria-hidden=\"true\">\n @if (axisLabel()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"axisLabelFill()\"\n [attr.transform]=\"\n 'rotate(-90 ' +\n axisTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"axisTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ axisLabel() }}\n </text>\n }\n\n @if (secondaryAxisLabel() && hasSecondaryAxis()) {\n <text\n class=\"axis-title\"\n text-anchor=\"middle\"\n [style.fill]=\"secondaryAxisLabelFill()\"\n [attr.transform]=\"\n 'rotate(90 ' +\n secondaryTitleX() +\n ' ' +\n (plot().top + plot().height / 2) +\n ')'\n \"\n [attr.x]=\"secondaryTitleX()\"\n [attr.y]=\"plot().top + plot().height / 2\">\n {{ secondaryAxisLabel() }}\n </text>\n }\n\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\">\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 [style.transform]=\"'translateY(' + tick.y + 'px)'\">\n {{ tick.label }}\n </text>\n }\n\n <!-- Keyed by category and placed by `transform`, so a label glides with its column when\n another category comes or goes. -->\n @for (label of categoryLabels(); track label.key) {\n <text\n class=\"category-label\"\n [class.is-hot]=\"label.index === hotCategory()\"\n [class.is-rotated]=\"categoryLabelsRotated()\"\n [attr.text-anchor]=\"categoryLabelsRotated() ? 'end' : 'middle'\"\n [style.transform]=\"\n 'translate(' +\n label.x +\n 'px, ' +\n categoryLabelY() +\n 'px)' +\n (categoryLabelsRotated() ? ' rotate(-45deg)' : '')\n \"\n (animate.leave)=\"leaveMark($event)\"\n (pointerenter)=\"onCategoryLabelEnter(label.index, $event)\"\n (pointerleave)=\"onCategoryLabelLeave()\">\n {{ label.text }}\n </text>\n }\n\n <!-- Over the marks so an annotation's name survives a column drawn through it. -->\n <ng-content select=\"[dsReferenceLabel], [dsSeriesAnnotation]\" />\n </g>\n\n <!-- Over the tick labels it covers; its guide stays under the marks. -->\n @if (shownReadout(); as readout) {\n <g\n class=\"readout\"\n aria-hidden=\"true\"\n dsChartPlaced\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"'translateY(' + readout.y + 'px)'\">\n <rect\n class=\"pill\"\n [attr.x]=\"readout.pillX\"\n [attr.width]=\"readout.pillWidth\" />\n\n <text\n class=\"readout-text pill-text\"\n text-anchor=\"middle\"\n [attr.x]=\"readout.pillX + readout.pillWidth / 2\">\n {{ readout.label }}\n </text>\n </g>\n }\n\n @if (rangeBand(); as range) {\n <g\n class=\"range-pill\"\n aria-hidden=\"true\"\n animate.enter=\"cursor-in\"\n animate.leave=\"cursor-out\"\n [style.transform]=\"\n 'translate(' + range.pillX + 'px, ' + range.pillY + 'px)'\n \">\n <rect\n class=\"pill\"\n [attr.x]=\"-range.pillWidth / 2\"\n [attr.width]=\"range.pillWidth\" />\n\n <text\n class=\"range-text pill-text\"\n text-anchor=\"middle\">\n {{ range.label }}\n </text>\n </g>\n }\n\n <!-- Keyed by category: another category takes a new pin that pops in; the same one glides with the data. -->\n @for (pinnedCategory of pinnedCategories(); track pinnedCategory) {\n @if (cursorBand(); as band) {\n <g\n class=\"band-pin\"\n [style.transform]=\"\n 'translateX(' + (band.x + band.width / 2) + 'px)'\n \">\n <g\n dsChartPinMarker\n [attr.transform]=\"'translate(0,' + bandPinY() + ')'\">\n </g>\n </g>\n }\n }\n </svg>\n </div>\n</ng-template>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),: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, var(--ds-chart-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{-webkit-user-select:text;user-select:text}.empty-text.is-error{color:var(--error)}:host{position:relative}:host(.framed){--_chart-pin-reset-inset: var(--ds-chart-frame-padding)}.category-label.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.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}:host{--_chart-message-height: var(--_chart-view-height)}.canvas{display:block;inline-size:100%}.canvas.pins{cursor:pointer}:host(.measuring) .marks ::ng-deep *,:host(.measuring) .axes *,:host(.measuring) .labels *,:host(.measuring) .cursor,:host(.measuring) .cursor *,:host(.measuring) .band-pin,:host(.measuring) .band-pin *,:host(.measuring) .readout,:host(.measuring) .range-band,:host(.measuring) .stop-ring{transition-duration:0ms!important}.grid-line,.axis-label{transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.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)}.category-label.is-rotated{dominant-baseline:middle}.axis-title{fill:var(--_chart-axis-label-color);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold)}.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}}.cursor.placed,.pinned-line.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.cursor-in{animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.cursor-out{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.category-band{fill:var(--ds-chart-hover-bg-color)}.cursor-anchor{fill:none;pointer-events:none}.cursor-anchor.on-reading{y:calc(var(--_reading-y) - var(--ds-chart-dot-radius));height:calc(2 * var(--ds-chart-dot-radius))}.category-stop{fill:transparent;pointer-events:none}@media not (forced-colors:active){.category-stop:focus{outline:none}}@media not (forced-colors:active){.category-stop:focus-visible{outline:none}}.stop-ring{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, var(--ds-chart-bg-color)));fill:none;opacity:0;pointer-events:none;transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.stop-ring.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.category-stops:has(.category-stop:focus-visible) .stop-ring{opacity:1}@media(forced-colors:active){.stop-ring{display:none}}.category-label{transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),fill var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),font-weight var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.category-label.is-hot{fill:var(--text-primary);font-weight:var(--font-weight-bold)}.readout.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.readout,.range-pill{pointer-events:none}.readout-guide{stroke:var(--ds-chart-cursor-line-color);stroke-width:1;stroke-dasharray:3 3}.pill{y:-8px;height:16px;rx:var(--radius-sm);fill:var(--text-primary)}.pill-text{fill:var(--surface-default);font-size:var(--_chart-axis-font-size);font-weight:var(--font-weight-bold);dominant-baseline:central}.range-band{rx:var(--radius-sm);fill:var(--accent);fill-opacity:.08;stroke:var(--accent);stroke-opacity:.4;pointer-events:none}.range-band.placed{transition:x var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),width var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.canvas.selects-range{touch-action:pan-y}@media(forced-colors:active){.pill{fill:CanvasText}.pill-text{fill:Canvas}.range-band{stroke:Highlight}}.cursor-line{stroke:var(--ds-chart-cursor-line-color);stroke-width:1}.plot-bg{fill:var(--ds-chart-plot-bg-color, transparent);pointer-events:none}\n"] }]
|
|
2207
|
+
}], ctorParameters: () => [], propDecorators: { categories: [{ type: i0.Input, args: [{ isSignal: true, alias: "categories", required: false }] }], skeletonCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "skeletonCount", 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 }] }], cursor: [{ type: i0.Input, args: [{ isSignal: true, alias: "cursor", required: false }] }], rescaleOnHide: [{ type: i0.Input, args: [{ isSignal: true, alias: "rescaleOnHide", required: false }] }], maxSecondary: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSecondary", 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 }] }], 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 }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisLabel", required: false }] }], secondaryAxisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondaryAxisLabel", required: false }] }], selectRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectRange", required: false }] }], showAxisReadout: [{ type: i0.Input, args: [{ isSignal: true, alias: "showAxisReadout", required: false }] }], tooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipTemplate", required: false }] }], tooltipExtraGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipExtraGap", required: false }] }], lineSeries: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => LineSeriesComponent), { ...{
|
|
2208
|
+
descendants: true,
|
|
2209
|
+
}, isSignal: true }] }], canvasElement: [{ type: i0.ViewChild, args: ['canvasEl', { isSignal: true }] }], bandElement: [{ type: i0.ViewChild, args: ['cursorBandEl', { isSignal: true }] }] } });
|
|
2210
|
+
function highestReading(readings) {
|
|
2211
|
+
let highest = null;
|
|
2212
|
+
for (const reading of readings) {
|
|
2213
|
+
if (reading.y !== undefined &&
|
|
2214
|
+
(highest?.y === undefined || reading.y < highest.y)) {
|
|
2215
|
+
highest = reading;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
return highest;
|
|
2219
|
+
}
|
|
2220
|
+
// A pin's `transform` attribute is where it lands; its computed transform is mid-glide.
|
|
2221
|
+
function landedTranslateY(element) {
|
|
2222
|
+
const match = /translate\(\s*[-\d.e]+[\s,]+([-\d.e]+)/.exec(element.getAttribute('transform') ?? '');
|
|
2223
|
+
return match ? parseFloat(match[1]) : 0;
|
|
2224
|
+
}
|
|
2225
|
+
function boundNumber(element, name) {
|
|
2226
|
+
return parseFloat(element.getAttribute(name) ?? '') || 0;
|
|
2227
|
+
}
|
|
2228
|
+
/** Top and height in view units of where `origin` lands: a column's cap and a marker by their bound
|
|
2229
|
+
* attributes, anything else by its box. */
|
|
2230
|
+
function landedExtent(origin, canvas, viewHeight) {
|
|
2231
|
+
const cap = origin.matches('.bar') ? origin.querySelector('.bar-cap') : null;
|
|
2232
|
+
if (cap) {
|
|
2233
|
+
return { top: boundNumber(cap, 'y'), height: boundNumber(cap, 'height') };
|
|
2234
|
+
}
|
|
2235
|
+
if (origin instanceof SVGCircleElement) {
|
|
2236
|
+
const radius = parseFloat(getComputedStyle(origin).r) || 0;
|
|
2237
|
+
return { top: boundNumber(origin, 'cy') - radius, height: 2 * radius };
|
|
2238
|
+
}
|
|
2239
|
+
const frame = canvas.getBoundingClientRect();
|
|
2240
|
+
const scale = frame.height > 0 ? viewHeight / frame.height : 1;
|
|
2241
|
+
const box = origin.getBoundingClientRect();
|
|
2242
|
+
return { top: (box.top - frame.top) * scale, height: box.height * scale };
|
|
2243
|
+
}
|
|
2244
|
+
// The label is placed by `--_column-value-y` (its baseline); `getBBox` is in its own space, so its `y` is the ascent.
|
|
2245
|
+
function landedTextTop(label) {
|
|
2246
|
+
const baseline = parseFloat(label.style.getPropertyValue('--_column-value-y')) || 0;
|
|
2247
|
+
return baseline + label.getBBox().y;
|
|
1309
2248
|
}
|
|
1310
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, decorators: [{
|
|
1311
|
-
type: Component,
|
|
1312
|
-
args: [{ selector: 'g[dsColumnSeries]', standalone: true, imports: [ChartPinMarkerComponent], exportAs: 'dsColumnSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-dimmed]=\"dimmedBySeries()\"\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 (pointerover)=\"onMarkOver($event)\"\n (pointerout)=\"onMarkOut($event)\"\n (keydown)=\"onMarkKey($event)\"\n (click)=\"onMarkClick($event)\">\n <!-- `userSpaceOnUse` keeps the stripe pitch equal on tall and short columns (the object bounding box\n scales it per mark). The stripe runs down the tile's middle: on its edge the tile clips it to half. -->\n @if (hatchInUse()) {\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=\"4\"\n y1=\"0\"\n x2=\"4\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n }\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"activeMark.index() === index\"\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()\n ? !scales.cursorOn?.() && index === roving.tabStop()\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() ? entryLabel(mark) : null\"\n (animate.leave)=\"leaveMark($event)\">\n <!-- The pointer target is the whole category slot, so a two-pixel column stays reachable. -->\n @let hit = hitBox(mark);\n\n <svg:rect\n class=\"hit-area\"\n [attr.y]=\"hit.y\"\n [attr.height]=\"hit.height\" />\n\n <svg:g\n #barEl\n class=\"bar\"\n [style.transform-origin]=\"mark.origin\">\n <!-- `rx` rounds all four corners but the cap belongs on the free end alone; this rect fills the\n two baseline corners back in. Unlike a `<path>`, both keep `y` and `height` interpolable. -->\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 as its fill: a pattern carries its own colour,\n so one shared definition could not take each mark's. -->\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 dsChartPinMarker\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\" />\n }\n </svg:g>\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.column .bar{transform-origin:bottom}.bar{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-grow-duration) var(--ds-motion-chart-mark-grow-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.bar{animation-delay:0ms}}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.value{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-grow-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.value{animation-delay:0ms}}@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.is-active) .column:not(.is-active),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive,.columns .column.pins{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) );--_chart-hatch-color: var( --ds-chart-hatch-color, var(--ds-chart-bg-color) );--_chart-hatch-width: var(--ds-chart-hatch-width, 1.5px)}.column{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_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{--_column-hit-start: calc( var(--_column-chart-slot-step) * (var(--_column-slot, 0) - var(--_column-slots, 1) / 2) );width:var(--_column-chart-slot-step);x:calc(var(--_column-hit-start) - var(--_column-slot-offset));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(--_chart-hatch-color);stroke-width:var(--_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, var(--ds-chart-bg-color)))}@media(forced-colors:active){.column.interactive:focus-visible .bar-cap{stroke:Highlight;filter:none}}.columns.is-dimmed{opacity:var(--ds-chart-dim-opacity);transition:opacity var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}\n"] }]
|
|
1313
|
-
}], 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 }] }], soleSeries: [{ type: i0.Input, args: [{ isSignal: true, alias: "soleSeries", required: false }] }], axis: [{ type: i0.Input, args: [{ isSignal: true, alias: "axis", 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 }] }], seriesKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesKey", required: false }] }], highlighted: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlighted", required: false }] }], pointClicked: [{ type: i0.Output, args: ["pointClicked"] }], barElements: [{ type: i0.ViewChildren, args: ['barEl', { isSignal: true }] }] } });
|
|
1314
2249
|
|
|
2250
|
+
/** Distance from a mark's tip to its value label's baseline. */
|
|
2251
|
+
const VALUE_LABEL_GAP = 8;
|
|
2252
|
+
// The printed value's cap height at `--font-size-xs`.
|
|
2253
|
+
const VALUE_LABEL_HEIGHT = 10;
|
|
2254
|
+
/** Blank at a stacked segment's lower end: a background-colour gap, not a drawn rule (which vanishes in print). */
|
|
2255
|
+
const STACK_SEGMENT_GAP = 2;
|
|
1315
2256
|
let nextSeriesId = 0;
|
|
1316
|
-
// The active marker's default radius, `--chart-dot-radius-active`.
|
|
1317
|
-
const PIN_MARKER_CLEARANCE = 6;
|
|
1318
2257
|
/**
|
|
1319
|
-
* One
|
|
2258
|
+
* One column per datum, drawn against the scales `ds-chart` supplies.
|
|
1320
2259
|
*
|
|
1321
|
-
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants.
|
|
1322
|
-
*
|
|
2260
|
+
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants. Written
|
|
2261
|
+
* as `<svg:g dsColumnSeries>`.
|
|
1323
2262
|
*/
|
|
1324
|
-
class
|
|
2263
|
+
class ColumnSeriesComponent {
|
|
1325
2264
|
leaveMark = leaveMark;
|
|
1326
2265
|
scales = inject(CHART_SCALES);
|
|
1327
|
-
|
|
2266
|
+
host = inject(ElementRef);
|
|
2267
|
+
locale = injectDsLocale();
|
|
2268
|
+
intl = inject(DS_INTL);
|
|
2269
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this same element,
|
|
2270
|
+
* and a required input throws NG0950 before its value is written. */
|
|
1328
2271
|
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1329
|
-
/**
|
|
1330
|
-
|
|
1331
|
-
/** Lays the line and markers on a background-colour band so they stay legible where they cross other marks. */
|
|
1332
|
-
outline = input(true, { ...(ngDevMode ? { debugName: "outline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2272
|
+
/** Prints each column's value above the column. */
|
|
2273
|
+
showValues = input(true, { ...(ngDevMode ? { debugName: "showValues" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1333
2274
|
/** Turns on the click affordance (pointer cursor and hover tint). `pointClicked` fires either way. */
|
|
1334
2275
|
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1335
2276
|
/** Holds the clicked mark and its tooltip until a second click, Escape or a press outside. Unset
|
|
@@ -1337,351 +2278,366 @@ class LineSeriesComponent {
|
|
|
1337
2278
|
pinOnClick = input(null, { ...(ngDevMode ? { debugName: "pinOnClick" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? null : booleanAttribute(value)) });
|
|
1338
2279
|
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
1339
2280
|
pins = computed(() => this.pinOnClickResolved() && !this.scales.cursorOn?.(), ...(ngDevMode ? [{ debugName: "pins" }] : /* istanbul ignore next */ []));
|
|
1340
|
-
/** Fades every
|
|
2281
|
+
/** Fades every mark but the one under the pointer. Off by default: it costs separation between the rest. */
|
|
1341
2282
|
dimOthers = input(false, { ...(ngDevMode ? { debugName: "dimOthers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1342
|
-
/**
|
|
1343
|
-
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
1344
|
-
/** A dash pattern per series, in series order. A series past the end, or given `''`, draws solid. */
|
|
1345
|
-
patterns = input([], ...(ngDevMode ? [{ debugName: "patterns" }] : /* istanbul ignore next */ []));
|
|
1346
|
-
/** Fills each area from the series below it rather than from the baseline (stacked plots). */
|
|
1347
|
-
stacked = input(false, { ...(ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1348
|
-
dashFor(seriesIndex) {
|
|
1349
|
-
return this.patterns()[seriesIndex] || null;
|
|
1350
|
-
}
|
|
1351
|
-
/** Milliseconds between one series' entrance and the next, narrowed to fit the stagger budget; `0` is off. */
|
|
2283
|
+
/** Milliseconds between one mark's entrance and the next, narrowed to fit 260ms. `0` is no stagger. */
|
|
1352
2284
|
staggerMs = input(40, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1353
|
-
/**
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* holds each reading to the next; `'smooth'` is a monotone cubic that draws no peak the data lacks. */
|
|
1357
|
-
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
1358
|
-
/** Whether a hovered or focused reading opens a tooltip: `'item'` names the marker, `'axis'` every
|
|
1359
|
-
* series at the category, turning the container's category cursor on under `cursor="auto"`. */
|
|
2285
|
+
/** Declares the marks are parts of one whole; each mark's share then appears on the tooltip's second line. */
|
|
2286
|
+
partOfWhole = input(false, { ...(ngDevMode ? { debugName: "partOfWhole" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2287
|
+
/** Whether a hovered or focused column opens a tooltip. */
|
|
1360
2288
|
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
1361
|
-
/** Where
|
|
1362
|
-
tooltipAnchor = input('
|
|
1363
|
-
/** Milliseconds the panel survives the pointer leaving the
|
|
2289
|
+
/** Where the tooltip is pinned: `'mark'` is the column, `'cell'` the full-height category cell (panel at the plot top). */
|
|
2290
|
+
tooltipAnchor = input('mark', ...(ngDevMode ? [{ debugName: "tooltipAnchor" }] : /* istanbul ignore next */ []));
|
|
2291
|
+
/** Milliseconds the panel survives the pointer leaving the mark within the chart. */
|
|
1364
2292
|
tooltipLingerMs = input(CHART_TOOLTIP_LINGER_MS, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1365
2293
|
/** Formats every value this series prints: `'tick'` for an axis label, `'tooltip'` for a value in full. */
|
|
1366
2294
|
valueFormat = input(chartValueFormat(injectDsLocale()), ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
1367
|
-
/** The
|
|
2295
|
+
/** The mark's share of its category slot before the maximum width caps it. Measured off the slot,
|
|
2296
|
+
* not `bandWidth()`, whose padding is already taken out (both would narrow columns twice). */
|
|
2297
|
+
columnWidthRatio = input(0.8, { ...(ngDevMode ? { debugName: "columnWidthRatio" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2298
|
+
/** This series' position among the slots a category's band is divided into. */
|
|
2299
|
+
slot = input(0, { ...(ngDevMode ? { debugName: "slot" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2300
|
+
/** How many slots the band is divided into: the series drawn side by side. */
|
|
2301
|
+
slotCount = input(1, { ...(ngDevMode ? { debugName: "slotCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2302
|
+
/** Where each mark starts and ends on the value axis, one entry per point. Unset, marks run from zero. */
|
|
2303
|
+
offsets = input(null, ...(ngDevMode ? [{ debugName: "offsets" }] : /* istanbul ignore next */ []));
|
|
2304
|
+
/** The only series in its slot, as a waterfall's floating bars are: each answers the pointer over the whole plot height. */
|
|
2305
|
+
soleSeries = input(false, { ...(ngDevMode ? { debugName: "soleSeries" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2306
|
+
/** Which value axis the columns are measured against; `'secondary'` reads the second axis. */
|
|
2307
|
+
axis = input('primary', ...(ngDevMode ? [{ debugName: "axis" }] : /* istanbul ignore next */ []));
|
|
2308
|
+
/** One colour for the whole series. Unset, each mark takes the categorical palette by position;
|
|
2309
|
+
* a point's own colour wins. */
|
|
2310
|
+
seriesColor = input(null, ...(ngDevMode ? [{ debugName: "seriesColor" }] : /* istanbul ignore next */ []));
|
|
2311
|
+
/** `seriesColor` for the fill pattern. A point's own `fill` wins. */
|
|
2312
|
+
seriesFill = input(null, ...(ngDevMode ? [{ debugName: "seriesFill" }] : /* istanbul ignore next */ []));
|
|
2313
|
+
/** Names the series in the tooltip, making the category the panel's heading. */
|
|
2314
|
+
seriesLabel = input(null, ...(ngDevMode ? [{ debugName: "seriesLabel" }] : /* istanbul ignore next */ []));
|
|
2315
|
+
/** Identifies this series to the legend, so hovering a legend item can single it out. */
|
|
2316
|
+
seriesKey = input(null, ...(ngDevMode ? [{ debugName: "seriesKey" }] : /* istanbul ignore next */ []));
|
|
2317
|
+
/** The series the reader is pointing at in the legend. It brightens; under `dimOthers` every other
|
|
2318
|
+
* series fades instead, as the other columns do when one is hovered. */
|
|
2319
|
+
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
2320
|
+
dimmedBySeries = computed(() => dimmedBy(this.dimOthers(), this.highlighted(), this.seriesKey()), ...(ngDevMode ? [{ debugName: "dimmedBySeries" }] : /* istanbul ignore next */ []));
|
|
2321
|
+
spotlit = computed(() => this.highlighted() !== null && this.highlighted() === this.seriesKey(), ...(ngDevMode ? [{ debugName: "spotlit" }] : /* istanbul ignore next */ []));
|
|
2322
|
+
/** Sinks every column to the baseline; the value axis follows the chart's `rescaleOnHide`. Set it
|
|
2323
|
+
* rather than removing the series to animate a legend hiding it. */
|
|
2324
|
+
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2325
|
+
/** Reads the columns as a running total, as a waterfall's are: the axis guide stops at the hovered
|
|
2326
|
+
* column, and under `dimOthers` every column after it fades. */
|
|
2327
|
+
runningTotal = input(false, { ...(ngDevMode ? { debugName: "runningTotal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2328
|
+
/** The clicked datum. Fires on click and on Enter or Space, whatever `interactive` says. */
|
|
1368
2329
|
pointClicked = output();
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
2330
|
+
seriesId = nextSeriesId++;
|
|
2331
|
+
domainId = `column-series-${this.seriesId}`;
|
|
2332
|
+
/** Per instance: otherwise every hatched mark takes the first chart's `<pattern>` colour. */
|
|
2333
|
+
hatchId = `ds-column-hatch-${this.seriesId}`;
|
|
2334
|
+
/** Where each mark spans, which the axis has to hold: a stacked segment's top is the running total. */
|
|
2335
|
+
spans = computed(() => this.spansOf(this.hidden()), ...(ngDevMode ? [{ debugName: "spans" }] : /* istanbul ignore next */ []));
|
|
2336
|
+
spansOf(hidden) {
|
|
2337
|
+
const given = this.offsets();
|
|
2338
|
+
return this.data().map((point, index) => given?.[index] ?? {
|
|
2339
|
+
from: 0,
|
|
2340
|
+
to: Number.isFinite(point.value) && !hidden ? point.value : 0,
|
|
2341
|
+
});
|
|
1372
2342
|
}
|
|
1373
2343
|
constructor() {
|
|
1374
|
-
effect(() =>
|
|
1375
|
-
this.scales.reportDomain(`${this.domainId}-primary`, this.valuesOn('primary'), 'primary');
|
|
1376
|
-
this.scales.reportDomain(`${this.domainId}-secondary`, this.valuesOn('secondary'), 'secondary');
|
|
1377
|
-
});
|
|
2344
|
+
effect(() => this.scales.reportDomain(this.domainId, this.spansOf(false).flatMap((span) => [span.from, span.to]), this.axis(), this.hidden()));
|
|
1378
2345
|
this.scales.reportTooltip(this.domainId, {
|
|
1379
2346
|
context: this.tooltipContext,
|
|
1380
|
-
origin: this.
|
|
2347
|
+
origin: computed(() => this.activeMark.origin()),
|
|
2348
|
+
pinned: this.activeMark.pinned,
|
|
1381
2349
|
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
1382
|
-
|
|
1383
|
-
axisOrigin:
|
|
2350
|
+
stacked: computed(() => this.offsets() !== null),
|
|
2351
|
+
axisOrigin: computed(() => {
|
|
2352
|
+
const categoryIndex = this.scales.activeIndex();
|
|
2353
|
+
return categoryIndex < 0
|
|
2354
|
+
? null
|
|
2355
|
+
: (this.barElements()[categoryIndex]?.nativeElement ?? null);
|
|
2356
|
+
}),
|
|
1384
2357
|
axisEntries: this.axisEntries,
|
|
1385
2358
|
axisPointElements: this.axisPointElements,
|
|
2359
|
+
axisReadout: this.axisReadout,
|
|
2360
|
+
valuesByCategory: computed(() => this.hidden()
|
|
2361
|
+
? []
|
|
2362
|
+
: this.data().map((point) => Number.isFinite(point.value) ? [point.value] : [])),
|
|
1386
2363
|
});
|
|
1387
|
-
|
|
1388
|
-
|
|
2364
|
+
const host = this.host;
|
|
2365
|
+
listenForMarkFocus(host, (event, hit) => this.onMarkFocus(event, hit), () => {
|
|
1389
2366
|
this.activeMark.leave();
|
|
1390
|
-
this.scales.
|
|
2367
|
+
if (this.scales.cursorOn?.()) {
|
|
2368
|
+
this.scales.setActiveIndex(-1);
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
afterRenderEffect({
|
|
2372
|
+
write: () => {
|
|
2373
|
+
const marks = this.marks();
|
|
2374
|
+
untracked(() => this.glideReordered(marks));
|
|
2375
|
+
},
|
|
2376
|
+
});
|
|
2377
|
+
let answeringLabel = false;
|
|
2378
|
+
effect(() => {
|
|
2379
|
+
const hover = this.scales.categoryLabelHover?.() ?? null;
|
|
2380
|
+
untracked(() => {
|
|
2381
|
+
const mark = hover &&
|
|
2382
|
+
host.nativeElement.querySelector(`[data-mark-index="${hover.index}"]`);
|
|
2383
|
+
if (hover && mark) {
|
|
2384
|
+
answeringLabel = true;
|
|
2385
|
+
this.activeMark.enter(hover.index, hover.event, this.tooltipMark(), mark);
|
|
2386
|
+
}
|
|
2387
|
+
else if (answeringLabel) {
|
|
2388
|
+
answeringLabel = false;
|
|
2389
|
+
this.activeMark.leave();
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
1391
2392
|
});
|
|
1392
2393
|
}
|
|
1393
2394
|
ngOnDestroy() {
|
|
1394
2395
|
this.scales.releaseTooltip(this.domainId);
|
|
1395
|
-
this.scales.releaseDomain(
|
|
1396
|
-
this.scales.releaseDomain(`${this.domainId}-secondary`);
|
|
2396
|
+
this.scales.releaseDomain(this.domainId);
|
|
1397
2397
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
2398
|
+
placedX = new Map();
|
|
2399
|
+
// A column the `@for` moves to another place in the DOM restarts its style and loses the transition,
|
|
2400
|
+
// so after a reorder every column whose key changed place glides from where it stood.
|
|
2401
|
+
glideReordered(marks) {
|
|
2402
|
+
const previous = this.placedX;
|
|
2403
|
+
this.placedX = new Map(marks.map((mark) => [mark.key, mark.x]));
|
|
2404
|
+
const before = [...previous.keys()].filter((key) => this.placedX.has(key));
|
|
2405
|
+
const after = marks
|
|
2406
|
+
.map((mark) => mark.key)
|
|
2407
|
+
.filter((key) => previous.has(key));
|
|
2408
|
+
if (before.every((key, index) => key === after[index])) {
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
marks.forEach((mark) => {
|
|
2412
|
+
const from = previous.get(mark.key);
|
|
2413
|
+
const column = this.host.nativeElement.querySelector(`.column[data-column-key="${CSS.escape(mark.key)}"]:not(.mark-leave)`);
|
|
2414
|
+
if (from === undefined || from === mark.x || !column) {
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
const timing = chartTiming(column, 'mark');
|
|
2418
|
+
if (!timing || typeof column.animate !== 'function') {
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
// Re-inserted, the column replays its entrance; it has already arrived.
|
|
2422
|
+
for (const animation of column.getAnimations({ subtree: true })) {
|
|
2423
|
+
if (animation instanceof CSSAnimation) {
|
|
2424
|
+
animation.finish();
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
const at = (x) => ({
|
|
2428
|
+
transform: `translateX(calc(${x}px + var(--_column-slot-offset)))`,
|
|
2429
|
+
});
|
|
2430
|
+
column.animate([at(from), at(mark.x)], timing);
|
|
2431
|
+
});
|
|
1403
2432
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
2433
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs(), () => this.scales.hoverDelayMs?.() ?? 0);
|
|
2434
|
+
barElements = viewChildren('barEl', ...(ngDevMode ? [{ debugName: "barElements" }] : /* istanbul ignore next */ []));
|
|
2435
|
+
/** One series' slot inside a category's band: the whole band, or a share per series when grouped. The pointer box is sized from it. */
|
|
2436
|
+
slotStep = computed(() => {
|
|
2437
|
+
const count = this.data().length;
|
|
2438
|
+
const slots = Math.max(1, this.slotCount());
|
|
2439
|
+
return count > 0 ? this.scales.plot().width / count / slots : 0;
|
|
2440
|
+
}, ...(ngDevMode ? [{ debugName: "slotStep" }] : /* istanbul ignore next */ []));
|
|
2441
|
+
slotStepPx = computed(() => `${this.slotStep()}px`, ...(ngDevMode ? [{ debugName: "slotStepPx" }] : /* istanbul ignore next */ []));
|
|
2442
|
+
markWidthPx = computed(() => `${this.slotStep() * this.columnWidthRatio()}px`, ...(ngDevMode ? [{ debugName: "markWidthPx" }] : /* istanbul ignore next */ []));
|
|
2443
|
+
/** The whole canvas, reserved end included: falling short leaves a strip under the plot that answers no pointer. */
|
|
2444
|
+
hitHeight = computed(() => {
|
|
2445
|
+
const plot = this.scales.plot();
|
|
2446
|
+
return chartViewHeight(plot.height, plot.top, true);
|
|
2447
|
+
}, ...(ngDevMode ? [{ debugName: "hitHeight" }] : /* istanbul ignore next */ []));
|
|
2448
|
+
/** Stacked series overlap, so a stacked mark catches the pointer over its own segment only. */
|
|
2449
|
+
stacked = computed(() => this.offsets() !== null && !this.soleSeries(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
2450
|
+
/** Keeps a thin segment reachable without letting it reach into its neighbours. */
|
|
2451
|
+
static MIN_STACK_HIT = 6;
|
|
2452
|
+
hitBox(mark) {
|
|
2453
|
+
if (!this.stacked()) {
|
|
2454
|
+
return { y: 0, height: this.hitHeight() };
|
|
1412
2455
|
}
|
|
1413
|
-
|
|
2456
|
+
const height = Math.max(mark.height, ColumnSeriesComponent.MIN_STACK_HIT);
|
|
2457
|
+
const overflow = height - mark.height;
|
|
2458
|
+
return { y: mark.top - overflow / 2, height };
|
|
1414
2459
|
}
|
|
1415
|
-
|
|
2460
|
+
hatchInUse = computed(() => this.marks().some((mark) => mark.hatched), ...(ngDevMode ? [{ debugName: "hatchInUse" }] : /* istanbul ignore next */ []));
|
|
2461
|
+
marks = computed(() => {
|
|
1416
2462
|
const toX = this.scales.xPosition();
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
const
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
x: point.x,
|
|
1450
|
-
y: point.y,
|
|
1451
|
-
value: point.value,
|
|
1452
|
-
category: categories[point.categoryIndex] ?? '',
|
|
1453
|
-
formattedValue: format(point.value, 'tooltip'),
|
|
1454
|
-
seriesLabel: series.label,
|
|
1455
|
-
seriesId: series.id,
|
|
1456
|
-
categoryIndex: point.categoryIndex,
|
|
1457
|
-
color,
|
|
1458
|
-
})),
|
|
2463
|
+
const toY = this.axis() === 'secondary'
|
|
2464
|
+
? this.scales.secondaryYPosition()
|
|
2465
|
+
: this.scales.yPosition();
|
|
2466
|
+
const spans = this.spans();
|
|
2467
|
+
const format = this.valueFormat();
|
|
2468
|
+
const keys = categoryKeys(this.data().map((point) => point.label));
|
|
2469
|
+
return this.data().map((point, index) => {
|
|
2470
|
+
const span = spans[index];
|
|
2471
|
+
const foot = toY(span.from);
|
|
2472
|
+
const tip = toY(span.to);
|
|
2473
|
+
const below = tip > foot;
|
|
2474
|
+
// Only a segment with one under it gives up the gap; the baseline segment would lift the stack off the axis.
|
|
2475
|
+
const gap = span.from === 0 ? 0 : Math.min(STACK_SEGMENT_GAP, Math.abs(tip - foot));
|
|
2476
|
+
const baseline = below ? foot + gap : foot - gap;
|
|
2477
|
+
const color = point.color ??
|
|
2478
|
+
this.seriesColor() ??
|
|
2479
|
+
CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
2480
|
+
return {
|
|
2481
|
+
key: point.id ?? keys[index],
|
|
2482
|
+
point,
|
|
2483
|
+
x: toX(index),
|
|
2484
|
+
tip,
|
|
2485
|
+
below,
|
|
2486
|
+
baseline,
|
|
2487
|
+
top: Math.min(tip, baseline),
|
|
2488
|
+
height: Math.abs(tip - baseline),
|
|
2489
|
+
labelY: below ? tip + VALUE_LABEL_GAP : tip - VALUE_LABEL_GAP,
|
|
2490
|
+
pinY: this.pinYOf(tip, baseline, below),
|
|
2491
|
+
origin: below ? 'top' : 'bottom',
|
|
2492
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
2493
|
+
color,
|
|
2494
|
+
hatched: (point.fill ?? this.seriesFill()) === 'hatched',
|
|
1459
2495
|
};
|
|
1460
2496
|
});
|
|
1461
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
const lowerSegments = lineSegments(lower.map((value, categoryIndex) => value === null
|
|
1470
|
-
? null
|
|
1471
|
-
: {
|
|
1472
|
-
categoryIndex,
|
|
1473
|
-
x: toX(categoryIndex),
|
|
1474
|
-
y: toY(value),
|
|
1475
|
-
value,
|
|
1476
|
-
}));
|
|
1477
|
-
return segments
|
|
1478
|
-
.map((segment, index) => lowerSegments[index]
|
|
1479
|
-
? bandPath(segment, lowerSegments[index], curve)
|
|
1480
|
-
: areaPath(segment, toY(0), curve))
|
|
1481
|
-
.filter((path) => path.length > 0);
|
|
1482
|
-
}
|
|
1483
|
-
allMarkers = computed(() => this.plotted().flatMap((entry) => entry.markers), ...(ngDevMode ? [{ debugName: "allMarkers" }] : /* istanbul ignore next */ []));
|
|
1484
|
-
seriesStagger(index) {
|
|
1485
|
-
return `${staggerDelay(index, this.plotted().length, this.staggerMs())}ms`;
|
|
2497
|
+
}, ...(ngDevMode ? [{ debugName: "marks" }] : /* istanbul ignore next */ []));
|
|
2498
|
+
/** Inside the column's top when it holds the disc - the panel opens there - and over the column
|
|
2499
|
+
* and its printed value when it is too short, so the disc never crosses the baseline. */
|
|
2500
|
+
pinYOf(tip, baseline, below) {
|
|
2501
|
+
const top = Math.min(tip, baseline);
|
|
2502
|
+
return pinYAbove(top, Math.abs(tip - baseline), this.showValues() && !below
|
|
2503
|
+
? top - (VALUE_LABEL_GAP + VALUE_LABEL_HEIGHT)
|
|
2504
|
+
: null, CHART_PIN_RADIUS + CHART_PIN_GAP);
|
|
1486
2505
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
firstMarkerBySeries = computed(() => new Map(this.plotted().map((entry) => [
|
|
1490
|
-
entry.series.id,
|
|
1491
|
-
entry.markers[0]?.markIndex,
|
|
1492
|
-
])), ...(ngDevMode ? [{ debugName: "firstMarkerBySeries" }] : /* istanbul ignore next */ []));
|
|
1493
|
-
isTabStop(seriesId, markIndex) {
|
|
1494
|
-
return ((this.rovingBySeries().get(seriesId) ??
|
|
1495
|
-
this.firstMarkerBySeries().get(seriesId)) === markIndex);
|
|
2506
|
+
markStagger(index) {
|
|
2507
|
+
return `${staggerDelay(index, this.marks().length, this.staggerMs())}ms`;
|
|
1496
2508
|
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
2509
|
+
tooltipMark = computed(() => this.tooltipAnchor() === 'mark' ? '.bar' : undefined, ...(ngDevMode ? [{ debugName: "tooltipMark" }] : /* istanbul ignore next */ []));
|
|
2510
|
+
onMarkClick(event) {
|
|
2511
|
+
const hit = markOf(event);
|
|
2512
|
+
const mark = hit && this.marks()[hit.index];
|
|
2513
|
+
if (!hit || !mark) {
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
this.pointClicked.emit(mark.point);
|
|
2517
|
+
if (this.pins()) {
|
|
2518
|
+
this.activeMark.pin(hit.index, event, this.tooltipMark(), hit.element);
|
|
2519
|
+
}
|
|
1503
2520
|
}
|
|
1504
|
-
|
|
1505
|
-
? (this.allMarkers()[this.activeMark.index()] ?? null)
|
|
1506
|
-
: null, ...(ngDevMode ? [{ debugName: "pinnedMarker" }] : /* istanbul ignore next */ []));
|
|
1507
|
-
pinLift = CHART_PIN_RADIUS + CHART_PIN_GAP + PIN_MARKER_CLEARANCE;
|
|
1508
|
-
onMarkerOver(event) {
|
|
2521
|
+
onMarkOver(event) {
|
|
1509
2522
|
const hit = markOf(event);
|
|
1510
2523
|
if (hit && !this.scales.cursorOn?.()) {
|
|
1511
|
-
this.activeMark.enter(hit.index, event,
|
|
2524
|
+
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1512
2525
|
}
|
|
1513
2526
|
}
|
|
1514
|
-
|
|
2527
|
+
onMarkOut(event) {
|
|
1515
2528
|
const hit = markOf(event);
|
|
1516
|
-
if (
|
|
1517
|
-
return;
|
|
1518
|
-
}
|
|
1519
|
-
const next = event.relatedTarget instanceof Element
|
|
1520
|
-
? event.relatedTarget.closest('[data-mark-index]')
|
|
1521
|
-
: null;
|
|
1522
|
-
if (next !== hit.element) {
|
|
2529
|
+
if (hit && leftMark(event, hit) && !this.scales.cursorOn?.()) {
|
|
1523
2530
|
this.activeMark.leave();
|
|
1524
2531
|
}
|
|
1525
2532
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
this.
|
|
1531
|
-
this.scales.setActiveIndex(marker.categoryIndex);
|
|
2533
|
+
roving = rovingMarks(() => this.marks().length);
|
|
2534
|
+
onMarkFocus(event, hit) {
|
|
2535
|
+
this.roving.focus(hit.index);
|
|
2536
|
+
if (this.scales.cursorOn?.()) {
|
|
2537
|
+
this.scales.setActiveIndex(hit.index);
|
|
1532
2538
|
}
|
|
1533
|
-
this.activeMark.enter(hit.index, event,
|
|
2539
|
+
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1534
2540
|
}
|
|
1535
|
-
|
|
2541
|
+
onMarkKey(event) {
|
|
1536
2542
|
const hit = markOf(event);
|
|
1537
2543
|
if (!hit) {
|
|
1538
2544
|
return;
|
|
1539
2545
|
}
|
|
1540
2546
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1541
|
-
|
|
1542
|
-
this.
|
|
2547
|
+
// A key pressed on a control inside belongs to that control.
|
|
2548
|
+
const mark = this.marks()[hit.index];
|
|
2549
|
+
if (this.interactive() && event.target === hit.element && mark) {
|
|
2550
|
+
event.preventDefault();
|
|
2551
|
+
this.pointClicked.emit(mark.point);
|
|
2552
|
+
}
|
|
1543
2553
|
return;
|
|
1544
2554
|
}
|
|
1545
2555
|
// The category cursor's `ds-chart` owns the other keys.
|
|
1546
2556
|
if (this.scales.cursorOn?.()) {
|
|
1547
2557
|
return;
|
|
1548
2558
|
}
|
|
1549
|
-
|
|
1550
|
-
const strand = this.allMarkers().filter((candidate) => candidate.seriesId === marker?.seriesId);
|
|
1551
|
-
const current = strand.findIndex((candidate) => candidate.markIndex === hit.index);
|
|
1552
|
-
const next = nextRovingIndex(event.key, current, strand.length);
|
|
1553
|
-
if (next === null) {
|
|
1554
|
-
return;
|
|
1555
|
-
}
|
|
1556
|
-
event.preventDefault();
|
|
1557
|
-
focusMark(hit.element.closest('.lines'), strand[next].markIndex);
|
|
2559
|
+
this.roving.navigate(event, hit.index, hit.element.closest('.columns'));
|
|
1558
2560
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
return highlighted !== null && highlighted !== seriesId;
|
|
2561
|
+
entryLabel(mark) {
|
|
2562
|
+
return `${mark.point.label}, ${mark.formattedValue}`;
|
|
1562
2563
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
this.activeMark.pin(hit.index, event, '.series-marker', hit.element);
|
|
2564
|
+
/** This series' reading at the cursor's category, filled whatever `tooltip` says; feeds only the container's category panel. */
|
|
2565
|
+
axisEntries = computed(() => {
|
|
2566
|
+
const categoryIndex = this.scales.activeIndex();
|
|
2567
|
+
const mark = this.marks()[categoryIndex];
|
|
2568
|
+
if (categoryIndex < 0 || !mark || this.hidden()) {
|
|
2569
|
+
return [];
|
|
1570
2570
|
}
|
|
1571
|
-
|
|
2571
|
+
return [
|
|
2572
|
+
{
|
|
2573
|
+
label: this.seriesLabel() ?? mark.point.label,
|
|
2574
|
+
value: mark.point.value,
|
|
2575
|
+
formatted: mark.formattedValue,
|
|
2576
|
+
color: mark.color,
|
|
2577
|
+
hatched: mark.hatched,
|
|
2578
|
+
detail: this.shareDetail(categoryIndex),
|
|
2579
|
+
y: mark.tip,
|
|
2580
|
+
axis: this.axis(),
|
|
2581
|
+
},
|
|
2582
|
+
];
|
|
2583
|
+
}, ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
2584
|
+
axisReadout = computed(() => {
|
|
2585
|
+
const index = this.activeMark.index();
|
|
2586
|
+
const mark = this.marks()[index];
|
|
2587
|
+
return mark && !this.hidden()
|
|
2588
|
+
? {
|
|
2589
|
+
categoryIndex: index,
|
|
2590
|
+
y: mark.tip,
|
|
2591
|
+
axis: this.axis(),
|
|
2592
|
+
reach: this.runningTotal() ? 'mark' : 'plot',
|
|
2593
|
+
}
|
|
2594
|
+
: null;
|
|
2595
|
+
}, ...(ngDevMode ? [{ debugName: "axisReadout" }] : /* istanbul ignore next */ []));
|
|
2596
|
+
isLater(index) {
|
|
2597
|
+
const active = this.activeMark.index();
|
|
2598
|
+
return (this.runningTotal() && this.dimOthers() && active >= 0 && index > active);
|
|
1572
2599
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
const series = this.data().find((entry) => entry.id === marker?.seriesId);
|
|
1576
|
-
if (marker && series) {
|
|
1577
|
-
this.pointClicked.emit({
|
|
1578
|
-
series,
|
|
1579
|
-
categoryIndex: marker.categoryIndex,
|
|
1580
|
-
value: marker.value,
|
|
1581
|
-
});
|
|
1582
|
-
}
|
|
2600
|
+
isOutsideRange(index) {
|
|
2601
|
+
return outsideRange(this.scales.selectedRange?.() ?? null, index);
|
|
1583
2602
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
2603
|
+
focusedMark = computed(() => this.marks()[this.roving.tabStop()] ?? null, ...(ngDevMode ? [{ debugName: "focusedMark" }] : /* istanbul ignore next */ []));
|
|
2604
|
+
axisPointElements = computed(() => this.axisEntries().length === 0
|
|
2605
|
+
? []
|
|
2606
|
+
: [
|
|
2607
|
+
this.host.nativeElement.querySelector(`.columns [data-mark-index="${this.scales.activeIndex()}"]`),
|
|
2608
|
+
], ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
2609
|
+
shareDetail(index) {
|
|
2610
|
+
return this.partOfWhole()
|
|
2611
|
+
? describeShare(this.data().map((point) => point.value), index, this.locale, (share) => this.intl().chart.shareOfTotal(share))
|
|
2612
|
+
: undefined;
|
|
1586
2613
|
}
|
|
1587
|
-
/** What this series reads at the cursor's category, whatever `tooltip` says; feeds the category panel. */
|
|
1588
|
-
axisEntries = computed(() => this.readingsAtCursor().map(({ reading }) => reading), ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
1589
|
-
readingsAtCursor = computed(() => {
|
|
1590
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1591
|
-
if (categoryIndex < 0) {
|
|
1592
|
-
return [];
|
|
1593
|
-
}
|
|
1594
|
-
return this.plotted().flatMap((entry) => {
|
|
1595
|
-
const marker = entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
1596
|
-
return marker
|
|
1597
|
-
? [
|
|
1598
|
-
{
|
|
1599
|
-
seriesId: entry.series.id,
|
|
1600
|
-
markIndex: marker.markIndex,
|
|
1601
|
-
reading: {
|
|
1602
|
-
label: marker.seriesLabel,
|
|
1603
|
-
value: marker.value,
|
|
1604
|
-
formatted: marker.formattedValue,
|
|
1605
|
-
color: marker.color,
|
|
1606
|
-
y: marker.y,
|
|
1607
|
-
},
|
|
1608
|
-
},
|
|
1609
|
-
]
|
|
1610
|
-
: [];
|
|
1611
|
-
});
|
|
1612
|
-
}, ...(ngDevMode ? [{ debugName: "readingsAtCursor" }] : /* istanbul ignore next */ []));
|
|
1613
2614
|
tooltipContext = computed(() => {
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
}
|
|
1617
|
-
if (this.tooltip() === 'axis') {
|
|
1618
|
-
return this.axisTooltipContext();
|
|
1619
|
-
}
|
|
1620
|
-
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1621
|
-
if (!marker) {
|
|
2615
|
+
const mark = this.marks()[this.activeMark.index()];
|
|
2616
|
+
if (this.tooltip() === 'none' || !mark || this.hidden()) {
|
|
1622
2617
|
return null;
|
|
1623
2618
|
}
|
|
2619
|
+
const series = this.seriesLabel();
|
|
1624
2620
|
return {
|
|
1625
|
-
category:
|
|
2621
|
+
category: series ? mark.point.label : '',
|
|
1626
2622
|
entries: [
|
|
1627
2623
|
{
|
|
1628
|
-
label:
|
|
1629
|
-
value:
|
|
1630
|
-
formatted:
|
|
1631
|
-
color:
|
|
2624
|
+
label: series ?? mark.point.label,
|
|
2625
|
+
value: mark.point.value,
|
|
2626
|
+
formatted: mark.formattedValue,
|
|
2627
|
+
color: mark.color,
|
|
2628
|
+
hatched: mark.hatched,
|
|
2629
|
+
detail: this.shareDetail(this.activeMark.index()),
|
|
1632
2630
|
},
|
|
1633
2631
|
],
|
|
1634
2632
|
};
|
|
1635
2633
|
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1636
|
-
|
|
1637
|
-
axisPointElements = computed(() => this.readingsAtCursor().map(({ markIndex }) => this.markerElements()[markIndex]?.nativeElement ?? null), ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
1638
|
-
/** The topmost reading at the active category, as an element; the cursor band spans the plot and would open an `'axis'` panel at the top. */
|
|
1639
|
-
topReadingElement = computed(() => {
|
|
1640
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1641
|
-
if (categoryIndex < 0) {
|
|
1642
|
-
return null;
|
|
1643
|
-
}
|
|
1644
|
-
const highest = this.allMarkers()
|
|
1645
|
-
.filter((marker) => marker.categoryIndex === categoryIndex)
|
|
1646
|
-
.reduce((top, marker) => (top === null || marker.y < top.y ? marker : top), null);
|
|
1647
|
-
return highest
|
|
1648
|
-
? (this.markerElements()[highest.markIndex]?.nativeElement ?? null)
|
|
1649
|
-
: null;
|
|
1650
|
-
}, ...(ngDevMode ? [{ debugName: "topReadingElement" }] : /* istanbul ignore next */ []));
|
|
1651
|
-
tooltipOrigin = computed(() => {
|
|
1652
|
-
if (this.tooltip() !== 'axis') {
|
|
1653
|
-
return this.activeMark.origin();
|
|
1654
|
-
}
|
|
1655
|
-
if (this.tooltipAnchor() === 'pointer') {
|
|
1656
|
-
return this.scales.cursorPointer() ?? this.scales.cursorOrigin();
|
|
1657
|
-
}
|
|
1658
|
-
return this.topReadingElement() ?? this.scales.cursorOrigin();
|
|
1659
|
-
}, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1660
|
-
/** Every series' reading at the active category; a series with none contributes no row. */
|
|
1661
|
-
axisTooltipContext = computed(() => {
|
|
1662
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1663
|
-
if (categoryIndex < 0) {
|
|
1664
|
-
return null;
|
|
1665
|
-
}
|
|
1666
|
-
const focused = this.focusedSeries();
|
|
1667
|
-
const entries = topDown(this.readingsAtCursor()
|
|
1668
|
-
.filter(({ seriesId }) => !focused || seriesId === focused)
|
|
1669
|
-
.map(({ reading }) => reading));
|
|
1670
|
-
if (!entries.length) {
|
|
1671
|
-
return null;
|
|
1672
|
-
}
|
|
1673
|
-
return {
|
|
1674
|
-
category: this.scales.categories()[categoryIndex] ?? '',
|
|
1675
|
-
entries,
|
|
1676
|
-
};
|
|
1677
|
-
}, ...(ngDevMode ? [{ debugName: "axisTooltipContext" }] : /* istanbul ignore next */ []));
|
|
1678
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1679
|
-
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 }, outline: { classPropertyName: "outline", publicName: "outline", 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 }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null }, patterns: { classPropertyName: "patterns", publicName: "patterns", isSignal: true, isRequired: false, transformFunction: null }, stacked: { classPropertyName: "stacked", publicName: "stacked", 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 }, curve: { classPropertyName: "curve", publicName: "curve", 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 } }, outputs: { pointClicked: "pointClicked" }, viewQueries: [{ propertyName: "markerElements", predicate: ["markerEl"], descendants: true, isSignal: true }], exportAs: ["dsLineSeries"], ngImport: i0, template: "<svg:g\n class=\"lines\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-outlined]=\"outline()\"\n (pointerover)=\"onMarkerOver($event)\"\n (pointerout)=\"onMarkerOut($event)\"\n (keydown)=\"onMarkerKey($event)\"\n (click)=\"onMarkerClick($event)\">\n @for (entry of plotted(); track entry.series.id) {\n @let fades = entry.series.area === 'fade';\n\n @if (fades && entry.areaPaths.length) {\n <svg:defs>\n <svg:linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n [attr.id]=\"fadeId(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\">\n <svg:stop\n class=\"fade-start\"\n offset=\"0\" />\n\n <svg:stop\n class=\"fade-end\"\n offset=\"1\" />\n </svg:linearGradient>\n </svg:defs>\n }\n\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n [class.is-fade]=\"fades\"\n [class.is-stacked]=\"stacked()\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\"\n [style.fill]=\"fades ? 'url(#' + fadeId(entry.seriesIndex) + ')' : null\"\n [attr.d]=\"path\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (outline()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-halo\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\" />\n }\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-line\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.stroke]=\"entry.color\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (\n showMarkers() ||\n interactive() ||\n pins()\n ) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n #markerEl\n class=\"series-marker\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"isActiveMarker(marker)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\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()\n ? !scales.cursorOn?.() &&\n isTabStop(entry.series.id, marker.markIndex)\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() ? markerLabel(marker) : null\" />\n }\n }\n }\n\n @if (pinnedMarker(); as marker) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' + marker.x + ',' + (marker.y - pinLift) + ')'\n \" />\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.series-line:not(.is-dashed){stroke-dasharray:1}.series-line:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line:not(.is-dashed){animation-delay:0ms}}.series-line:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo:not(.is-dashed){stroke-dasharray:1}.series-halo:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo:not(.is-dashed){animation-delay:0ms}}.series-halo:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-line.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line.is-dashed{animation-delay:0ms}}.series-line.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo.is-dashed{animation-delay:0ms}}.series-halo.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area{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(--duration-base) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-area{animation-delay:0ms}}.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{animation:ds-chart-mark-settle var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-sweep-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-marker{animation-delay:0ms}}@media not (forced-colors:active){.series-marker:focus{outline:none}}.lines{--_chart-line-width: var(--ds-chart-line-width);--_chart-line-width-bold: var(--ds-chart-line-width-bold);--_chart-dot-radius: var(--ds-chart-dot-radius);--_chart-dot-radius-active: var(--ds-chart-dot-radius-active);--_chart-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,.series-marker.pins{cursor:pointer}.series-area{fill:var(--ds-chart-area-color, var(--_series-area-color));fill-opacity:var(--_chart-area-opacity);stroke:none}.series-area.is-fade{fill-opacity:1}.fade-start,.fade-end{stop-color:var(--ds-chart-area-color, var(--_series-area-color))}.fade-start{stop-opacity:var(--ds-chart-area-fade-opacity)}.fade-end{stop-opacity:0}.series-area.is-stacked{stroke:var(--ds-chart-bg-color);stroke-width:2;stroke-linejoin:round}.lines:has(.series-line.is-dimmed) .series-line:not(.is-dimmed){stroke-width:var(--_chart-line-width-bold)}.series-halo{fill:none;stroke:var(--ds-chart-bg-color);stroke-width:calc(var(--_chart-line-width) + var(--_chart-line-outline, 3px));stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-halo.is-dimmed{opacity:0}.series-line{fill:none;stroke-width:var(--_chart-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{transform-box:fill-box;transform-origin:center;r:var(--_chart-dot-radius)}.lines.is-outlined .series-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.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(--_chart-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, var(--ds-chart-bg-color)));r:var(--_chart-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"], dependencies: [{ kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2634
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2635
|
+
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 }, soleSeries: { classPropertyName: "soleSeries", publicName: "soleSeries", isSignal: true, isRequired: false, transformFunction: null }, axis: { classPropertyName: "axis", publicName: "axis", 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 }, seriesKey: { classPropertyName: "seriesKey", publicName: "seriesKey", isSignal: true, isRequired: false, transformFunction: null }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, runningTotal: { classPropertyName: "runningTotal", publicName: "runningTotal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClicked: "pointClicked" }, viewQueries: [{ propertyName: "barElements", predicate: ["barEl"], descendants: true, isSignal: true }], exportAs: ["dsColumnSeries"], ngImport: i0, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-dimmed]=\"dimmedBySeries()\"\n [class.is-spotlit]=\"spotlit()\"\n [class.is-collapsed]=\"hidden()\"\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 (pointerover)=\"onMarkOver($event)\"\n (pointerout)=\"onMarkOut($event)\"\n (keydown)=\"onMarkKey($event)\"\n (click)=\"onMarkClick($event)\">\n <!-- `userSpaceOnUse` keeps the stripe pitch equal on tall and short columns (the object bounding box\n scales it per mark). The stripe runs down the tile's middle: on its edge the tile clips it to half. -->\n @if (hatchInUse()) {\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=\"4\"\n y1=\"0\"\n x2=\"4\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n }\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"activeMark.index() === index\"\n [class.below-baseline]=\"mark.below\"\n [class.is-pinned]=\"activeMark.pinned() && activeMark.index() === index\"\n [class.is-later]=\"isLater(index)\"\n [class.is-out]=\"isOutsideRange(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-column-key]=\"mark.key\"\n [attr.data-mark-index]=\"hidden() ? null : index\"\n [attr.role]=\"interactive() && !hidden() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() && !hidden()\n ? !scales.cursorOn?.() && index === roving.tabStop()\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() && !hidden() ? entryLabel(mark) : null\"\n (animate.leave)=\"leaveMark($event)\">\n <!-- The pointer target is the whole category slot, so a two-pixel column stays reachable. -->\n @let hit = hitBox(mark);\n\n <svg:rect\n class=\"hit-area\"\n [attr.y]=\"hit.y\"\n [attr.height]=\"hit.height\" />\n\n <svg:g\n #barEl\n class=\"bar\"\n data-morph=\"mark\"\n [attr.data-morph-from]=\"mark.below ? 'top' : null\"\n [style.transform-origin]=\"mark.origin\">\n <!-- `rx` rounds all four corners but the cap belongs on the free end alone; this rect fills the\n two baseline corners back in. Unlike a `<path>`, both keep `y` and `height` interpolable. -->\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 as its fill: a pattern carries its own colour,\n so one shared definition could not take each mark's. -->\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 data-morph=\"hold\"\n text-anchor=\"middle\"\n [style.--_column-value-y]=\"mark.labelY + 'px'\">\n {{ mark.formattedValue }}\n </svg:text>\n }\n\n @if (activeMark.pinned() && activeMark.index() === index) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\" />\n }\n </svg:g>\n }\n\n <!-- One ring for every column, so keyboard focus glides to the next column with the panel. -->\n @if (\n interactive() &&\n !hidden() &&\n focusedMark(); as focused\n ) {\n <svg:g\n class=\"focus-ring\"\n aria-hidden=\"true\"\n dsChartPlaced\n [style.--_column-mark-height]=\"focused.height + 'px'\"\n [style.--_column-x]=\"focused.x + 'px'\">\n <svg:rect\n class=\"focus-ring-shape\"\n [attr.y]=\"focused.top\"\n [attr.height]=\"focused.height\" />\n </svg:g>\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.column .bar{transform-origin:bottom}.bar{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-grow-duration) var(--ds-motion-chart-mark-grow-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.bar{animation-delay:0ms}}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.value{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-grow-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.value{animation-delay:0ms}}@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),transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.columns .column.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.columns.dims-others:not(:has(.column.is-pinned)):has(.column.is-active) .column:not(.is-active),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive,.columns .column.pins{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) );--_chart-hatch-color: var( --ds-chart-hatch-color, var(--ds-chart-bg-color) );--_chart-hatch-width: var(--ds-chart-hatch-width, 1.5px)}.column,.focus-ring{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_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{--_column-hit-start: calc( var(--_column-chart-slot-step) * (var(--_column-slot, 0) - var(--_column-slots, 1) / 2) );width:var(--_column-chart-slot-step);x:calc(var(--_column-hit-start) - var(--_column-slot-offset));fill:transparent}.bar{transform-box:fill-box;transition:filter var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.column.is-active .bar,.columns.is-spotlit:not(.dims-others) .bar{filter:brightness(1.12) saturate(1.1)}.column.is-later,.column.is-out{opacity:var(--ds-chart-dim-opacity)}.columns.is-collapsed{pointer-events:none}.columns.is-collapsed .value{opacity:0;transition:opacity var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.bar-base,.bar-cap,.bar-hatch,.focus-ring-shape{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),width var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),x 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(--_chart-hatch-color);stroke-width:var(--_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{transform:translateY(var(--_column-value-y));transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing);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}}.focus-ring{opacity:0;pointer-events:none}.focus-ring.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.focus-ring-shape{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, var(--ds-chart-bg-color)));rx:var(--_column-chart-cap-radius);fill:none}.focus-ring.placed .focus-ring-shape{transition:y var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),height var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.columns:has(.column.interactive:focus-visible) .focus-ring{opacity:1}@media(forced-colors:active){.focus-ring{display:none}.column.interactive:focus-visible .bar-cap{stroke:Highlight;stroke-width:var(--focus-ring-width);filter:none}}.columns{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.columns.is-dimmed{opacity:var(--ds-chart-dim-opacity)}\n"], dependencies: [{ kind: "component", type: ChartPinMarkerComponent, selector: "g[dsChartPinMarker]" }, { kind: "directive", type: ChartPlacedDirective, selector: "[dsChartPlaced]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1680
2636
|
}
|
|
1681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type:
|
|
2637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, decorators: [{
|
|
1682
2638
|
type: Component,
|
|
1683
|
-
args: [{ selector: 'g[dsLineSeries]', standalone: true, imports: [ChartPinMarkerComponent], exportAs: 'dsLineSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"lines\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-outlined]=\"outline()\"\n (pointerover)=\"onMarkerOver($event)\"\n (pointerout)=\"onMarkerOut($event)\"\n (keydown)=\"onMarkerKey($event)\"\n (click)=\"onMarkerClick($event)\">\n @for (entry of plotted(); track entry.series.id) {\n @let fades = entry.series.area === 'fade';\n\n @if (fades && entry.areaPaths.length) {\n <svg:defs>\n <svg:linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n [attr.id]=\"fadeId(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\">\n <svg:stop\n class=\"fade-start\"\n offset=\"0\" />\n\n <svg:stop\n class=\"fade-end\"\n offset=\"1\" />\n </svg:linearGradient>\n </svg:defs>\n }\n\n @for (path of entry.areaPaths; track $index) {\n <svg:path\n class=\"series-area\"\n [class.is-fade]=\"fades\"\n [class.is-stacked]=\"stacked()\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [style.--_series-area-color]=\"entry.color\"\n [style.fill]=\"fades ? 'url(#' + fadeId(entry.seriesIndex) + ')' : null\"\n [attr.d]=\"path\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (outline()) {\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-halo\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\" />\n }\n }\n }\n\n @for (entry of plotted(); track entry.series.id) {\n @for (path of entry.linePaths; track $index) {\n <svg:path\n class=\"series-line\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.is-dashed]=\"dashFor(entry.seriesIndex) !== null\"\n [attr.stroke-dasharray]=\"dashFor(entry.seriesIndex)\"\n [attr.pathLength]=\"dashFor(entry.seriesIndex) === null ? 1 : null\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\n [attr.d]=\"path\"\n [attr.stroke]=\"entry.color\"\n (animate.leave)=\"leaveMark($event)\" />\n }\n }\n\n @if (\n showMarkers() ||\n interactive() ||\n pins()\n ) {\n @for (entry of plotted(); track entry.series.id) {\n @for (marker of entry.markers; track marker.key) {\n <svg:circle\n #markerEl\n class=\"series-marker\"\n [class.is-dimmed]=\"isDimmed(entry.series.id)\"\n [class.ghost]=\"!showMarkers()\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"isActiveMarker(marker)\"\n [style.--_chart-mark-stagger]=\"seriesStagger(entry.seriesIndex)\"\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()\n ? !scales.cursorOn?.() &&\n isTabStop(entry.series.id, marker.markIndex)\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() ? markerLabel(marker) : null\" />\n }\n }\n }\n\n @if (pinnedMarker(); as marker) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"\n 'translate(' + marker.x + ',' + (marker.y - pinLift) + ')'\n \" />\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.series-line:not(.is-dashed){stroke-dasharray:1}.series-line:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line:not(.is-dashed){animation-delay:0ms}}.series-line:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo:not(.is-dashed){stroke-dasharray:1}.series-halo:not(.is-dashed){animation:ds-chart-line-draw var(--ds-motion-chart-mark-sweep-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo:not(.is-dashed){animation-delay:0ms}}.series-halo:not(.is-dashed).mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-line.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-line.is-dashed{animation-delay:0ms}}.series-line.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-halo.is-dashed{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) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-halo.is-dashed{animation-delay:0ms}}.series-halo.is-dashed.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.series-area{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(--duration-base) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-area{animation-delay:0ms}}.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{animation:ds-chart-mark-settle var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-sweep-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.series-marker{animation-delay:0ms}}@media not (forced-colors:active){.series-marker:focus{outline:none}}.lines{--_chart-line-width: var(--ds-chart-line-width);--_chart-line-width-bold: var(--ds-chart-line-width-bold);--_chart-dot-radius: var(--ds-chart-dot-radius);--_chart-dot-radius-active: var(--ds-chart-dot-radius-active);--_chart-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,.series-marker.pins{cursor:pointer}.series-area{fill:var(--ds-chart-area-color, var(--_series-area-color));fill-opacity:var(--_chart-area-opacity);stroke:none}.series-area.is-fade{fill-opacity:1}.fade-start,.fade-end{stop-color:var(--ds-chart-area-color, var(--_series-area-color))}.fade-start{stop-opacity:var(--ds-chart-area-fade-opacity)}.fade-end{stop-opacity:0}.series-area.is-stacked{stroke:var(--ds-chart-bg-color);stroke-width:2;stroke-linejoin:round}.lines:has(.series-line.is-dimmed) .series-line:not(.is-dimmed){stroke-width:var(--_chart-line-width-bold)}.series-halo{fill:none;stroke:var(--ds-chart-bg-color);stroke-width:calc(var(--_chart-line-width) + var(--_chart-line-outline, 3px));stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-halo.is-dimmed{opacity:0}.series-line{fill:none;stroke-width:var(--_chart-line-width);stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.series-marker{transform-box:fill-box;transform-origin:center;r:var(--_chart-dot-radius)}.lines.is-outlined .series-marker{stroke:var(--ds-chart-bg-color);stroke-width:var(--_chart-line-outline, 3px);paint-order:stroke}.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(--_chart-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, var(--ds-chart-bg-color)));r:var(--_chart-dot-radius-active)}@media(forced-colors:active){.series-line{stroke:CanvasText}.series-marker{fill:CanvasText}}\n"] }]
|
|
1684
|
-
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }],
|
|
2639
|
+
args: [{ selector: 'g[dsColumnSeries]', standalone: true, imports: [ChartPinMarkerComponent, ChartPlacedDirective], exportAs: 'dsColumnSeries', encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg:g\n class=\"columns\"\n [class.dims-others]=\"dimOthers()\"\n [class.is-dimmed]=\"dimmedBySeries()\"\n [class.is-spotlit]=\"spotlit()\"\n [class.is-collapsed]=\"hidden()\"\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 (pointerover)=\"onMarkOver($event)\"\n (pointerout)=\"onMarkOut($event)\"\n (keydown)=\"onMarkKey($event)\"\n (click)=\"onMarkClick($event)\">\n <!-- `userSpaceOnUse` keeps the stripe pitch equal on tall and short columns (the object bounding box\n scales it per mark). The stripe runs down the tile's middle: on its edge the tile clips it to half. -->\n @if (hatchInUse()) {\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=\"4\"\n y1=\"0\"\n x2=\"4\"\n y2=\"8\" />\n </svg:pattern>\n </svg:defs>\n }\n\n @for (mark of marks(); track mark.key; let index = $index) {\n <svg:g\n class=\"column\"\n [class.interactive]=\"interactive()\"\n [class.pins]=\"pins()\"\n [class.is-active]=\"activeMark.index() === index\"\n [class.below-baseline]=\"mark.below\"\n [class.is-pinned]=\"activeMark.pinned() && activeMark.index() === index\"\n [class.is-later]=\"isLater(index)\"\n [class.is-out]=\"isOutsideRange(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-column-key]=\"mark.key\"\n [attr.data-mark-index]=\"hidden() ? null : index\"\n [attr.role]=\"interactive() && !hidden() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() && !hidden()\n ? !scales.cursorOn?.() && index === roving.tabStop()\n ? 0\n : -1\n : null\n \"\n [attr.aria-label]=\"interactive() && !hidden() ? entryLabel(mark) : null\"\n (animate.leave)=\"leaveMark($event)\">\n <!-- The pointer target is the whole category slot, so a two-pixel column stays reachable. -->\n @let hit = hitBox(mark);\n\n <svg:rect\n class=\"hit-area\"\n [attr.y]=\"hit.y\"\n [attr.height]=\"hit.height\" />\n\n <svg:g\n #barEl\n class=\"bar\"\n data-morph=\"mark\"\n [attr.data-morph-from]=\"mark.below ? 'top' : null\"\n [style.transform-origin]=\"mark.origin\">\n <!-- `rx` rounds all four corners but the cap belongs on the free end alone; this rect fills the\n two baseline corners back in. Unlike a `<path>`, both keep `y` and `height` interpolable. -->\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 as its fill: a pattern carries its own colour,\n so one shared definition could not take each mark's. -->\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 data-morph=\"hold\"\n text-anchor=\"middle\"\n [style.--_column-value-y]=\"mark.labelY + 'px'\">\n {{ mark.formattedValue }}\n </svg:text>\n }\n\n @if (activeMark.pinned() && activeMark.index() === index) {\n <svg:g\n dsChartPinMarker\n [attr.transform]=\"'translate(0,' + mark.pinY + ')'\" />\n }\n </svg:g>\n }\n\n <!-- One ring for every column, so keyboard focus glides to the next column with the panel. -->\n @if (\n interactive() &&\n !hidden() &&\n focusedMark(); as focused\n ) {\n <svg:g\n class=\"focus-ring\"\n aria-hidden=\"true\"\n dsChartPlaced\n [style.--_column-mark-height]=\"focused.height + 'px'\"\n [style.--_column-x]=\"focused.x + 'px'\">\n <svg:rect\n class=\"focus-ring-shape\"\n [attr.y]=\"focused.top\"\n [attr.height]=\"focused.height\" />\n </svg:g>\n }\n</svg:g>\n", styles: ["@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}@keyframes ds-chart-pin-pop{0%{scale:.4;opacity:0}}@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.column .bar{transform-origin:bottom}.bar{animation:ds-chart-mark-grow-y var(--ds-motion-chart-mark-grow-duration) var(--ds-motion-chart-mark-grow-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.bar{animation-delay:0ms}}.column.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.value{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--ds-motion-chart-mark-grow-duration) + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.value{animation-delay:0ms}}@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),transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.columns .column.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.columns.dims-others:not(:has(.column.is-pinned)):has(.column.is-active) .column:not(.is-active),.columns.dims-others:has(.column.is-pinned) .column:not(.is-pinned){opacity:var(--ds-chart-dim-opacity)}.columns .column.interactive,.columns .column.pins{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) );--_chart-hatch-color: var( --ds-chart-hatch-color, var(--ds-chart-bg-color) );--_chart-hatch-width: var(--ds-chart-hatch-width, 1.5px)}.column,.focus-ring{--_column-mark-width: min( var(--_column-chart-column-share), var(--_column-chart-column-max-width) );--_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{--_column-hit-start: calc( var(--_column-chart-slot-step) * (var(--_column-slot, 0) - var(--_column-slots, 1) / 2) );width:var(--_column-chart-slot-step);x:calc(var(--_column-hit-start) - var(--_column-slot-offset));fill:transparent}.bar{transform-box:fill-box;transition:filter var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.column.is-active .bar,.columns.is-spotlit:not(.dims-others) .bar{filter:brightness(1.12) saturate(1.1)}.column.is-later,.column.is-out{opacity:var(--ds-chart-dim-opacity)}.columns.is-collapsed{pointer-events:none}.columns.is-collapsed .value{opacity:0;transition:opacity var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing)}.bar-base,.bar-cap,.bar-hatch,.focus-ring-shape{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),width var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing),x 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(--_chart-hatch-color);stroke-width:var(--_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{transform:translateY(var(--_column-value-y));transition:transform var(--ds-motion-chart-mark-duration) var(--ds-motion-chart-mark-easing);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}}.focus-ring{opacity:0;pointer-events:none}.focus-ring.placed{transition:transform var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.focus-ring-shape{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, var(--ds-chart-bg-color)));rx:var(--_column-chart-cap-radius);fill:none}.focus-ring.placed .focus-ring-shape{transition:y var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing),height var(--ds-motion-chart-tooltip-move-duration) var(--ds-motion-chart-tooltip-move-easing)}.columns:has(.column.interactive:focus-visible) .focus-ring{opacity:1}@media(forced-colors:active){.focus-ring{display:none}.column.interactive:focus-visible .bar-cap{stroke:Highlight;stroke-width:var(--focus-ring-width);filter:none}}.columns{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.columns.is-dimmed{opacity:var(--ds-chart-dim-opacity)}\n"] }]
|
|
2640
|
+
}], 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 }] }], soleSeries: [{ type: i0.Input, args: [{ isSignal: true, alias: "soleSeries", required: false }] }], axis: [{ type: i0.Input, args: [{ isSignal: true, alias: "axis", 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 }] }], seriesKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesKey", required: false }] }], highlighted: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlighted", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], runningTotal: [{ type: i0.Input, args: [{ isSignal: true, alias: "runningTotal", required: false }] }], pointClicked: [{ type: i0.Output, args: ["pointClicked"] }], barElements: [{ type: i0.ViewChildren, args: ['barEl', { isSignal: true }] }] } });
|
|
1685
2641
|
|
|
1686
2642
|
/**
|
|
1687
2643
|
* The names of a chart's reference lines, laid out by the same geometry that draws them.
|
|
@@ -1695,11 +2651,11 @@ class ReferenceLabelComponent {
|
|
|
1695
2651
|
thresholds = input([], ...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
1696
2652
|
lines = computed(() => thresholdMarks(this.thresholds(), this.scales.plot(), this.scales.yPosition()).filter((mark) => mark.label !== ''), ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
1697
2653
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1698
|
-
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: "@if (lines().length) {\n <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}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.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-bg-color);stroke-width:
|
|
2654
|
+
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: "@if (lines().length) {\n <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}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.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-bg-color);stroke-width:3px;stroke-linejoin:round}@media(forced-colors:active){.threshold-label{fill:CanvasText;stroke:Canvas}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1699
2655
|
}
|
|
1700
2656
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, decorators: [{
|
|
1701
2657
|
type: Component,
|
|
1702
|
-
args: [{ selector: 'g[dsReferenceLabel]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (lines().length) {\n <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}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.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-bg-color);stroke-width:
|
|
2658
|
+
args: [{ selector: 'g[dsReferenceLabel]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (lines().length) {\n <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}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.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-bg-color);stroke-width:3px;stroke-linejoin:round}@media(forced-colors:active){.threshold-label{fill:CanvasText;stroke:Canvas}}\n"] }]
|
|
1703
2659
|
}], propDecorators: { thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }] } });
|
|
1704
2660
|
|
|
1705
2661
|
let nextReferenceId = 0;
|
|
@@ -1755,11 +2711,11 @@ class SeriesAnnotationComponent {
|
|
|
1755
2711
|
})), plot.left + plot.width);
|
|
1756
2712
|
}, ...(ngDevMode ? [{ debugName: "placed" }] : /* istanbul ignore next */ []));
|
|
1757
2713
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SeriesAnnotationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1758
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: SeriesAnnotationComponent, isStandalone: true, selector: "g[dsSeriesAnnotation]", inputs: { annotations: { classPropertyName: "annotations", publicName: "annotations", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (placed().length) {\n <svg:g class=\"annotations\">\n @for (note of placed(); track note.key) {\n <svg:text\n class=\"annotation\"\n [attr.x]=\"note.x\"\n [attr.y]=\"note.y\"\n [attr.text-anchor]=\"note.anchor\">\n {{ note.label }}\n </svg:text>\n }\n </svg:g>\n}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.annotations{--_chart-annotation-color: var(--ds-chart-annotation-color, var(--text-primary));--_chart-annotation-font-size: var(--ds-chart-annotation-font-size, var(--ds-chart-axis-font-size));--_chart-annotation-font-weight: var(--ds-chart-annotation-font-weight, var(--font-weight-bold));--_chart-annotation-halo-color: var(--ds-chart-annotation-halo-color, var(--ds-chart-bg-color));--_chart-annotation-halo-width: var(--ds-chart-annotation-halo-width, 3px)}.annotation{fill:var(--_chart-annotation-color);font-size:var(--_chart-annotation-font-size);font-weight:var(--_chart-annotation-font-weight);paint-order:stroke;stroke:var(--_chart-annotation-halo-color);stroke-width:var(--_chart-annotation-halo-width);stroke-linejoin:round}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2714
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: SeriesAnnotationComponent, isStandalone: true, selector: "g[dsSeriesAnnotation]", inputs: { annotations: { classPropertyName: "annotations", publicName: "annotations", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (placed().length) {\n <svg:g class=\"annotations\">\n @for (note of placed(); track note.key) {\n <svg:text\n class=\"annotation\"\n [attr.x]=\"note.x\"\n [attr.y]=\"note.y\"\n [attr.text-anchor]=\"note.anchor\">\n {{ note.label }}\n </svg:text>\n }\n </svg:g>\n}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.annotations{--_chart-annotation-color: var(--ds-chart-annotation-color, var(--text-primary));--_chart-annotation-font-size: var(--ds-chart-annotation-font-size, var(--ds-chart-axis-font-size));--_chart-annotation-font-weight: var(--ds-chart-annotation-font-weight, var(--font-weight-bold));--_chart-annotation-halo-color: var(--ds-chart-annotation-halo-color, var(--ds-chart-bg-color));--_chart-annotation-halo-width: var(--ds-chart-annotation-halo-width, 3px)}.annotation{fill:var(--_chart-annotation-color);font-size:var(--_chart-annotation-font-size);font-weight:var(--_chart-annotation-font-weight);paint-order:stroke;stroke:var(--_chart-annotation-halo-color);stroke-width:var(--_chart-annotation-halo-width);stroke-linejoin:round}@media(forced-colors:active){.annotation{fill:CanvasText;stroke:Canvas}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1759
2715
|
}
|
|
1760
2716
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SeriesAnnotationComponent, decorators: [{
|
|
1761
2717
|
type: Component,
|
|
1762
|
-
args: [{ selector: 'g[dsSeriesAnnotation]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (placed().length) {\n <svg:g class=\"annotations\">\n @for (note of placed(); track note.key) {\n <svg:text\n class=\"annotation\"\n [attr.x]=\"note.x\"\n [attr.y]=\"note.y\"\n [attr.text-anchor]=\"note.anchor\">\n {{ note.label }}\n </svg:text>\n }\n </svg:g>\n}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.annotations{--_chart-annotation-color: var(--ds-chart-annotation-color, var(--text-primary));--_chart-annotation-font-size: var(--ds-chart-annotation-font-size, var(--ds-chart-axis-font-size));--_chart-annotation-font-weight: var(--ds-chart-annotation-font-weight, var(--font-weight-bold));--_chart-annotation-halo-color: var(--ds-chart-annotation-halo-color, var(--ds-chart-bg-color));--_chart-annotation-halo-width: var(--ds-chart-annotation-halo-width, 3px)}.annotation{fill:var(--_chart-annotation-color);font-size:var(--_chart-annotation-font-size);font-weight:var(--_chart-annotation-font-weight);paint-order:stroke;stroke:var(--_chart-annotation-halo-color);stroke-width:var(--_chart-annotation-halo-width);stroke-linejoin:round}\n"] }]
|
|
2718
|
+
args: [{ selector: 'g[dsSeriesAnnotation]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (placed().length) {\n <svg:g class=\"annotations\">\n @for (note of placed(); track note.key) {\n <svg:text\n class=\"annotation\"\n [attr.x]=\"note.x\"\n [attr.y]=\"note.y\"\n [attr.text-anchor]=\"note.anchor\">\n {{ note.label }}\n </svg:text>\n }\n </svg:g>\n}\n", styles: ["@layer ds-component-base{:host{box-sizing:border-box;interpolate-size:allow-keywords}*,*:before,*:after{box-sizing:border-box}button,input,select,textarea{font-family:inherit}h1,h2,h3,h4,h5,h6{margin:0}:host(:where(:focus-visible)),: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);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:host(:where(:focus-visible)),:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}}.annotations{--_chart-annotation-color: var(--ds-chart-annotation-color, var(--text-primary));--_chart-annotation-font-size: var(--ds-chart-annotation-font-size, var(--ds-chart-axis-font-size));--_chart-annotation-font-weight: var(--ds-chart-annotation-font-weight, var(--font-weight-bold));--_chart-annotation-halo-color: var(--ds-chart-annotation-halo-color, var(--ds-chart-bg-color));--_chart-annotation-halo-width: var(--ds-chart-annotation-halo-width, 3px)}.annotation{fill:var(--_chart-annotation-color);font-size:var(--_chart-annotation-font-size);font-weight:var(--_chart-annotation-font-weight);paint-order:stroke;stroke:var(--_chart-annotation-halo-color);stroke-width:var(--_chart-annotation-halo-width);stroke-linejoin:round}@media(forced-colors:active){.annotation{fill:CanvasText;stroke:Canvas}}\n"] }]
|
|
1763
2719
|
}], propDecorators: { annotations: [{ type: i0.Input, args: [{ isSignal: true, alias: "annotations", required: false }] }] } });
|
|
1764
2720
|
|
|
1765
2721
|
/**
|