@ids-group-ltd/ids-design-system 0.14.8 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1145 -234
- package/components.md +122 -53
- package/docs/agent/INDEX.md +5 -3
- package/docs/agent/charts/column-series-component.md +1 -1
- package/docs/agent/charts/ds-bar-chart.md +7 -4
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-column-chart.md +2 -1
- package/docs/agent/charts/ds-funnel-chart.md +1 -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 +2 -2
- 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-loading-overlay.md +2 -0
- package/docs/agent/feedback/ds-skeleton.md +1 -1
- 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 +2 -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 +4 -4
- package/docs/agent/foundations/tokens.md +1 -1
- package/docs/agent/navigation/ds-pagination.md +2 -1
- package/docs/agent/overlays/ds-bottom-sheet.md +1 -1
- package/docs/agent/overlays/ds-definition-term.md +10 -0
- package/docs/agent/overlays/ds-drawer.md +1 -1
- package/docs/agent/overlays/ds-info-hint.md +29 -0
- package/docs/agent/overlays/ds-menu.md +1 -1
- package/docs/agent/overlays/ds-modal-card.md +1 -1
- package/docs/agent/overlays/ds-modal.md +19 -1
- package/docs/agent/overlays/ds-tooltip-panel.md +1 -1
- package/docs/agent/overlays/ds-tooltip.md +3 -3
- package/docs/agent/tables/ds-table-columns.md +2 -0
- package/docs/agent/tables/ds-table.md +4 -3
- package/eslint/deprecated-api.json +889 -0
- package/eslint/index.mjs +394 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- 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-app-layout.mjs +6 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +27 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.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 +169 -37
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.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-calendar-day.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.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 +875 -90
- 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 +2183 -1232
- 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 +50 -11
- 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-definition-term.mjs +107 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-definition-term.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +5 -15
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +2 -2
- 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-filter-bar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +11 -22
- 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 +51 -21
- 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 +110 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs.map +1 -0
- 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-layout.mjs +6 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +41 -46
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +183 -31
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +21 -26
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +27 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.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-page-footer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.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-password-rules.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +106 -29
- 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 +7 -4
- 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 +12 -7
- 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 +140 -26
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.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 +29 -9
- 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-sidenav-footer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +6 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- 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 +5 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-sparkline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.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 +36 -18
- 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 +193 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.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 +26 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +20 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +434 -157
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +18 -11
- 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 +323 -68
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +27 -83
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +3 -0
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.10.0.json +79 -21
- package/migrations/0.10.1.json +38 -21
- package/migrations/0.10.2.json +44 -7
- package/migrations/0.10.3.json +7 -5
- package/migrations/0.11.0.json +10 -7
- package/migrations/0.11.1.json +25 -14
- package/migrations/0.11.2.json +3 -3
- package/migrations/0.11.3.json +9 -6
- package/migrations/0.11.4.json +13 -12
- package/migrations/0.12.1.json +41 -14
- package/migrations/0.12.2.json +7 -6
- package/migrations/0.12.3.json +3 -3
- package/migrations/0.13.0.json +11 -11
- package/migrations/0.13.1.json +60 -8
- package/migrations/0.13.2.json +98 -44
- package/migrations/0.13.3.json +46 -16
- package/migrations/0.13.4.json +23 -22
- package/migrations/0.14.0.json +5 -5
- package/migrations/0.14.1.json +5 -5
- package/migrations/0.14.2.json +1 -1
- package/migrations/0.14.4.json +6 -5
- package/migrations/0.14.5.json +13 -7
- package/migrations/0.14.6.json +2 -2
- package/migrations/0.14.8.json +26 -2
- package/migrations/0.15.0.json +999 -0
- package/migrations/0.15.1.json +738 -0
- package/migrations/0.2.0.json +2 -2
- package/migrations/0.3.0.json +43 -6
- package/migrations/0.4.0.json +95 -13
- package/migrations/0.5.0.json +116 -10
- package/migrations/0.5.1.json +97 -11
- package/migrations/0.6.0.json +30 -1
- package/migrations/0.6.1.json +22 -1
- package/migrations/0.6.2.json +8 -4
- package/migrations/0.6.3.json +17 -5
- package/migrations/0.7.0.json +58 -9
- package/migrations/0.7.1.json +62 -8
- package/migrations/0.8.0.json +60 -12
- package/migrations/0.9.0.json +68 -25
- package/migrations/0.9.1.json +1 -1
- package/migrations/README.md +57 -3
- package/package.json +27 -1
- package/schematics/check-overrides/index.cjs +4 -11
- package/schematics/check-overrides/scan.cjs +12 -1
- package/schematics/check-overrides/surface.json +94 -11
- package/schematics/ng-add/index.cjs +7 -1
- package/stylelint/deprecated-tokens.json +2711 -0
- package/stylelint/index.mjs +94 -0
- package/stylelint/since-version.mjs +26 -0
- package/styles/_chart-frame.scss +14 -0
- package/styles/_chart-interactive.scss +26 -1
- package/styles/_chart-motion.scss +50 -17
- package/styles/_chip-row.scss +5 -2
- package/styles/_clear-button.scss +2 -0
- package/styles/_component-base.scss +56 -0
- package/styles/_dismiss-button.scss +16 -0
- package/styles/_dropdown-overlay.scss +19 -0
- package/styles/_focus.scss +4 -1
- package/styles/_link.scss +35 -12
- package/styles/_overlay-motion.scss +4 -6
- package/styles/_pinned.scss +43 -0
- package/styles/_skeleton-shimmer.scss +2 -8
- package/styles/_table-controls.scss +4 -0
- package/styles/_target.scss +40 -0
- package/styles/_text-clip.scss +23 -4
- package/styles/_tokens.scss +3 -1
- package/styles/_typography.scss +2 -0
- package/styles/_visually-hidden.scss +2 -0
- package/styles/ds.scss +0 -1
- package/themes/README.md +60 -7
- package/themes/_semantic.scss +5 -8
- package/themes/dark/_theme.scss +5 -8
- 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 +6 -1
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +74 -4
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +3 -2
- 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 +87 -7
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +207 -29
- 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 +30 -4
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-definition-term.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +0 -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 +7 -6
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +22 -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 +23 -0
- 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 +18 -7
- package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +14 -3
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +0 -2
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +6 -1
- 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 +26 -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 +52 -10
- 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 +6 -1
- 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 +39 -9
- 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 +54 -24
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +9 -2
- package/types/ids-group-ltd-ids-design-system-components.d.ts +135 -35
- package/types/ids-group-ltd-ids-design-system-core.d.ts +46 -23
- package/types/ids-group-ltd-ids-design-system.d.ts +6 -3
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
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, leaveMark, CHART_TOOLTIP_LINGER_MS, chartValueFormat, listenForMarkFocus, CHART_SERIES_COLORS, lineSegments, linePath, areaPath, bandPath, staggerDelay, tweenMarks, formatPercent, 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 {
|
|
6
|
-
import {
|
|
7
|
-
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';
|
|
8
7
|
|
|
9
8
|
const CHART_DEFAULT_TICK_COUNT = 5;
|
|
10
9
|
const CHART_AXIS_LABEL_GAP = 8;
|
|
@@ -18,6 +17,7 @@ const CHART_BAND_PADDING = 0.3;
|
|
|
18
17
|
* @internal */
|
|
19
18
|
const CHART_FALLBACK_WIDTH = 640;
|
|
20
19
|
const CHART_DEFAULT_PLOT_HEIGHT = 240;
|
|
20
|
+
/** Width of the value-axis label gutter a chart draws when none is set. @internal */
|
|
21
21
|
const CHART_DEFAULT_AXIS_GUTTER = 46;
|
|
22
22
|
const CHART_DEFAULT_VALUE_SPACE = 20;
|
|
23
23
|
/** Room past the last band, so a mark centred on it is not cut by the viewBox edge. */
|
|
@@ -265,1068 +265,2004 @@ 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
|
+
}
|
|
274
297
|
|
|
275
298
|
const CHART_SCALES = new InjectionToken('CHART_SCALES');
|
|
276
299
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
300
|
+
let nextSeriesId$1 = 0;
|
|
301
|
+
// The active marker's default radius, `--chart-dot-radius-active`.
|
|
302
|
+
const PIN_MARKER_CLEARANCE = 6;
|
|
303
|
+
// From the higher end of a thickened change to the baseline of its percentage.
|
|
304
|
+
const CHANGE_LABEL_GAP = 10;
|
|
305
|
+
// View units between two samples of a line; a travelling marker interpolates between them.
|
|
306
|
+
const PATH_SAMPLE_STEP = 2;
|
|
307
|
+
const sampledPaths = new WeakMap();
|
|
308
|
+
// Read once per geometry: every `getPointAtLength` forces style and layout.
|
|
309
|
+
function samplesOf(path) {
|
|
310
|
+
const geometry = `${path.getAttribute('d')}|${path.style.getPropertyValue('d')}`;
|
|
311
|
+
const cached = sampledPaths.get(path);
|
|
312
|
+
if (cached?.geometry === geometry) {
|
|
313
|
+
return cached;
|
|
314
|
+
}
|
|
315
|
+
const total = path.getTotalLength();
|
|
316
|
+
const count = Math.max(2, Math.ceil(total / PATH_SAMPLE_STEP) + 1);
|
|
317
|
+
const samples = {
|
|
318
|
+
geometry,
|
|
319
|
+
xs: new Float64Array(count),
|
|
320
|
+
ys: new Float64Array(count),
|
|
321
|
+
lengths: new Float64Array(count),
|
|
322
|
+
};
|
|
323
|
+
for (let index = 0; index < count; index++) {
|
|
324
|
+
const length = (total * index) / (count - 1);
|
|
325
|
+
const point = path.getPointAtLength(length);
|
|
326
|
+
samples.xs[index] = point.x;
|
|
327
|
+
samples.ys[index] = point.y;
|
|
328
|
+
samples.lengths[index] = length;
|
|
329
|
+
}
|
|
330
|
+
// Mid-glide the drawn line is not the one its `d` names.
|
|
331
|
+
if (path.getAnimations().length === 0) {
|
|
332
|
+
sampledPaths.set(path, samples);
|
|
333
|
+
}
|
|
334
|
+
return samples;
|
|
335
|
+
}
|
|
336
|
+
// The first index whose value reaches `target`, over ascending values.
|
|
337
|
+
function firstReaching(values, target) {
|
|
338
|
+
let low = 0;
|
|
339
|
+
let high = values.length - 1;
|
|
340
|
+
while (low < high) {
|
|
341
|
+
const middle = (low + high) >> 1;
|
|
342
|
+
if (values[middle] < target) {
|
|
343
|
+
low = middle + 1;
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
high = middle;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return low;
|
|
350
|
+
}
|
|
351
|
+
function shareBetween(values, index, target) {
|
|
352
|
+
const span = index === 0 ? 0 : values[index] - values[index - 1];
|
|
353
|
+
return span > 0 ? (target - values[index - 1]) / span : 1;
|
|
354
|
+
}
|
|
355
|
+
function interpolate(values, index, share) {
|
|
356
|
+
return index === 0
|
|
357
|
+
? values[0]
|
|
358
|
+
: values[index - 1] + (values[index] - values[index - 1]) * share;
|
|
359
|
+
}
|
|
360
|
+
// Distance along a line drawn left to right at which it reaches `x`; on a vertical run at `x` (a
|
|
361
|
+
// step's riser), the sample nearest `y`.
|
|
362
|
+
function lengthAt(samples, x, y) {
|
|
363
|
+
const index = firstReaching(samples.xs, x);
|
|
364
|
+
let nearest = index;
|
|
365
|
+
for (let candidate = index + 1; candidate < samples.xs.length && samples.xs[candidate] - x < 0.5; candidate++) {
|
|
366
|
+
if (Math.abs(samples.ys[candidate] - y) < Math.abs(samples.ys[nearest] - y)) {
|
|
367
|
+
nearest = candidate;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (nearest !== index) {
|
|
371
|
+
return samples.lengths[nearest];
|
|
372
|
+
}
|
|
373
|
+
return interpolate(samples.lengths, index, shareBetween(samples.xs, index, x));
|
|
374
|
+
}
|
|
375
|
+
function pointAtLength(samples, length) {
|
|
376
|
+
const index = firstReaching(samples.lengths, length);
|
|
377
|
+
const share = shareBetween(samples.lengths, index, length);
|
|
378
|
+
return {
|
|
379
|
+
x: interpolate(samples.xs, index, share),
|
|
380
|
+
y: interpolate(samples.ys, index, share),
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
// The drawn piece of a series that spans both x positions; a gap between them leaves none.
|
|
384
|
+
function lineThrough(paths, fromX, toX) {
|
|
385
|
+
const low = Math.min(fromX, toX);
|
|
386
|
+
const high = Math.max(fromX, toX);
|
|
387
|
+
for (const path of paths) {
|
|
388
|
+
const samples = samplesOf(path);
|
|
389
|
+
if (samples.xs[0] <= low + 0.5 &&
|
|
390
|
+
samples.xs[samples.xs.length - 1] >= high - 0.5) {
|
|
391
|
+
return samples;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
// The new keys in order, each removed key placed after the key it followed.
|
|
397
|
+
function mergedKeys(previous, next) {
|
|
398
|
+
const merged = [...next];
|
|
399
|
+
const kept = new Set(next);
|
|
400
|
+
previous.forEach((key, index) => {
|
|
401
|
+
if (kept.has(key)) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const before = previous
|
|
405
|
+
.slice(0, index)
|
|
406
|
+
.reverse()
|
|
407
|
+
.find((candidate) => merged.includes(candidate));
|
|
408
|
+
merged.splice(before === undefined ? 0 : merged.indexOf(before) + 1, 0, key);
|
|
409
|
+
});
|
|
410
|
+
return merged;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* One line per series, drawn against the scales `ds-chart` supplies, on either value axis.
|
|
414
|
+
*
|
|
415
|
+
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants.
|
|
416
|
+
* Written as `<svg:g dsLineSeries>`.
|
|
417
|
+
*/
|
|
418
|
+
class LineSeriesComponent {
|
|
419
|
+
leaveMark = leaveMark;
|
|
420
|
+
scales = inject(CHART_SCALES);
|
|
421
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this element (NG0950). */
|
|
422
|
+
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
423
|
+
/** Draws a round marker at every reading; reads better off past roughly twenty points. */
|
|
424
|
+
showMarkers = input(true, { ...(ngDevMode ? { debugName: "showMarkers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
425
|
+
/** Lays the line and markers on a background-colour band so they stay legible where they cross other marks. */
|
|
426
|
+
outline = input(true, { ...(ngDevMode ? { debugName: "outline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
427
|
+
/** Turns on the click affordance (pointer cursor and hover tint). `pointClicked` fires either way. */
|
|
428
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
429
|
+
/** Holds the clicked mark and its tooltip until a second click, Escape or a press outside. Unset
|
|
430
|
+
* falls back to `DS_CONFIG.chart.pinOnClick`, then `true`; the category cursor holds the category instead. */
|
|
431
|
+
pinOnClick = input(null, { ...(ngDevMode ? { debugName: "pinOnClick" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? null : booleanAttribute(value)) });
|
|
292
432
|
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
|
|
433
|
+
pins = computed(() => this.pinOnClickResolved() && !this.scales.cursorOn?.(), ...(ngDevMode ? [{ debugName: "pins" }] : /* istanbul ignore next */ []));
|
|
434
|
+
/** Fades every series but the one under the pointer or singled out by `highlighted`. Off by default:
|
|
435
|
+
* it costs separation between the rest. */
|
|
436
|
+
dimOthers = input(false, { ...(ngDevMode ? { debugName: "dimOthers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
437
|
+
/** The series to single out, as hovering one of its markers does: it draws bold, and under
|
|
438
|
+
* `dimOthers` the others fade. */
|
|
439
|
+
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
440
|
+
/** On the hovered reading, thickens the stretches from the reading before it and to the reading
|
|
441
|
+
* after it, each in its own rising or falling colour (`--ds-chart-positive-color`,
|
|
442
|
+
* `--ds-chart-negative-color`) and with its own change in percent. With several series it follows the one singled out: hovered, focused or highlighted. */
|
|
443
|
+
showChange = input(false, { ...(ngDevMode ? { debugName: "showChange" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
444
|
+
/** A dash pattern per series, in series order. A series past the end, or given `''`, draws solid. */
|
|
445
|
+
patterns = input([], ...(ngDevMode ? [{ debugName: "patterns" }] : /* istanbul ignore next */ []));
|
|
446
|
+
/** Fills each area from the series below it rather than from the baseline (stacked plots). */
|
|
447
|
+
stacked = input(false, { ...(ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
448
|
+
dashFor(seriesIndex) {
|
|
449
|
+
return this.patterns()[seriesIndex] || null;
|
|
450
|
+
}
|
|
451
|
+
/** Milliseconds between one series' entrance and the next, narrowed to fit the stagger budget; `0` is off. */
|
|
452
|
+
staggerMs = input(40, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
453
|
+
/** What a `null` reading draws: `'break'` leaves a hole in the line, `'zero'` plots a point at zero. */
|
|
454
|
+
gaps = input('break', ...(ngDevMode ? [{ debugName: "gaps" }] : /* istanbul ignore next */ []));
|
|
455
|
+
/** How the line joins its readings: `'linear'` (default) asserts nothing between them; `'step'`
|
|
456
|
+
* holds each reading to the next; `'smooth'` is a monotone cubic that draws no peak the data lacks. */
|
|
457
|
+
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
458
|
+
/** Whether a hovered or focused reading opens a tooltip: `'item'` names the marker, `'axis'` every
|
|
459
|
+
* series at the category, turning the container's category cursor on under `cursor="auto"`. */
|
|
460
|
+
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
461
|
+
/** Where an `'axis'` panel hangs: `'reading'` over the highest reading in the category; `'pointer'` follows the cursor. */
|
|
462
|
+
tooltipAnchor = input('reading', ...(ngDevMode ? [{ debugName: "tooltipAnchor" }] : /* istanbul ignore next */ []));
|
|
463
|
+
/** Milliseconds the panel survives the pointer leaving the marker within the chart. */
|
|
464
|
+
tooltipLingerMs = input(CHART_TOOLTIP_LINGER_MS, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
465
|
+
/** Formats every value this series prints: `'tick'` for an axis label, `'tooltip'` for a value in full. */
|
|
466
|
+
valueFormat = input(chartValueFormat(injectDsLocale()), ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
467
|
+
/** The clicked reading, its series and position in `categories`. Fires on click and Enter or Space, whatever `interactive` says. */
|
|
468
|
+
pointClicked = output();
|
|
469
|
+
domainId = `line-series-${nextSeriesId$1++}`;
|
|
470
|
+
fadeId(seriesIndex) {
|
|
471
|
+
return `${this.domainId}-fade-${seriesIndex}`;
|
|
472
|
+
}
|
|
324
473
|
constructor() {
|
|
325
|
-
super();
|
|
326
|
-
effect((onCleanup) => {
|
|
327
|
-
if (this.settled() || this.measuredWidth() === 0) {
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
let first = 0;
|
|
331
|
-
let second = 0;
|
|
332
|
-
// Outside the zone: under zone.js each frame callback is a full application tick.
|
|
333
|
-
this.zone.runOutsideAngular(() => {
|
|
334
|
-
first = requestAnimationFrame(() => {
|
|
335
|
-
second = requestAnimationFrame(() => this.settled.set(true));
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
onCleanup(() => {
|
|
339
|
-
cancelAnimationFrame(first);
|
|
340
|
-
cancelAnimationFrame(second);
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
// Before the view drops the stops past the new end, while the focused one is still in the DOM.
|
|
344
474
|
effect(() => {
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
this.cursorState.release();
|
|
349
|
-
this.cursorState.setIndex(last);
|
|
350
|
-
}
|
|
351
|
-
if (this.roving() > last && this.keyboardFocusInside()) {
|
|
352
|
-
this.refocusStop = true;
|
|
475
|
+
for (const axis of ['primary', 'secondary']) {
|
|
476
|
+
for (const hidden of [false, true]) {
|
|
477
|
+
this.scales.reportDomain(this.reportIdOf(axis, hidden), this.valuesOn(axis, hidden), axis, hidden);
|
|
353
478
|
}
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
afterRenderEffect(() => {
|
|
357
|
-
this.categories();
|
|
358
|
-
if (this.refocusStop) {
|
|
359
|
-
this.refocusStop = false;
|
|
360
|
-
untracked(() => this.focusStop(this.focusedCategory()));
|
|
361
479
|
}
|
|
362
480
|
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
481
|
+
this.scales.reportTooltip(this.domainId, {
|
|
482
|
+
context: this.tooltipContext,
|
|
483
|
+
origin: this.tooltipOrigin,
|
|
484
|
+
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
485
|
+
readsCategory: computed(() => this.tooltip() === 'axis'),
|
|
486
|
+
axisOrigin: this.topReadingElement,
|
|
487
|
+
axisReadingY: this.topReadingY,
|
|
488
|
+
axisEntries: this.axisEntries,
|
|
489
|
+
axisPointElements: this.axisPointElements,
|
|
490
|
+
axisReadout: this.axisReadout,
|
|
491
|
+
valuesByCategory: this.valuesByCategory,
|
|
368
492
|
});
|
|
369
|
-
// Read phase: every `getComputedTextLength` before any write, or each label forces a layout.
|
|
370
493
|
afterRenderEffect({
|
|
371
|
-
|
|
372
|
-
this.
|
|
373
|
-
this.
|
|
374
|
-
this.
|
|
375
|
-
this.measuredCategoryLabelWidth.set(this.widestLabel('.category-label'));
|
|
494
|
+
write: () => {
|
|
495
|
+
this.scales.activeIndex();
|
|
496
|
+
this.plotted();
|
|
497
|
+
untracked(() => this.zone.runOutsideAngular(() => this.moveTravelMarkers()));
|
|
376
498
|
},
|
|
377
499
|
});
|
|
378
500
|
afterRenderEffect({
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
? this.host.nativeElement.querySelector('[dschartpinmarker]')
|
|
383
|
-
: null;
|
|
384
|
-
const rise = origin instanceof Element && pin
|
|
385
|
-
? origin.getBoundingClientRect().top -
|
|
386
|
-
pin.getBoundingClientRect().top
|
|
387
|
-
: 0;
|
|
388
|
-
this.pinRise.set(Math.max(0, Math.round(rise)));
|
|
501
|
+
write: () => {
|
|
502
|
+
const plotted = this.plotted();
|
|
503
|
+
untracked(() => this.zone.runOutsideAngular(() => this.morphOnCategoryChange(plotted)));
|
|
389
504
|
},
|
|
390
505
|
});
|
|
506
|
+
listenForMarkFocus(inject(ElementRef), (event, hit) => this.onMarkerFocus(event, hit), () => {
|
|
507
|
+
this.focusedSeries.set(null);
|
|
508
|
+
this.activeMark.leave();
|
|
509
|
+
this.scales.setActiveIndex(-1);
|
|
510
|
+
});
|
|
391
511
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
return Math.ceil(widest);
|
|
399
|
-
}
|
|
400
|
-
/** Two plots stacked on a shared category axis. */
|
|
401
|
-
stacked = computed(() => this.secondaryAxisMode() === 'split' && this.hasSecondaryAxis(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
402
|
-
viewHeight = computed(() => chartViewHeight(this.plotHeight(), this.valueSpace(), this.reachesBelowZero()) + (this.stacked() ? this.plotHeight() + CHART_STACKED_PLOT_GAP : 0), ...(ngDevMode ? [{ debugName: "viewHeight" }] : /* istanbul ignore next */ []));
|
|
403
|
-
/** One viewBox unit is one CSS pixel, so lengths inside the plot hold at every width. */
|
|
404
|
-
viewBox = computed(() => `0 0 ${this.viewWidth()} ${this.viewHeight()}`, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
405
|
-
/** Widest tick label as rendered, in CSS pixels. Zero until the first read and under SSR. */
|
|
406
|
-
measuredLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredLabelWidth" }] : /* istanbul ignore next */ []));
|
|
407
|
-
measuredCategoryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredCategoryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
408
|
-
/** `axisGutter` is the floor: compact numbers are wider in some locales and the SVG clips overflow. */
|
|
409
|
-
effectiveAxisGutter = computed(() => Math.max(this.axisGutter(), this.measuredLabelWidth() + CHART_AXIS_LABEL_GAP + this.axisTitleGutter()), ...(ngDevMode ? [{ debugName: "effectiveAxisGutter" }] : /* istanbul ignore next */ []));
|
|
410
|
-
/** A rotated axis title shares the tick gutter; its width is its line height. */
|
|
411
|
-
axisTitleGutter = computed(() => this.axisLabel() ? CHART_AXIS_TITLE_BAND : 0, ...(ngDevMode ? [{ debugName: "axisTitleGutter" }] : /* istanbul ignore next */ []));
|
|
412
|
-
axisTitleX = computed(() => CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "axisTitleX" }] : /* istanbul ignore next */ []));
|
|
413
|
-
secondaryTitleX = computed(() => this.viewWidth() - CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "secondaryTitleX" }] : /* istanbul ignore next */ []));
|
|
414
|
-
measuredSecondaryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredSecondaryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
415
|
-
/** Right-hand label room only when the second axis is drawn there; a stacked one is on the left. */
|
|
416
|
-
rightGutter = computed(() => this.hasSecondaryAxis() && !this.stacked()
|
|
417
|
-
? Math.max(this.axisGutter(), this.measuredSecondaryLabelWidth() +
|
|
418
|
-
CHART_AXIS_LABEL_GAP +
|
|
419
|
-
this.secondaryTitleGutter())
|
|
420
|
-
: CHART_EDGE_GUTTER, ...(ngDevMode ? [{ debugName: "rightGutter" }] : /* istanbul ignore next */ []));
|
|
421
|
-
secondaryTitleGutter = computed(() => this.secondaryAxisLabel() && this.hasSecondaryAxis()
|
|
422
|
-
? CHART_AXIS_TITLE_BAND
|
|
423
|
-
: 0, ...(ngDevMode ? [{ debugName: "secondaryTitleGutter" }] : /* istanbul ignore next */ []));
|
|
424
|
-
plot = computed(() => chartPlot(this.viewWidth(), this.plotHeight(), this.effectiveAxisGutter(), this.valueSpace(), this.rightGutter()), ...(ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []));
|
|
425
|
-
secondaryPlot = computed(() => {
|
|
426
|
-
const plot = this.plot();
|
|
427
|
-
return this.stacked()
|
|
428
|
-
? { ...plot, top: plot.top + plot.height + CHART_STACKED_PLOT_GAP }
|
|
429
|
-
: plot;
|
|
430
|
-
}, ...(ngDevMode ? [{ debugName: "secondaryPlot" }] : /* istanbul ignore next */ []));
|
|
431
|
-
reportedDomains = signal(new Map(), ...(ngDevMode ? [{ debugName: "reportedDomains" }] : /* istanbul ignore next */ []));
|
|
432
|
-
reportDomain(id, values, axis = 'primary') {
|
|
433
|
-
this.reportedDomains.update((reported) => new Map(reported).set(id, { axis, values }));
|
|
434
|
-
}
|
|
435
|
-
valuesOn(axis) {
|
|
436
|
-
const found = [];
|
|
437
|
-
for (const report of this.reportedDomains().values()) {
|
|
438
|
-
if (report.axis === axis) {
|
|
439
|
-
found.push(report.values);
|
|
440
|
-
}
|
|
512
|
+
ngOnDestroy() {
|
|
513
|
+
this.scales.releaseTooltip(this.domainId);
|
|
514
|
+
for (const axis of ['primary', 'secondary']) {
|
|
515
|
+
this.scales.releaseDomain(this.reportIdOf(axis, false));
|
|
516
|
+
this.scales.releaseDomain(this.reportIdOf(axis, true));
|
|
441
517
|
}
|
|
442
|
-
return found;
|
|
443
518
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
next.delete(id);
|
|
448
|
-
return next;
|
|
449
|
-
});
|
|
519
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs(), () => this.scales.hoverDelayMs?.() ?? 0);
|
|
520
|
+
reportIdOf(axis, hidden) {
|
|
521
|
+
return `${this.domainId}-${axis}${hidden ? '-hidden' : ''}`;
|
|
450
522
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
reportTooltip(id, source) {
|
|
457
|
-
this.tooltipSources.update((sources) => new Map(sources).set(id, source));
|
|
523
|
+
valuesOn(axis, hidden) {
|
|
524
|
+
return this.data()
|
|
525
|
+
.filter((series) => (series.axis ?? 'primary') === axis &&
|
|
526
|
+
(series.hidden ?? false) === hidden)
|
|
527
|
+
.flatMap((series) => series.data.filter((value) => value !== null));
|
|
458
528
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
529
|
+
/** A `null` past the end is a missing reading. */
|
|
530
|
+
readingsOf(series, count) {
|
|
531
|
+
const zeroed = this.gaps() === 'zero';
|
|
532
|
+
const readings = [];
|
|
533
|
+
for (let index = 0; index < count; index++) {
|
|
534
|
+
const raw = series.data[index];
|
|
535
|
+
const reading = typeof raw === 'number' && Number.isFinite(raw) ? raw : null;
|
|
536
|
+
readings.push(reading === null && zeroed ? 0 : reading);
|
|
537
|
+
}
|
|
538
|
+
return readings;
|
|
465
539
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
540
|
+
plotted = computed(() => {
|
|
541
|
+
const toX = this.scales.xPosition();
|
|
542
|
+
const primaryY = this.scales.yPosition();
|
|
543
|
+
const secondaryY = this.scales.secondaryYPosition();
|
|
544
|
+
const categories = this.scales.categories();
|
|
545
|
+
const keys = categoryKeys(categories);
|
|
546
|
+
let markerIndex = 0;
|
|
547
|
+
return this.data().map((series, index) => {
|
|
548
|
+
const secondary = (series.axis ?? 'primary') === 'secondary';
|
|
549
|
+
const toY = secondary ? secondaryY : primaryY;
|
|
550
|
+
const color = series.color ?? CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
551
|
+
const points = this.readingsOf(series, categories.length).map((value, categoryIndex) => value === null
|
|
552
|
+
? null
|
|
553
|
+
: {
|
|
554
|
+
categoryIndex,
|
|
555
|
+
x: toX(categoryIndex),
|
|
556
|
+
y: toY(value),
|
|
557
|
+
value,
|
|
558
|
+
});
|
|
559
|
+
const segments = lineSegments(points);
|
|
560
|
+
const format = this.valueFormat();
|
|
561
|
+
const curve = this.curve();
|
|
562
|
+
return {
|
|
563
|
+
series,
|
|
564
|
+
color,
|
|
565
|
+
seriesIndex: index,
|
|
566
|
+
linePaths: segments.map((segment) => linePath(segment, curve)),
|
|
567
|
+
areaPaths: series.area
|
|
568
|
+
? this.areaPathsFor(series, segments, toX, toY, curve)
|
|
569
|
+
: [],
|
|
570
|
+
markers: points
|
|
571
|
+
.filter((point) => point !== null)
|
|
572
|
+
.map((point) => ({
|
|
573
|
+
key: `${series.id}-${keys[point.categoryIndex]}`,
|
|
574
|
+
categoryKey: keys[point.categoryIndex],
|
|
575
|
+
markIndex: markerIndex++,
|
|
576
|
+
x: point.x,
|
|
577
|
+
y: point.y,
|
|
578
|
+
value: point.value,
|
|
579
|
+
category: categories[point.categoryIndex] ?? '',
|
|
580
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
581
|
+
seriesLabel: series.label,
|
|
582
|
+
seriesId: series.id,
|
|
583
|
+
categoryIndex: point.categoryIndex,
|
|
584
|
+
color,
|
|
585
|
+
hidden: series.hidden ?? false,
|
|
586
|
+
})),
|
|
587
|
+
};
|
|
588
|
+
});
|
|
589
|
+
}, ...(ngDevMode ? [{ debugName: "plotted" }] : /* istanbul ignore next */ []));
|
|
590
|
+
visibleCount = computed(() => this.data().filter((series) => !series.hidden).length, ...(ngDevMode ? [{ debugName: "visibleCount" }] : /* istanbul ignore next */ []));
|
|
591
|
+
areaPathsFor(series, segments, toX, toY, curve) {
|
|
592
|
+
const lower = series.lower;
|
|
593
|
+
if (!lower) {
|
|
594
|
+
return segments
|
|
595
|
+
.map((segment) => areaPath(segment, toY(0), curve))
|
|
596
|
+
.filter((path) => path.length > 0);
|
|
472
597
|
}
|
|
473
|
-
const
|
|
474
|
-
return this.composed() || readsCategory ? 'category' : 'none';
|
|
475
|
-
}, ...(ngDevMode ? [{ debugName: "cursorResolved" }] : /* istanbul ignore next */ []));
|
|
476
|
-
cursorOn = computed(() => this.cursorResolved() === 'category', ...(ngDevMode ? [{ debugName: "cursorOn" }] : /* istanbul ignore next */ []));
|
|
477
|
-
/** The tooltip context to show, if any; at most one mark has one at a time. */
|
|
478
|
-
activeTooltip = computed(() => [...this.tooltipSources().values()].find((source) => source.context() !== null) ?? null, ...(ngDevMode ? [{ debugName: "activeTooltip" }] : /* istanbul ignore next */ []));
|
|
479
|
-
// By source and position, not label: two marks may read under one label.
|
|
480
|
-
pickedKey = signal(null, ...(ngDevMode ? [{ debugName: "pickedKey" }] : /* istanbul ignore next */ []));
|
|
481
|
-
pickedReading = computed(() => {
|
|
482
|
-
const picked = this.pickedKey();
|
|
483
|
-
return picked === null
|
|
598
|
+
const lowerSegments = lineSegments(lower.map((value, categoryIndex) => value === null
|
|
484
599
|
? null
|
|
485
|
-
:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
600
|
+
: {
|
|
601
|
+
categoryIndex,
|
|
602
|
+
x: toX(categoryIndex),
|
|
603
|
+
y: toY(value),
|
|
604
|
+
value,
|
|
605
|
+
}));
|
|
606
|
+
return segments
|
|
607
|
+
.map((segment, index) => lowerSegments[index]
|
|
608
|
+
? bandPath(segment, lowerSegments[index], curve)
|
|
609
|
+
: areaPath(segment, toY(0), curve))
|
|
610
|
+
.filter((path) => path.length > 0);
|
|
611
|
+
}
|
|
612
|
+
allMarkers = computed(() => this.plotted().flatMap((entry) => entry.markers), ...(ngDevMode ? [{ debugName: "allMarkers" }] : /* istanbul ignore next */ []));
|
|
613
|
+
seriesStagger(index) {
|
|
614
|
+
return `${staggerDelay(index, this.plotted().length, this.staggerMs())}ms`;
|
|
615
|
+
}
|
|
616
|
+
/** One tab stop per series, walked with the arrows: 12 categories x 2 series would be 24 stops. */
|
|
617
|
+
rovingBySeries = signal(new Map(), ...(ngDevMode ? [{ debugName: "rovingBySeries" }] : /* istanbul ignore next */ []));
|
|
618
|
+
firstMarkerBySeries = computed(() => new Map(this.plotted().map((entry) => [
|
|
619
|
+
entry.series.id,
|
|
620
|
+
entry.markers[0]?.markIndex,
|
|
621
|
+
])), ...(ngDevMode ? [{ debugName: "firstMarkerBySeries" }] : /* istanbul ignore next */ []));
|
|
622
|
+
isTabStop(seriesId, markIndex) {
|
|
623
|
+
return ((this.rovingBySeries().get(seriesId) ??
|
|
624
|
+
this.firstMarkerBySeries().get(seriesId)) === markIndex);
|
|
625
|
+
}
|
|
626
|
+
/** The series a marker holds focus on; narrows an `'axis'` panel to that reading. */
|
|
627
|
+
focusedSeries = signal(null, ...(ngDevMode ? [{ debugName: "focusedSeries" }] : /* istanbul ignore next */ []));
|
|
628
|
+
/** Active when its own marker is hovered, or its category is active while the category cursor is
|
|
629
|
+
* off; under the cursor a travelling marker answers the category instead. */
|
|
630
|
+
isActiveMarker(marker) {
|
|
631
|
+
return (marker.markIndex === this.activeMark.index() ||
|
|
632
|
+
(!this.scales.cursorOn?.() &&
|
|
633
|
+
marker.categoryIndex === this.scales.activeIndex()));
|
|
634
|
+
}
|
|
635
|
+
isOutsideRange(categoryIndex) {
|
|
636
|
+
return outsideRange(this.scales.selectedRange?.() ?? null, categoryIndex);
|
|
637
|
+
}
|
|
638
|
+
host = inject(ElementRef);
|
|
639
|
+
zone = inject(NgZone);
|
|
640
|
+
travel = new Map();
|
|
641
|
+
// One marker per series rides the line from the reading it left to the one the category cursor is
|
|
642
|
+
// on, on the panel's timing; a data change at the same category moves it on the marks' timing.
|
|
643
|
+
moveTravelMarkers() {
|
|
644
|
+
const categoryIndex = this.scales.activeIndex();
|
|
645
|
+
const host = this.host.nativeElement;
|
|
646
|
+
for (const entry of this.plotted()) {
|
|
647
|
+
const id = entry.series.id;
|
|
648
|
+
const marker = host.querySelector(`.travel-marker[data-series-id="${CSS.escape(id)}"]`);
|
|
649
|
+
const state = this.travel.get(id);
|
|
650
|
+
const target = entry.series.hidden
|
|
651
|
+
? undefined
|
|
652
|
+
: entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
653
|
+
if (!marker || !target) {
|
|
654
|
+
state?.cancel();
|
|
655
|
+
this.travel.delete(id);
|
|
656
|
+
marker?.classList.remove('is-shown');
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
if (state &&
|
|
660
|
+
state.categoryIndex === categoryIndex &&
|
|
661
|
+
state.toX === target.x &&
|
|
662
|
+
state.toY === target.y) {
|
|
663
|
+
continue;
|
|
664
|
+
}
|
|
665
|
+
state?.cancel();
|
|
666
|
+
const next = {
|
|
667
|
+
categoryIndex,
|
|
668
|
+
toX: target.x,
|
|
669
|
+
toY: target.y,
|
|
670
|
+
x: target.x,
|
|
671
|
+
y: target.y,
|
|
672
|
+
cancel: () => undefined,
|
|
673
|
+
};
|
|
674
|
+
const place = (x, y) => {
|
|
675
|
+
next.x = x;
|
|
676
|
+
next.y = y;
|
|
677
|
+
// `transform`, not `cx`: a geometry change re-lays out the SVG and repaints the whole page each frame.
|
|
678
|
+
marker.style.transform = `translate(${x}px, ${y}px)`;
|
|
679
|
+
};
|
|
680
|
+
this.travel.set(id, next);
|
|
681
|
+
if (!state || !marker.classList.contains('is-shown')) {
|
|
682
|
+
place(target.x, target.y);
|
|
683
|
+
marker.classList.add('is-shown');
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
next.x = state.x;
|
|
687
|
+
next.y = state.y;
|
|
688
|
+
const line = state.categoryIndex === categoryIndex
|
|
504
689
|
? null
|
|
505
|
-
: {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
690
|
+
: lineThrough(host.querySelectorAll(`.series-line[data-series-id="${CSS.escape(id)}"]:not(.mark-leave)`), state.x, target.x);
|
|
691
|
+
if (line) {
|
|
692
|
+
next.cancel = tweenMarks(marker, [lengthAt(line, state.x, state.y)], [lengthAt(line, target.x, target.y)], ([length]) => {
|
|
693
|
+
const point = pointAtLength(line, length);
|
|
694
|
+
place(point.x, point.y);
|
|
695
|
+
}, 'tooltip-move', () => place(target.x, target.y));
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
next.cancel = tweenMarks(marker, [state.x, state.y], [target.x, target.y], ([x, y]) => place(x, y), state.categoryIndex === categoryIndex ? 'mark' : 'tooltip-move');
|
|
699
|
+
}
|
|
509
700
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
701
|
+
}
|
|
702
|
+
// Where each series' points are drawn, by category key; a morph starts from here.
|
|
703
|
+
drawnPoints = new Map();
|
|
704
|
+
drawnKeys = [];
|
|
705
|
+
// Where each series' area meets its axis, in view units.
|
|
706
|
+
drawnBaselines = new Map();
|
|
707
|
+
stopMorph = () => undefined;
|
|
708
|
+
morphing = false;
|
|
709
|
+
// CSS cannot interpolate a `d` whose point count changed, so when a category comes or goes the line
|
|
710
|
+
// morphs here, over the union of both point sets: a new point leaves its neighbour, a removed one
|
|
711
|
+
// merges into its neighbour. The markers ride the same values, so they stay on the line.
|
|
712
|
+
morphOnCategoryChange(plotted) {
|
|
713
|
+
const keys = categoryKeys(this.scales.categories());
|
|
714
|
+
const previousKeys = this.drawnKeys;
|
|
715
|
+
const previous = this.drawnPoints;
|
|
716
|
+
const targets = new Map(plotted.map((entry) => [
|
|
717
|
+
entry.series.id,
|
|
718
|
+
new Map(entry.markers.map((marker) => [
|
|
719
|
+
marker.categoryKey,
|
|
720
|
+
{ x: marker.x, y: marker.y },
|
|
721
|
+
])),
|
|
722
|
+
]));
|
|
723
|
+
const targetBaselines = new Map(plotted.map((entry) => [entry.series.id, this.baselineOf(entry.series)]));
|
|
724
|
+
const previousBaselines = this.drawnBaselines;
|
|
725
|
+
this.drawnKeys = keys;
|
|
726
|
+
const sameCategories = previousKeys.length === keys.length &&
|
|
727
|
+
keys.every((key, index) => key === previousKeys[index]);
|
|
728
|
+
// A value change belongs to the CSS transitions, unless it lands during a morph, which then
|
|
729
|
+
// retargets from where the points are.
|
|
730
|
+
if (previousKeys.length === 0 || (sameCategories && !this.morphing)) {
|
|
731
|
+
this.drawnPoints = targets;
|
|
732
|
+
this.drawnBaselines = targetBaselines;
|
|
733
|
+
return;
|
|
514
734
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
735
|
+
this.stopMorph();
|
|
736
|
+
const merged = mergedKeys(previousKeys, keys);
|
|
737
|
+
const host = this.host.nativeElement;
|
|
738
|
+
const plans = plotted
|
|
739
|
+
.filter((entry) => entry.linePaths.length === 1 && previous.has(entry.series.id))
|
|
740
|
+
.map((entry) => {
|
|
741
|
+
const id = entry.series.id;
|
|
742
|
+
const from = previous.get(id) ?? new Map();
|
|
743
|
+
const to = targets.get(id) ?? new Map();
|
|
744
|
+
const order = merged.filter((key) => from.has(key) || to.has(key));
|
|
745
|
+
const near = (key, within) => {
|
|
746
|
+
const at = order.indexOf(key);
|
|
747
|
+
const found = order
|
|
748
|
+
.slice(0, at)
|
|
749
|
+
.reverse()
|
|
750
|
+
.find((candidate) => within.has(candidate)) ??
|
|
751
|
+
order.slice(at + 1).find((candidate) => within.has(candidate));
|
|
752
|
+
return found === undefined ? undefined : within.get(found);
|
|
753
|
+
};
|
|
754
|
+
const escaped = CSS.escape(id);
|
|
755
|
+
const baseline = targetBaselines.get(id) ?? 0;
|
|
756
|
+
// A band over `lower` has a second edge of its own; it keeps to the CSS transitions.
|
|
757
|
+
const fillsToBaseline = !!entry.series.area &&
|
|
758
|
+
!entry.series.lower &&
|
|
759
|
+
entry.areaPaths.length === 1;
|
|
760
|
+
return {
|
|
761
|
+
id,
|
|
762
|
+
order,
|
|
763
|
+
starts: order.map((key) => from.get(key) ?? near(key, from) ?? to.get(key)),
|
|
764
|
+
ends: order.map((key) => to.get(key) ?? near(key, to) ?? from.get(key)),
|
|
765
|
+
baselineFrom: previousBaselines.get(id) ?? baseline,
|
|
766
|
+
baselineTo: baseline,
|
|
767
|
+
paths: [
|
|
768
|
+
...host.querySelectorAll(`.series-line[data-series-id="${escaped}"]:not(.mark-leave), .series-halo[data-series-id="${escaped}"]`),
|
|
769
|
+
],
|
|
770
|
+
areas: fillsToBaseline
|
|
771
|
+
? [
|
|
772
|
+
...host.querySelectorAll(`.series-area[data-series-id="${escaped}"]:not(.mark-leave)`),
|
|
773
|
+
]
|
|
774
|
+
: [],
|
|
775
|
+
// A removed point is still in the DOM while it fades, and slides into its neighbour meanwhile.
|
|
776
|
+
markers: order.map((key) => host.querySelector(`.series-marker[data-point-key="${CSS.escape(id + '-' + key)}"]`)),
|
|
777
|
+
leaving: order.map((key) => !to.has(key)),
|
|
778
|
+
};
|
|
779
|
+
});
|
|
780
|
+
this.drawnPoints = targets;
|
|
781
|
+
this.drawnBaselines = targetBaselines;
|
|
782
|
+
if (plans.length === 0) {
|
|
783
|
+
return;
|
|
530
784
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
785
|
+
const flat = (points, baseline) => [
|
|
786
|
+
...points.flatMap((point) => [point?.x ?? 0, point?.y ?? 0]),
|
|
787
|
+
baseline,
|
|
788
|
+
];
|
|
789
|
+
const from = plans.flatMap((plan) => flat(plan.starts, plan.baselineFrom));
|
|
790
|
+
const to = plans.flatMap((plan) => flat(plan.ends, plan.baselineTo));
|
|
791
|
+
const leavingMarkers = plans.flatMap((plan) => plan.markers.filter((marker, index) => !!marker && plan.leaving[index]));
|
|
792
|
+
// A leaving marker keeps where it slid to until it is gone.
|
|
793
|
+
const styled = plans.flatMap((plan) => [
|
|
794
|
+
...plan.paths,
|
|
795
|
+
...plan.areas,
|
|
796
|
+
...plan.markers.filter((marker, index) => !!marker && !plan.leaving[index]),
|
|
797
|
+
]);
|
|
798
|
+
const curve = this.curve();
|
|
799
|
+
const live = new Map(targets);
|
|
800
|
+
const liveBaselines = new Map(targetBaselines);
|
|
801
|
+
const apply = (values) => {
|
|
802
|
+
let offset = 0;
|
|
803
|
+
for (const plan of plans) {
|
|
804
|
+
const points = plan.order.map((_, index) => ({
|
|
805
|
+
categoryIndex: index,
|
|
806
|
+
value: 0,
|
|
807
|
+
x: values[offset + 2 * index],
|
|
808
|
+
y: values[offset + 2 * index + 1],
|
|
809
|
+
}));
|
|
810
|
+
const baseline = values[offset + 2 * plan.order.length];
|
|
811
|
+
offset += 2 * plan.order.length + 1;
|
|
812
|
+
const path = `path("${linePath(points, curve)}")`;
|
|
813
|
+
for (const element of plan.paths) {
|
|
814
|
+
element.style.setProperty('d', path);
|
|
815
|
+
}
|
|
816
|
+
const area = `path("${areaPath(points, baseline, curve)}")`;
|
|
817
|
+
for (const element of plan.areas) {
|
|
818
|
+
element.style.setProperty('d', area);
|
|
819
|
+
}
|
|
820
|
+
plan.markers.forEach((marker, index) => {
|
|
821
|
+
marker?.style.setProperty('cx', `${points[index].x}px`);
|
|
822
|
+
marker?.style.setProperty('cy', `${points[index].y}px`);
|
|
823
|
+
});
|
|
824
|
+
live.set(plan.id, new Map(plan.order.map((key, index) => [key, points[index]])));
|
|
825
|
+
liveBaselines.set(plan.id, baseline);
|
|
826
|
+
}
|
|
827
|
+
this.drawnPoints = live;
|
|
828
|
+
this.drawnBaselines = liveBaselines;
|
|
829
|
+
};
|
|
830
|
+
const release = () => {
|
|
831
|
+
for (const element of styled) {
|
|
832
|
+
element.style.removeProperty('d');
|
|
833
|
+
element.style.removeProperty('cx');
|
|
834
|
+
element.style.removeProperty('cy');
|
|
835
|
+
element.style.removeProperty('transition');
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
for (const element of [...styled, ...leavingMarkers]) {
|
|
839
|
+
element.style.setProperty('transition', 'none');
|
|
840
|
+
}
|
|
841
|
+
apply(from);
|
|
842
|
+
let cancel = () => undefined;
|
|
843
|
+
this.morphing = true;
|
|
844
|
+
this.stopMorph = () => {
|
|
845
|
+
cancel();
|
|
846
|
+
release();
|
|
847
|
+
this.morphing = false;
|
|
848
|
+
};
|
|
849
|
+
cancel = tweenMarks(host, from, to, apply, 'mark', () => {
|
|
850
|
+
release();
|
|
851
|
+
this.drawnPoints = targets;
|
|
852
|
+
this.drawnBaselines = targetBaselines;
|
|
853
|
+
this.morphing = false;
|
|
854
|
+
this.stopMorph = () => undefined;
|
|
540
855
|
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
856
|
+
}
|
|
857
|
+
baselineOf(series) {
|
|
858
|
+
const toY = (series.axis ?? 'primary') === 'secondary'
|
|
859
|
+
? this.scales.secondaryYPosition()
|
|
860
|
+
: this.scales.yPosition();
|
|
861
|
+
return toY(0);
|
|
862
|
+
}
|
|
863
|
+
hoveredSeries = computed(() => this.allMarkers()[this.activeMark.index()]?.seriesId ?? null, ...(ngDevMode ? [{ debugName: "hoveredSeries" }] : /* istanbul ignore next */ []));
|
|
864
|
+
/** One rule for the legend and the markers: the series either singles out draws bold, and under
|
|
865
|
+
* `dimOthers` the others fade. */
|
|
866
|
+
spotlight = computed(() => this.highlighted() ?? this.hoveredSeries(), ...(ngDevMode ? [{ debugName: "spotlight" }] : /* istanbul ignore next */ []));
|
|
867
|
+
isSpotlit(seriesId) {
|
|
868
|
+
return this.visibleCount() > 1 && this.spotlight() === seriesId;
|
|
869
|
+
}
|
|
870
|
+
locale = injectDsLocale();
|
|
871
|
+
changes = computed(() => {
|
|
872
|
+
if (!this.showChange()) {
|
|
873
|
+
return [];
|
|
558
874
|
}
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
875
|
+
const categoryIndex = this.scales.cursorOn?.()
|
|
876
|
+
? this.scales.activeIndex()
|
|
877
|
+
: (this.allMarkers()[this.activeMark.index()]?.categoryIndex ?? -1);
|
|
878
|
+
const visible = this.plotted().filter((entry) => !entry.series.hidden);
|
|
879
|
+
const seriesId = visible.length === 1 ? visible[0].series.id : this.spotlight();
|
|
880
|
+
const markers = visible.find((entry) => entry.series.id === seriesId)?.markers ?? [];
|
|
881
|
+
const current = markers.find((marker) => marker.categoryIndex === categoryIndex);
|
|
882
|
+
if (!current) {
|
|
564
883
|
return [];
|
|
565
884
|
}
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
if (this.cursorResolved() !== 'category' || index < 0) {
|
|
600
|
-
return null;
|
|
885
|
+
const stretches = [
|
|
886
|
+
[
|
|
887
|
+
markers.find((marker) => marker.categoryIndex === categoryIndex - 1),
|
|
888
|
+
current,
|
|
889
|
+
],
|
|
890
|
+
[
|
|
891
|
+
current,
|
|
892
|
+
markers.find((marker) => marker.categoryIndex === categoryIndex + 1),
|
|
893
|
+
],
|
|
894
|
+
];
|
|
895
|
+
return stretches.flatMap(([from, to]) => {
|
|
896
|
+
if (!from || !to || from.value === 0) {
|
|
897
|
+
return [];
|
|
898
|
+
}
|
|
899
|
+
const change = to.value - from.value;
|
|
900
|
+
return [
|
|
901
|
+
{
|
|
902
|
+
key: `${current.seriesId}-${from.categoryIndex}`,
|
|
903
|
+
path: linePath([from, to], this.curve()),
|
|
904
|
+
rising: change >= 0,
|
|
905
|
+
label: `${change > 0 ? '+' : ''}${formatPercent(change, Math.abs(from.value), this.locale)}`,
|
|
906
|
+
x: (from.x + to.x) / 2,
|
|
907
|
+
y: Math.min(from.y, to.y) - CHANGE_LABEL_GAP,
|
|
908
|
+
},
|
|
909
|
+
];
|
|
910
|
+
});
|
|
911
|
+
}, ...(ngDevMode ? [{ debugName: "changes" }] : /* istanbul ignore next */ []));
|
|
912
|
+
pinnedMarkers = this.activeMark.pinnedAt((index) => this.allMarkers()[index]);
|
|
913
|
+
pinLift = CHART_PIN_RADIUS + CHART_PIN_GAP + PIN_MARKER_CLEARANCE;
|
|
914
|
+
onMarkerOver(event) {
|
|
915
|
+
const hit = markOf(event);
|
|
916
|
+
if (hit && !this.scales.cursorOn?.()) {
|
|
917
|
+
this.activeMark.enter(hit.index, event, undefined, hit.element);
|
|
601
918
|
}
|
|
602
|
-
const width = this.bandWidth();
|
|
603
|
-
const plot = this.plot();
|
|
604
|
-
return {
|
|
605
|
-
x: this.xPosition()(index) - width / 2,
|
|
606
|
-
width,
|
|
607
|
-
top: plot.top,
|
|
608
|
-
bottom: plot.top + plot.height,
|
|
609
|
-
};
|
|
610
919
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
/** The same state machine the element marks run on; here the index counts categories. */
|
|
616
|
-
cursorState = chartActiveMark(() => this.defaults.tooltipLingerMs(), () => this.hoverDelayMs());
|
|
617
|
-
activeIndex = this.cursorState.index;
|
|
618
|
-
pointerAt = signal(null, ...(ngDevMode ? [{ debugName: "pointerAt" }] : /* istanbul ignore next */ []));
|
|
619
|
-
// Set at once, not after the hover delay.
|
|
620
|
-
pointerInBand = signal(false, ...(ngDevMode ? [{ debugName: "pointerInBand" }] : /* istanbul ignore next */ []));
|
|
621
|
-
hoveredCategory = signal(-1, ...(ngDevMode ? [{ debugName: "hoveredCategory" }] : /* istanbul ignore next */ []));
|
|
622
|
-
/** Under the panel: it opens over the tallest reading, so the disc sits at that reading's head -
|
|
623
|
-
* inside a column, below a marker, and over a column too short to hold it. */
|
|
624
|
-
bandPinY = computed(() => {
|
|
625
|
-
const band = this.cursorBand();
|
|
626
|
-
const inset = CHART_PIN_RADIUS + CHART_PIN_GAP;
|
|
627
|
-
const origin = this.tooltipOrigin();
|
|
628
|
-
const canvas = this.canvasElement()?.nativeElement;
|
|
629
|
-
if (!band || !canvas || !(origin instanceof Element)) {
|
|
630
|
-
return (band?.top ?? 0) + inset;
|
|
920
|
+
onMarkerOut(event) {
|
|
921
|
+
const hit = markOf(event);
|
|
922
|
+
if (!hit || this.scales.cursorOn?.()) {
|
|
923
|
+
return;
|
|
631
924
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const head = origin.getBoundingClientRect();
|
|
635
|
-
const top = (head.top - frame.top) * scale;
|
|
636
|
-
const height = head.height * scale;
|
|
637
|
-
if (height >= 2 * inset) {
|
|
638
|
-
return top + inset;
|
|
639
|
-
}
|
|
640
|
-
if (!origin.matches('.bar')) {
|
|
641
|
-
return top + height + inset;
|
|
925
|
+
if (leftMark(event, hit)) {
|
|
926
|
+
this.activeMark.leave();
|
|
642
927
|
}
|
|
643
|
-
const value = origin.parentElement?.querySelector(':scope > .value');
|
|
644
|
-
const valueTop = value
|
|
645
|
-
? (value.getBoundingClientRect().top - frame.top) * scale
|
|
646
|
-
: top;
|
|
647
|
-
return Math.min(top, valueTop) - inset;
|
|
648
|
-
}, ...(ngDevMode ? [{ debugName: "bandPinY" }] : /* istanbul ignore next */ []));
|
|
649
|
-
/** How far a held pin sits above the panel's anchor; the panel rises by as much to stay over it. */
|
|
650
|
-
pinRise = signal(0, ...(ngDevMode ? [{ debugName: "pinRise" }] : /* istanbul ignore next */ []));
|
|
651
|
-
tooltipGap = computed(() => Math.max(this.tooltipExtraGap(), this.pinRise()), ...(ngDevMode ? [{ debugName: "tooltipGap" }] : /* istanbul ignore next */ []));
|
|
652
|
-
bandPins = computed(() => this.pinOnClickResolved() && this.pointerInBand(), ...(ngDevMode ? [{ debugName: "bandPins" }] : /* istanbul ignore next */ []));
|
|
653
|
-
cursorPointer = computed(() => this.activeIndex() < 0 ? null : this.pointerAt(), ...(ngDevMode ? [{ debugName: "cursorPointer" }] : /* istanbul ignore next */ []));
|
|
654
|
-
/** Whether the cursor is held. */
|
|
655
|
-
cursorPinned = this.cursorState.pinned;
|
|
656
|
-
drawsUnpin = !inject(CHART_UNPIN_DRAWN_BY_HOST, {
|
|
657
|
-
optional: true,
|
|
658
|
-
});
|
|
659
|
-
releaseCursor() {
|
|
660
|
-
this.cursorState.release();
|
|
661
928
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
// Client x to view units: the canvas is scaled to its box.
|
|
669
|
-
const viewX = ((event.clientX - this.canvasRect.left) / this.canvasRect.width) *
|
|
670
|
-
this.viewWidth();
|
|
671
|
-
// Every point belongs to its nearest category, so the cursor never passes through "none".
|
|
672
|
-
const index = this.clampIndex(categoryAt(viewX, plot.left, plot.width, this.categories().length));
|
|
673
|
-
this.pointerAt.set({ x: event.clientX, y: event.clientY });
|
|
674
|
-
this.pointerInBand.set(index >= 0);
|
|
675
|
-
this.hoveredCategory.set(index);
|
|
676
|
-
if (index < 0) {
|
|
677
|
-
if (event.type === 'pointerdown' && this.cursorPinned()) {
|
|
678
|
-
this.cursorState.release();
|
|
679
|
-
}
|
|
680
|
-
else {
|
|
681
|
-
this.cursorState.leave();
|
|
682
|
-
}
|
|
683
|
-
return;
|
|
929
|
+
onMarkerFocus(event, hit) {
|
|
930
|
+
const marker = this.allMarkers()[hit.index];
|
|
931
|
+
if (marker) {
|
|
932
|
+
this.rovingBySeries.update((roving) => new Map(roving).set(marker.seriesId, hit.index));
|
|
933
|
+
this.focusedSeries.set(marker.seriesId);
|
|
934
|
+
this.scales.setActiveIndex(marker.categoryIndex);
|
|
684
935
|
}
|
|
685
|
-
|
|
686
|
-
|
|
936
|
+
this.activeMark.enter(hit.index, event, undefined, hit.element);
|
|
937
|
+
}
|
|
938
|
+
onMarkerKey(event) {
|
|
939
|
+
const hit = markOf(event);
|
|
940
|
+
if (!hit) {
|
|
687
941
|
return;
|
|
688
942
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const forgetRect = () => {
|
|
694
|
-
this.canvasRect = null;
|
|
695
|
-
};
|
|
696
|
-
const onPointer = (event) => this.plotPointer(event, canvas);
|
|
697
|
-
const onEnter = () => window.addEventListener('scroll', forgetRect, {
|
|
698
|
-
capture: true,
|
|
699
|
-
passive: true,
|
|
700
|
-
});
|
|
701
|
-
const onLeave = () => {
|
|
702
|
-
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
703
|
-
forgetRect();
|
|
704
|
-
this.pointerInBand.set(false);
|
|
705
|
-
this.hoveredCategory.set(-1);
|
|
706
|
-
// The panel goes back to the band the keyboard holds, which keeps it open while focus stays.
|
|
707
|
-
if (this.keyboardFocusInside()) {
|
|
708
|
-
this.cursorState.setIndex(this.focusedCategory());
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
this.cursorState.leave();
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
this.zone.runOutsideAngular(() => {
|
|
715
|
-
canvas.addEventListener('pointerenter', onEnter);
|
|
716
|
-
canvas.addEventListener('pointermove', onPointer);
|
|
717
|
-
canvas.addEventListener('pointerdown', onPointer);
|
|
718
|
-
canvas.addEventListener('pointerleave', onLeave);
|
|
719
|
-
});
|
|
720
|
-
return () => {
|
|
721
|
-
canvas.removeEventListener('pointerenter', onEnter);
|
|
722
|
-
canvas.removeEventListener('pointermove', onPointer);
|
|
723
|
-
canvas.removeEventListener('pointerdown', onPointer);
|
|
724
|
-
canvas.removeEventListener('pointerleave', onLeave);
|
|
725
|
-
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
726
|
-
forgetRect();
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
bandElement = viewChild('cursorBandEl', ...(ngDevMode ? [{ debugName: "bandElement" }] : /* istanbul ignore next */ []));
|
|
730
|
-
cursorOrigin = computed(() => this.cursorBand() ? (this.bandElement()?.nativeElement ?? null) : null, ...(ngDevMode ? [{ debugName: "cursorOrigin" }] : /* istanbul ignore next */ []));
|
|
731
|
-
keyboardStops = computed(() => this.cursorOn() && this.interactive(), ...(ngDevMode ? [{ debugName: "keyboardStops" }] : /* istanbul ignore next */ []));
|
|
732
|
-
roving = signal(0, ...(ngDevMode ? [{ debugName: "roving" }] : /* istanbul ignore next */ []));
|
|
733
|
-
refocusStop = false;
|
|
734
|
-
focusedCategory = computed(() => Math.min(this.roving(), Math.max(0, this.categories().length - 1)), ...(ngDevMode ? [{ debugName: "focusedCategory" }] : /* istanbul ignore next */ []));
|
|
735
|
-
categoryStops = computed(() => {
|
|
736
|
-
const toX = this.xPosition();
|
|
737
|
-
const width = this.bandWidth();
|
|
738
|
-
return this.categories().map((category, index) => ({
|
|
739
|
-
index,
|
|
740
|
-
category,
|
|
741
|
-
x: toX(index) - width / 2,
|
|
742
|
-
width,
|
|
743
|
-
}));
|
|
744
|
-
}, ...(ngDevMode ? [{ debugName: "categoryStops" }] : /* istanbul ignore next */ []));
|
|
745
|
-
// Only the active category's readings are known; a stop is named once the cursor is on it, which focusing it does first.
|
|
746
|
-
stopLabel(index) {
|
|
747
|
-
const category = this.categories()[index] ?? '';
|
|
748
|
-
const context = this.activeIndex() === index ? this.categoryContext() : null;
|
|
749
|
-
const readings = context?.entries.map((entry) => `${entry.label} ${entry.formatted ?? entry.value}`) ?? [];
|
|
750
|
-
return readings.length ? `${category}: ${readings.join(', ')}` : category;
|
|
751
|
-
}
|
|
752
|
-
onStopFocus(index, event) {
|
|
753
|
-
this.roving.set(index);
|
|
754
|
-
this.pickedKey.set(null);
|
|
755
|
-
this.cursorState.enter(index, event, null, event.target);
|
|
756
|
-
}
|
|
757
|
-
leavesChart(event) {
|
|
758
|
-
const next = event.relatedTarget;
|
|
759
|
-
return (!(next instanceof Element) || !this.host.nativeElement.contains(next));
|
|
760
|
-
}
|
|
761
|
-
onStopBlur(event) {
|
|
762
|
-
if (this.leavesChart(event)) {
|
|
763
|
-
this.cursorState.leave();
|
|
943
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
944
|
+
event.preventDefault();
|
|
945
|
+
this.selectMarker(hit.index);
|
|
946
|
+
return;
|
|
764
947
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
this.pickedKey.set(null);
|
|
948
|
+
// The category cursor's `ds-chart` owns the other keys.
|
|
949
|
+
if (this.scales.cursorOn?.()) {
|
|
950
|
+
return;
|
|
769
951
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
.querySelector(`.category-stop[data-category-index="${index}"]`)
|
|
777
|
-
?.focus();
|
|
778
|
-
if (this.cursorPinned() && this.activeIndex() !== index) {
|
|
779
|
-
this.cursorState.release();
|
|
952
|
+
const marker = this.allMarkers()[hit.index];
|
|
953
|
+
const strand = this.allMarkers().filter((candidate) => candidate.seriesId === marker?.seriesId);
|
|
954
|
+
const current = strand.findIndex((candidate) => candidate.markIndex === hit.index);
|
|
955
|
+
const next = nextRovingIndex(event.key, current, strand.length);
|
|
956
|
+
if (next === null) {
|
|
957
|
+
return;
|
|
780
958
|
}
|
|
781
|
-
|
|
959
|
+
event.preventDefault();
|
|
960
|
+
focusMark(hit.element.closest('.lines'), strand[next].markIndex);
|
|
782
961
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
return (this.keyboardStops() &&
|
|
786
|
-
focused !== null &&
|
|
787
|
-
this.host.nativeElement.contains(focused) &&
|
|
788
|
-
focused.closest('.category-stop, [data-mark-index]') !== null);
|
|
962
|
+
isDimmed(seriesId) {
|
|
963
|
+
return dimmedBy(this.dimOthers(), this.spotlight(), seriesId);
|
|
789
964
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (!this.isBrowser) {
|
|
965
|
+
onMarkerClick(event) {
|
|
966
|
+
const hit = markOf(event);
|
|
967
|
+
if (!hit) {
|
|
794
968
|
return;
|
|
795
969
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
!this.keyboardStops() ||
|
|
801
|
-
!this.cursorPinned() ||
|
|
802
|
-
!(target instanceof Element) ||
|
|
803
|
-
!this.host.nativeElement.contains(target) ||
|
|
804
|
-
target.closest('.category-stop') !== null ||
|
|
805
|
-
target.closest('[data-mark-index]') === null) {
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
event.stopImmediatePropagation();
|
|
809
|
-
event.preventDefault();
|
|
810
|
-
this.pickedKey.set(null);
|
|
811
|
-
this.focusStop(this.focusedCategory());
|
|
812
|
-
};
|
|
813
|
-
document.addEventListener('keydown', onKey, true);
|
|
814
|
-
inject(DestroyRef).onDestroy(() => document.removeEventListener('keydown', onKey, true));
|
|
970
|
+
if (this.pins()) {
|
|
971
|
+
this.activeMark.pin(hit.index, event, '.series-marker', hit.element);
|
|
972
|
+
}
|
|
973
|
+
this.selectMarker(hit.index);
|
|
815
974
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
|
|
975
|
+
selectMarker(markIndex) {
|
|
976
|
+
const marker = this.allMarkers()[markIndex];
|
|
977
|
+
const series = this.data().find((entry) => entry.id === marker?.seriesId);
|
|
978
|
+
if (marker && series) {
|
|
979
|
+
this.pointClicked.emit({
|
|
980
|
+
series,
|
|
981
|
+
categoryIndex: marker.categoryIndex,
|
|
982
|
+
value: marker.value,
|
|
983
|
+
});
|
|
984
|
+
}
|
|
820
985
|
}
|
|
821
|
-
|
|
822
|
-
return
|
|
823
|
-
.flatMap(([sourceId, source]) => {
|
|
824
|
-
const elements = source.axisPointElements?.() ?? [];
|
|
825
|
-
return (source.axisEntries?.() ?? []).map((entry, index) => ({
|
|
826
|
-
key: `${sourceId}:${index}`,
|
|
827
|
-
entry,
|
|
828
|
-
element: elements[index] ?? null,
|
|
829
|
-
}));
|
|
830
|
-
})
|
|
831
|
-
// A mark without `interactive` has no tabindex and would swallow the focus call.
|
|
832
|
-
.filter((reading) => reading.element?.hasAttribute('tabindex') ?? false)
|
|
833
|
-
.sort((a, b) => (a.entry.y ?? 0) - (b.entry.y ?? 0)));
|
|
986
|
+
markerLabel(marker) {
|
|
987
|
+
return `${marker.seriesLabel}, ${marker.category}, ${marker.formattedValue}`;
|
|
834
988
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
989
|
+
/** What this series reads at the cursor's category, whatever `tooltip` says; feeds the category panel. */
|
|
990
|
+
axisEntries = computed(() => this.readingsAtCursor().map(({ reading }) => reading), ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
991
|
+
readingsAtCursor = computed(() => {
|
|
992
|
+
const categoryIndex = this.scales.activeIndex();
|
|
993
|
+
if (categoryIndex < 0) {
|
|
994
|
+
return [];
|
|
838
995
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
996
|
+
return this.plotted().flatMap((entry) => {
|
|
997
|
+
const marker = entry.series.hidden
|
|
998
|
+
? undefined
|
|
999
|
+
: entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
1000
|
+
return marker
|
|
1001
|
+
? [
|
|
1002
|
+
{
|
|
1003
|
+
seriesId: entry.series.id,
|
|
1004
|
+
markIndex: marker.markIndex,
|
|
1005
|
+
reading: {
|
|
1006
|
+
label: marker.seriesLabel,
|
|
1007
|
+
value: marker.value,
|
|
1008
|
+
formatted: marker.formattedValue,
|
|
1009
|
+
color: marker.color,
|
|
1010
|
+
y: marker.y,
|
|
1011
|
+
axis: entry.series.axis ?? 'primary',
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
]
|
|
1015
|
+
: [];
|
|
1016
|
+
});
|
|
1017
|
+
}, ...(ngDevMode ? [{ debugName: "readingsAtCursor" }] : /* istanbul ignore next */ []));
|
|
1018
|
+
tooltipContext = computed(() => {
|
|
1019
|
+
if (this.tooltip() === 'none') {
|
|
1020
|
+
return null;
|
|
843
1021
|
}
|
|
844
|
-
if (
|
|
845
|
-
|
|
846
|
-
// The pointer may have moved or pinned the cursor elsewhere, or Escape cleared it, since the stop took focus.
|
|
847
|
-
if (this.cursorPinned() &&
|
|
848
|
-
this.activeIndex() !== this.focusedCategory()) {
|
|
849
|
-
this.cursorState.release();
|
|
850
|
-
}
|
|
851
|
-
this.cursorState.setIndex(this.focusedCategory());
|
|
852
|
-
const readings = this.readingsTopDown();
|
|
853
|
-
if (readings.length === 0) {
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
const at = readings.findIndex((reading) => reading.key === this.pickedKey());
|
|
857
|
-
const step = event.key === 'ArrowDown' ? 1 : readings.length - 1;
|
|
858
|
-
const next = at < 0
|
|
859
|
-
? event.key === 'ArrowDown'
|
|
860
|
-
? 0
|
|
861
|
-
: readings.length - 1
|
|
862
|
-
: (at + step) % readings.length;
|
|
863
|
-
this.pickedKey.set(readings[next].key);
|
|
864
|
-
readings[next].element.focus();
|
|
865
|
-
return;
|
|
1022
|
+
if (this.tooltip() === 'axis') {
|
|
1023
|
+
return this.axisTooltipContext();
|
|
866
1024
|
}
|
|
867
|
-
|
|
868
|
-
|
|
1025
|
+
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1026
|
+
if (!marker || marker.hidden) {
|
|
1027
|
+
return null;
|
|
869
1028
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1029
|
+
return {
|
|
1030
|
+
category: marker.category,
|
|
1031
|
+
entries: [
|
|
1032
|
+
{
|
|
1033
|
+
label: marker.seriesLabel,
|
|
1034
|
+
value: marker.value,
|
|
1035
|
+
formatted: marker.formattedValue,
|
|
1036
|
+
color: marker.color,
|
|
1037
|
+
},
|
|
1038
|
+
],
|
|
1039
|
+
};
|
|
1040
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1041
|
+
markerElements = viewChildren('markerEl', ...(ngDevMode ? [{ debugName: "markerElements" }] : /* istanbul ignore next */ []));
|
|
1042
|
+
axisPointElements = computed(() => this.readingsAtCursor().map(({ markIndex }) => this.markerElements()[markIndex]?.nativeElement ?? null), ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
1043
|
+
topReading = computed(() => {
|
|
1044
|
+
const categoryIndex = this.scales.activeIndex();
|
|
1045
|
+
if (categoryIndex < 0) {
|
|
1046
|
+
return null;
|
|
874
1047
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1048
|
+
return this.allMarkers()
|
|
1049
|
+
.filter((marker) => marker.categoryIndex === categoryIndex && !marker.hidden)
|
|
1050
|
+
.reduce((top, marker) => (top === null || marker.y < top.y ? marker : top), null);
|
|
1051
|
+
}, ...(ngDevMode ? [{ debugName: "topReading" }] : /* istanbul ignore next */ []));
|
|
1052
|
+
/** 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. */
|
|
1053
|
+
topReadingElement = computed(() => {
|
|
1054
|
+
const highest = this.topReading();
|
|
1055
|
+
return highest
|
|
1056
|
+
? (this.markerElements()[highest.markIndex]?.nativeElement ?? null)
|
|
1057
|
+
: null;
|
|
1058
|
+
}, ...(ngDevMode ? [{ debugName: "topReadingElement" }] : /* istanbul ignore next */ []));
|
|
1059
|
+
topReadingY = computed(() => this.topReadingElement() ? null : (this.topReading()?.y ?? null), ...(ngDevMode ? [{ debugName: "topReadingY" }] : /* istanbul ignore next */ []));
|
|
1060
|
+
axisReadout = computed(() => {
|
|
1061
|
+
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1062
|
+
const series = marker && this.data().find((entry) => entry.id === marker.seriesId);
|
|
1063
|
+
return marker && !marker.hidden
|
|
1064
|
+
? {
|
|
1065
|
+
categoryIndex: marker.categoryIndex,
|
|
1066
|
+
y: marker.y,
|
|
1067
|
+
axis: series?.axis ?? 'primary',
|
|
1068
|
+
}
|
|
1069
|
+
: null;
|
|
1070
|
+
}, ...(ngDevMode ? [{ debugName: "axisReadout" }] : /* istanbul ignore next */ []));
|
|
1071
|
+
valuesByCategory = computed(() => {
|
|
1072
|
+
const perCategory = this.scales.categories().map(() => []);
|
|
1073
|
+
for (const marker of this.allMarkers()) {
|
|
1074
|
+
if (!marker.hidden) {
|
|
1075
|
+
perCategory[marker.categoryIndex]?.push(marker.value);
|
|
1076
|
+
}
|
|
881
1077
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
: nextRovingIndex(event.key, current, this.categories().length);
|
|
888
|
-
if (next !== null) {
|
|
889
|
-
event.preventDefault();
|
|
890
|
-
this.focusStop(next);
|
|
891
|
-
return;
|
|
1078
|
+
return perCategory;
|
|
1079
|
+
}, ...(ngDevMode ? [{ debugName: "valuesByCategory" }] : /* istanbul ignore next */ []));
|
|
1080
|
+
tooltipOrigin = computed(() => {
|
|
1081
|
+
if (this.tooltip() !== 'axis') {
|
|
1082
|
+
return this.activeMark.origin();
|
|
892
1083
|
}
|
|
893
|
-
if (
|
|
894
|
-
|
|
895
|
-
if (this.pinOnClickResolved()) {
|
|
896
|
-
this.pinFromKeyboard(current, event);
|
|
897
|
-
}
|
|
1084
|
+
if (this.tooltipAnchor() === 'pointer') {
|
|
1085
|
+
return this.scales.cursorPointer() ?? this.scales.cursorOrigin();
|
|
898
1086
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1087
|
+
return this.topReadingElement() ?? this.scales.cursorOrigin();
|
|
1088
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1089
|
+
/** Every series' reading at the active category; a series with none contributes no row. */
|
|
1090
|
+
axisTooltipContext = computed(() => {
|
|
1091
|
+
const categoryIndex = this.scales.activeIndex();
|
|
1092
|
+
if (categoryIndex < 0) {
|
|
1093
|
+
return null;
|
|
902
1094
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
return Number.isFinite(index)
|
|
910
|
-
? Math.min(Math.max(Math.trunc(index), -1), last)
|
|
911
|
-
: -1;
|
|
912
|
-
}
|
|
913
|
-
plotRight = computed(() => this.plot().left + this.plot().width, ...(ngDevMode ? [{ debugName: "plotRight" }] : /* istanbul ignore next */ []));
|
|
914
|
-
plotBottom = computed(() => this.plot().top + this.plot().height, ...(ngDevMode ? [{ debugName: "plotBottom" }] : /* istanbul ignore next */ []));
|
|
915
|
-
axisLabelX = computed(() => this.plot().left - CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "axisLabelX" }] : /* istanbul ignore next */ []));
|
|
916
|
-
/** Clears the reservation the view height budgets, only when it is there; otherwise the labels fall past the viewBox. */
|
|
917
|
-
categoryLabelY = computed(() => this.secondaryPlotBottom() +
|
|
918
|
-
(this.reachesBelowZero() ? this.valueSpace() : 0) +
|
|
919
|
-
CHART_CATEGORY_LABEL_OFFSET, ...(ngDevMode ? [{ debugName: "categoryLabelY" }] : /* istanbul ignore next */ []));
|
|
920
|
-
ticks = computed(() => {
|
|
921
|
-
const domain = this.domain();
|
|
922
|
-
const toY = this.yPosition();
|
|
923
|
-
const format = this.valueFormatResolved();
|
|
924
|
-
return tickValues(domain.min, domain.max, this.tickCount()).map((value) => ({
|
|
925
|
-
value,
|
|
926
|
-
y: toY(value),
|
|
927
|
-
label: format(value, 'tick'),
|
|
928
|
-
}));
|
|
929
|
-
}, ...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
930
|
-
labelTexts = computed(() => [
|
|
931
|
-
...this.ticks().map((tick) => tick.label),
|
|
932
|
-
...this.secondaryTicks().map((tick) => tick.label),
|
|
933
|
-
...this.categories(),
|
|
934
|
-
].join('\n'), ...(ngDevMode ? [{ debugName: "labelTexts" }] : /* istanbul ignore next */ []));
|
|
935
|
-
/** Rotation is tried before thinning; both use the widest label as rendered. */
|
|
936
|
-
categoryLabelsRotated = computed(() => rotationWouldFit([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length)), ...(ngDevMode ? [{ debugName: "categoryLabelsRotated" }] : /* istanbul ignore next */ []));
|
|
937
|
-
categoryLabelInterval = computed(() => labelInterval([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length), this.categoryLabelsRotated()), ...(ngDevMode ? [{ debugName: "categoryLabelInterval" }] : /* istanbul ignore next */ []));
|
|
938
|
-
labelHovered = signal(null, ...(ngDevMode ? [{ debugName: "labelHovered" }] : /* istanbul ignore next */ []));
|
|
939
|
-
categoryLabelHover = this.labelHovered.asReadonly();
|
|
940
|
-
onCategoryLabelEnter(index, event) {
|
|
941
|
-
if (!this.cursorOn()) {
|
|
942
|
-
this.labelHovered.set({ index, event });
|
|
1095
|
+
const focused = this.focusedSeries();
|
|
1096
|
+
const entries = topDown(this.readingsAtCursor()
|
|
1097
|
+
.filter(({ seriesId }) => !focused || seriesId === focused)
|
|
1098
|
+
.map(({ reading }) => reading));
|
|
1099
|
+
if (!entries.length) {
|
|
1100
|
+
return null;
|
|
943
1101
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
const interval = this.categoryLabelInterval();
|
|
951
|
-
return this.categories()
|
|
952
|
-
.map((text, index) => ({ x: toX(index), text, index }))
|
|
953
|
-
.filter((label) => label.index % interval === 0);
|
|
954
|
-
}, ...(ngDevMode ? [{ debugName: "categoryLabels" }] : /* istanbul ignore next */ []));
|
|
955
|
-
reachesBelowZero = computed(() => this.domain().min < 0, ...(ngDevMode ? [{ debugName: "reachesBelowZero" }] : /* istanbul ignore next */ []));
|
|
956
|
-
/** Read off `categories` alone: the marks are projected into the branch this decides, so waiting for a report would deadlock. */
|
|
957
|
-
isEmpty = computed(() => this.categories().length === 0, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
958
|
-
accessibleName = computed(() => this.summary() ?? this.caption() ?? this.intl().chart.title, ...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
959
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
960
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartComponent, isStandalone: true, selector: "ds-chart", inputs: { categories: { classPropertyName: "categories", publicName: "categories", isSignal: true, isRequired: false, transformFunction: null }, tickCount: { classPropertyName: "tickCount", publicName: "tickCount", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, cursor: { classPropertyName: "cursor", publicName: "cursor", 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 }, 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: [
|
|
961
|
-
{
|
|
962
|
-
provide: CHART_SCALES,
|
|
963
|
-
useExisting: forwardRef(() => ChartComponent),
|
|
964
|
-
},
|
|
965
|
-
], 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() || !renderReady()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n <ds-skeleton\n height=\"var(--_chart-view-height)\"\n [shimmer]=\"loading()\" />\n </div>\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: [":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: SkeletonComponent, selector: "ds-skeleton", inputs: ["width", "height", "circle", "inline", "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", "empty", "emptyText", "messageAxes", "skeleton", "body", "message"], outputs: ["release"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1102
|
+
return {
|
|
1103
|
+
category: this.scales.categories()[categoryIndex] ?? '',
|
|
1104
|
+
entries,
|
|
1105
|
+
};
|
|
1106
|
+
}, ...(ngDevMode ? [{ debugName: "axisTooltipContext" }] : /* istanbul ignore next */ []));
|
|
1107
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1108
|
+
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 <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 </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}.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;animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) backwards}.change.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.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 });
|
|
966
1109
|
}
|
|
967
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type:
|
|
1110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, decorators: [{
|
|
968
1111
|
type: Component,
|
|
969
|
-
args: [{ selector: 'ds-chart', standalone: true, exportAs: 'dsChart', imports: [
|
|
970
|
-
|
|
971
|
-
ChartTooltipDirective,
|
|
972
|
-
ChartPinMarkerComponent,
|
|
973
|
-
ChartStatesComponent,
|
|
974
|
-
], host: {
|
|
975
|
-
'[class.framed]': "frameResolved() === 'auto'",
|
|
976
|
-
'[class.measuring]': '!settled()',
|
|
977
|
-
'[style.--_chart-view-height]': "viewHeight() + 'px'",
|
|
978
|
-
'(keydown)': 'onChartKey($event)',
|
|
979
|
-
'(focusout)': 'onChartFocusOut($event)',
|
|
980
|
-
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
981
|
-
{
|
|
982
|
-
provide: CHART_SCALES,
|
|
983
|
-
useExisting: forwardRef(() => ChartComponent),
|
|
984
|
-
},
|
|
985
|
-
], 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() || !renderReady()\"\n [empty]=\"isEmpty()\"\n [emptyText]=\"emptyTextResolved()\"\n [skeleton]=\"skeleton\"\n [body]=\"body\"\n (release)=\"releaseCursor()\">\n</figure>\n\n<ng-template #skeleton>\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n <ds-skeleton\n height=\"var(--_chart-view-height)\"\n [shimmer]=\"loading()\" />\n </div>\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: [":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"] }]
|
|
986
|
-
}], ctorParameters: () => [], propDecorators: { categories: [{ type: i0.Input, args: [{ isSignal: true, alias: "categories", required: false }] }], tickCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "tickCount", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], 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 }] }] } });
|
|
1112
|
+
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 <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 </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}.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;animation:ds-chart-mark-fade-in var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) backwards}.change.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing) both}.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"] }]
|
|
1113
|
+
}], 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 }] }] } });
|
|
987
1114
|
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
//
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
* One column per datum, drawn against the scales `ds-chart` supplies.
|
|
997
|
-
*
|
|
998
|
-
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants. Written
|
|
999
|
-
* as `<svg:g dsColumnSeries>`.
|
|
1000
|
-
*/
|
|
1001
|
-
class ColumnSeriesComponent {
|
|
1115
|
+
// Between the value axis and the pill that prints the reading there.
|
|
1116
|
+
const READOUT_PILL_GAP = 2;
|
|
1117
|
+
// Text to edge, either side, of a pill drawn on the canvas.
|
|
1118
|
+
const PILL_PADDING = 6;
|
|
1119
|
+
const RANGE_BAND_INSET = 2;
|
|
1120
|
+
// Above the plot's top edge, inside the value space reserved there.
|
|
1121
|
+
const RANGE_PILL_RISE = 10;
|
|
1122
|
+
class ChartComponent extends DsChartBase {
|
|
1002
1123
|
leaveMark = leaveMark;
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1124
|
+
renderReady = chartRenderGate();
|
|
1125
|
+
/** One band per category; every projected mark is positioned against them. */
|
|
1126
|
+
categories = input([], ...(ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []));
|
|
1127
|
+
/** How many columns the loading skeleton draws before the categories are known. */
|
|
1128
|
+
skeletonCount = input(CHART_SKELETON_COUNT, { ...(ngDevMode ? { debugName: "skeletonCount" } : /* istanbul ignore next */ {}), transform: (raw) => numberAttribute(raw, CHART_SKELETON_COUNT) });
|
|
1129
|
+
skeletonMarks = computed(() => skeletonMarkCount(this.categories().length, this.skeletonCount()), ...(ngDevMode ? [{ debugName: "skeletonMarks" }] : /* istanbul ignore next */ []));
|
|
1130
|
+
/** How many value-axis ticks to aim for; ticks snap to a round step, so the count may differ by one. */
|
|
1131
|
+
tickCount = input(CHART_DEFAULT_TICK_COUNT, { ...(ngDevMode ? { debugName: "tickCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1132
|
+
/** Pins the floor of the value axis. It only opens the axis further; a floor above the data is ignored. */
|
|
1133
|
+
min = input(null, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1134
|
+
/** Pins the ceiling of the value axis. See `min`. */
|
|
1135
|
+
max = input(null, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1136
|
+
/** Draws a band and crosshair down the category under the pointer and reports it to every mark
|
|
1137
|
+
* through `activeIndex`; the panel then names every reading at that category. `'auto'` (default)
|
|
1138
|
+
* is `'category'` with two or more tooltip-showing marks or a mark with `tooltip="axis"`, else
|
|
1139
|
+
* `'none'`. */
|
|
1140
|
+
cursor = input('auto', ...(ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []));
|
|
1017
1141
|
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
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
|
-
|
|
1051
|
-
/**
|
|
1052
|
-
|
|
1053
|
-
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
/** Per instance: otherwise every hatched mark takes the first chart's `<pattern>` colour. */
|
|
1066
|
-
hatchId = `ds-column-hatch-${this.seriesId}`;
|
|
1067
|
-
/** Where each mark spans, which the axis has to hold: a stacked segment's top is the running total. */
|
|
1068
|
-
spans = computed(() => {
|
|
1069
|
-
const given = this.offsets();
|
|
1070
|
-
return this.data().map((point, index) => given?.[index] ?? {
|
|
1071
|
-
from: 0,
|
|
1072
|
-
to: Number.isFinite(point.value) ? point.value : 0,
|
|
1073
|
-
});
|
|
1074
|
-
}, ...(ngDevMode ? [{ debugName: "spans" }] : /* istanbul ignore next */ []));
|
|
1142
|
+
/** Whether hiding a series re-scales the value axes to what is left. Off holds them where they
|
|
1143
|
+
* stand with every series shown. */
|
|
1144
|
+
rescaleOnHide = input(true, { ...(ngDevMode ? { debugName: "rescaleOnHide" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1145
|
+
/** Pins the ceiling of the SECOND value axis, the way `max` pins the first. */
|
|
1146
|
+
maxSecondary = input(null, { ...(ngDevMode ? { debugName: "maxSecondary" } : /* istanbul ignore next */ {}), transform: (raw) => (raw == null ? null : numberAttribute(raw)) });
|
|
1147
|
+
/** Plot height in CSS pixels, axis labels and headroom excluded; fixed across card widths. */
|
|
1148
|
+
plotHeight = input(CHART_DEFAULT_PLOT_HEIGHT, { ...(ngDevMode ? { debugName: "plotHeight" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1149
|
+
/** Width in CSS pixels of the left gutter that carries the value-axis labels. */
|
|
1150
|
+
axisGutter = input(CHART_DEFAULT_AXIS_GUTTER, { ...(ngDevMode ? { debugName: "axisGutter" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1151
|
+
/** Pixels reserved at each end of the plot for a value label, drawn or not. */
|
|
1152
|
+
valueSpace = input(CHART_DEFAULT_VALUE_SPACE, { ...(ngDevMode ? { debugName: "valueSpace" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1153
|
+
/** How the second value axis relates to the first, once a mark has reported against it. */
|
|
1154
|
+
secondaryAxisMode = input('aligned', ...(ngDevMode ? [{ debugName: "secondaryAxisMode" }] : /* istanbul ignore next */ []));
|
|
1155
|
+
/** Colours the first axis's tick labels like the marks measured against it. */
|
|
1156
|
+
axisColor = input(null, ...(ngDevMode ? [{ debugName: "axisColor" }] : /* istanbul ignore next */ []));
|
|
1157
|
+
/** `axisColor` for the second axis. */
|
|
1158
|
+
secondaryAxisColor = input(null, ...(ngDevMode ? [{ debugName: "secondaryAxisColor" }] : /* istanbul ignore next */ []));
|
|
1159
|
+
/** Names the first axis's unit beside it. */
|
|
1160
|
+
axisLabel = input(null, ...(ngDevMode ? [{ debugName: "axisLabel" }] : /* istanbul ignore next */ []));
|
|
1161
|
+
/** `axisLabel` for the second axis. */
|
|
1162
|
+
secondaryAxisLabel = input(null, ...(ngDevMode ? [{ debugName: "secondaryAxisLabel" }] : /* istanbul ignore next */ []));
|
|
1163
|
+
/** Lets a press dragged across categories select them: a band over the range, the sum and mean of
|
|
1164
|
+
* every reading in it, and the marks outside it faded. Escape or a press outside clears it; a
|
|
1165
|
+
* press released in its own category still pins. Off by default. */
|
|
1166
|
+
selectRange = input(false, { ...(ngDevMode ? { debugName: "selectRange" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1167
|
+
/** Answers the pointer on the axes: the category label in bold, a guide from the value axis and
|
|
1168
|
+
* the value there in a pill on the axis. On by default. */
|
|
1169
|
+
showAxisReadout = input(true, { ...(ngDevMode ? { debugName: "showAxisReadout" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1170
|
+
tooltipSwatchesResolved = this.defaults.tooltipSwatches;
|
|
1171
|
+
hoverDelayMs = this.defaults.hoverDelayMs;
|
|
1172
|
+
host = inject(ElementRef);
|
|
1173
|
+
zone = inject(NgZone);
|
|
1174
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
1175
|
+
/** The `<svg>`'s rendered width: the host's content box, since `:host(.framed)` carries the padding. */
|
|
1176
|
+
measuredWidth = elementWidth(this.host);
|
|
1177
|
+
/** True under SSR, which draws at the fallback width. */
|
|
1178
|
+
measured = computed(() => !this.isBrowser || this.measuredWidth() > 0, ...(ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []));
|
|
1179
|
+
viewWidth = computed(() => this.measuredWidth() || CHART_FALLBACK_WIDTH, ...(ngDevMode ? [{ debugName: "viewWidth" }] : /* istanbul ignore next */ []));
|
|
1180
|
+
/** The geometry a resize redraws; marks hold still while it changes. A category coming or going is
|
|
1181
|
+
* not part of it: the marks glide sideways and a line morphs to its new point count. */
|
|
1182
|
+
layout = computed(() => `${this.measuredWidth()}`, ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
1183
|
+
settledLayout = signal('', ...(ngDevMode ? [{ debugName: "settledLayout" }] : /* istanbul ignore next */ []));
|
|
1184
|
+
/** Whether the marks may animate: the correction after measuring and a resize must not, or the plot
|
|
1185
|
+
* drags behind the pointer. Derived from the layout, so the hold lands in the same render as the new
|
|
1186
|
+
* geometry. Two frames, because after one the corrected geometry is unstyled and `transitionrun`
|
|
1187
|
+
* fires on `x` and `width`. */
|
|
1188
|
+
settled = computed(() => this.measuredWidth() > 0 && this.layout() === this.settledLayout(), ...(ngDevMode ? [{ debugName: "settled" }] : /* istanbul ignore next */ []));
|
|
1075
1189
|
constructor() {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
1082
|
-
axisOrigin: computed(() => {
|
|
1083
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1084
|
-
return categoryIndex < 0
|
|
1085
|
-
? null
|
|
1086
|
-
: (this.barElements()[categoryIndex]?.nativeElement ?? null);
|
|
1087
|
-
}),
|
|
1088
|
-
axisEntries: this.axisEntries,
|
|
1089
|
-
axisPointElements: this.axisPointElements,
|
|
1090
|
-
});
|
|
1091
|
-
const host = this.host;
|
|
1092
|
-
listenForMarkFocus(host, (event, hit) => this.onMarkFocus(event, hit), () => {
|
|
1093
|
-
this.activeMark.leave();
|
|
1094
|
-
if (this.scales.cursorOn?.()) {
|
|
1095
|
-
this.scales.setActiveIndex(-1);
|
|
1190
|
+
super();
|
|
1191
|
+
effect((onCleanup) => {
|
|
1192
|
+
const layout = this.layout();
|
|
1193
|
+
if (this.measuredWidth() === 0 || layout === this.settledLayout()) {
|
|
1194
|
+
return;
|
|
1096
1195
|
}
|
|
1196
|
+
onCleanup(afterTwoFrames(this.zone, () => this.settledLayout.set(layout)));
|
|
1097
1197
|
});
|
|
1098
|
-
|
|
1198
|
+
// Before the view drops the stops past the new end, while the focused one is still in the DOM.
|
|
1099
1199
|
effect(() => {
|
|
1100
|
-
const
|
|
1200
|
+
const last = this.categories().length - 1;
|
|
1101
1201
|
untracked(() => {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
answeringLabel = true;
|
|
1106
|
-
this.activeMark.enter(hover.index, hover.event, this.tooltipMark(), mark);
|
|
1202
|
+
if (this.activeIndex() > last) {
|
|
1203
|
+
this.cursorState.release();
|
|
1204
|
+
this.cursorState.setIndex(last);
|
|
1107
1205
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1206
|
+
if (this.roving() > last && this.keyboardFocusInside()) {
|
|
1207
|
+
this.refocusStop = true;
|
|
1208
|
+
}
|
|
1209
|
+
if ((this.range()?.to ?? -1) > last) {
|
|
1210
|
+
this.range.set(null);
|
|
1111
1211
|
}
|
|
1112
1212
|
});
|
|
1113
1213
|
});
|
|
1214
|
+
afterRenderEffect(() => {
|
|
1215
|
+
this.categories();
|
|
1216
|
+
if (this.refocusStop) {
|
|
1217
|
+
this.refocusStop = false;
|
|
1218
|
+
untracked(() => this.focusStop(this.focusedCategory()));
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
effect((onCleanup) => {
|
|
1222
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1223
|
+
if (canvas && this.cursorResolved() === 'category') {
|
|
1224
|
+
onCleanup(this.listenForCursor(canvas));
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
effect((onCleanup) => {
|
|
1228
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1229
|
+
if (canvas && this.selectRange()) {
|
|
1230
|
+
onCleanup(this.listenForRange(canvas));
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
untracked(() => this.range.set(null));
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
// Read phase: every `getComputedTextLength` before any write, or each label forces a layout.
|
|
1237
|
+
afterRenderEffect({
|
|
1238
|
+
read: () => {
|
|
1239
|
+
this.labelTexts();
|
|
1240
|
+
this.measuredLabelWidth.set(this.widestLabel('.axis-label.is-primary'));
|
|
1241
|
+
this.measuredSecondaryLabelWidth.set(this.widestLabel('.axis-label.is-secondary'));
|
|
1242
|
+
this.measuredCategoryLabelWidth.set(this.widestLabel('.category-label'));
|
|
1243
|
+
},
|
|
1244
|
+
});
|
|
1245
|
+
afterRenderEffect({
|
|
1246
|
+
read: () => {
|
|
1247
|
+
this.shownReadout();
|
|
1248
|
+
this.rangeTotal();
|
|
1249
|
+
this.readoutTextWidth.set(this.widestLabel('.readout-text'));
|
|
1250
|
+
this.rangeTextWidth.set(this.widestLabel('.range-text'));
|
|
1251
|
+
},
|
|
1252
|
+
});
|
|
1253
|
+
// The readings and the scales change with the data, so a held pin follows its category's new geometry.
|
|
1254
|
+
afterRenderEffect({
|
|
1255
|
+
read: () => {
|
|
1256
|
+
this.tooltipContext();
|
|
1257
|
+
this.yPosition();
|
|
1258
|
+
this.secondaryYPosition();
|
|
1259
|
+
this.bandPinY.set(this.measureBandPinY());
|
|
1260
|
+
},
|
|
1261
|
+
});
|
|
1262
|
+
// Where the pin and the anchor land, not their boxes: a pin moving to another mark is mid-glide here.
|
|
1263
|
+
afterRenderEffect({
|
|
1264
|
+
read: () => {
|
|
1265
|
+
this.tooltipContext();
|
|
1266
|
+
this.bandPinY();
|
|
1267
|
+
const origin = this.tooltipOrigin();
|
|
1268
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1269
|
+
const pin = this.tooltipPinned()
|
|
1270
|
+
? this.host.nativeElement.querySelector('[dschartpinmarker]')
|
|
1271
|
+
: null;
|
|
1272
|
+
const viewHeight = this.viewHeight();
|
|
1273
|
+
if (!(origin instanceof Element) ||
|
|
1274
|
+
!pin ||
|
|
1275
|
+
!canvas ||
|
|
1276
|
+
viewHeight <= 0) {
|
|
1277
|
+
this.pinRise.set(0);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
const pixelsPerUnit = canvas.getBoundingClientRect().height / viewHeight;
|
|
1281
|
+
const pinTop = landedTranslateY(pin) - CHART_PIN_RADIUS;
|
|
1282
|
+
const rise = (landedExtent(origin, canvas, viewHeight).top - pinTop) *
|
|
1283
|
+
pixelsPerUnit;
|
|
1284
|
+
this.pinRise.set(Math.max(0, Math.round(rise)));
|
|
1285
|
+
},
|
|
1286
|
+
});
|
|
1114
1287
|
}
|
|
1115
|
-
|
|
1116
|
-
this.
|
|
1117
|
-
|
|
1288
|
+
widestLabel(selector) {
|
|
1289
|
+
const labels = this.host.nativeElement.querySelectorAll(selector);
|
|
1290
|
+
let widest = 0;
|
|
1291
|
+
for (const label of labels) {
|
|
1292
|
+
widest = Math.max(widest, label.getComputedTextLength());
|
|
1293
|
+
}
|
|
1294
|
+
return Math.ceil(widest);
|
|
1118
1295
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
/**
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
/**
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1296
|
+
/** Two plots stacked on a shared category axis. */
|
|
1297
|
+
stacked = computed(() => this.secondaryAxisMode() === 'split' && this.hasSecondaryAxis(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
1298
|
+
viewHeight = computed(() => chartViewHeight(this.plotHeight(), this.valueSpace(), this.reachesBelowZero()) + (this.stacked() ? this.plotHeight() + CHART_STACKED_PLOT_GAP : 0), ...(ngDevMode ? [{ debugName: "viewHeight" }] : /* istanbul ignore next */ []));
|
|
1299
|
+
/** One viewBox unit is one CSS pixel, so lengths inside the plot hold at every width. */
|
|
1300
|
+
viewBox = computed(() => `0 0 ${this.viewWidth()} ${this.viewHeight()}`, ...(ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []));
|
|
1301
|
+
/** Widest tick label as rendered, in CSS pixels. Zero until the first read and under SSR. */
|
|
1302
|
+
measuredLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1303
|
+
measuredCategoryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredCategoryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1304
|
+
/** `axisGutter` is the floor: compact numbers are wider in some locales and the SVG clips overflow. */
|
|
1305
|
+
effectiveAxisGutter = computed(() => Math.max(this.axisGutter(), this.measuredLabelWidth() + CHART_AXIS_LABEL_GAP + this.axisTitleGutter()), ...(ngDevMode ? [{ debugName: "effectiveAxisGutter" }] : /* istanbul ignore next */ []));
|
|
1306
|
+
/** A rotated axis title shares the tick gutter; its width is its line height. */
|
|
1307
|
+
axisTitleGutter = computed(() => this.axisLabel() ? CHART_AXIS_TITLE_BAND : 0, ...(ngDevMode ? [{ debugName: "axisTitleGutter" }] : /* istanbul ignore next */ []));
|
|
1308
|
+
axisTitleX = computed(() => CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "axisTitleX" }] : /* istanbul ignore next */ []));
|
|
1309
|
+
secondaryTitleX = computed(() => this.viewWidth() - CHART_AXIS_TITLE_BAND / 2, ...(ngDevMode ? [{ debugName: "secondaryTitleX" }] : /* istanbul ignore next */ []));
|
|
1310
|
+
measuredSecondaryLabelWidth = signal(0, ...(ngDevMode ? [{ debugName: "measuredSecondaryLabelWidth" }] : /* istanbul ignore next */ []));
|
|
1311
|
+
/** Right-hand label room only when the second axis is drawn there; a stacked one is on the left. */
|
|
1312
|
+
rightGutter = computed(() => this.hasSecondaryAxis() && !this.stacked()
|
|
1313
|
+
? Math.max(this.axisGutter(), this.measuredSecondaryLabelWidth() +
|
|
1314
|
+
CHART_AXIS_LABEL_GAP +
|
|
1315
|
+
this.secondaryTitleGutter())
|
|
1316
|
+
: CHART_EDGE_GUTTER, ...(ngDevMode ? [{ debugName: "rightGutter" }] : /* istanbul ignore next */ []));
|
|
1317
|
+
secondaryTitleGutter = computed(() => this.secondaryAxisLabel() && this.hasSecondaryAxis()
|
|
1318
|
+
? CHART_AXIS_TITLE_BAND
|
|
1319
|
+
: 0, ...(ngDevMode ? [{ debugName: "secondaryTitleGutter" }] : /* istanbul ignore next */ []));
|
|
1320
|
+
plot = computed(() => chartPlot(this.viewWidth(), this.plotHeight(), this.effectiveAxisGutter(), this.valueSpace(), this.rightGutter()), ...(ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []));
|
|
1321
|
+
secondaryPlot = computed(() => {
|
|
1322
|
+
const plot = this.plot();
|
|
1323
|
+
return this.stacked()
|
|
1324
|
+
? { ...plot, top: plot.top + plot.height + CHART_STACKED_PLOT_GAP }
|
|
1325
|
+
: plot;
|
|
1326
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryPlot" }] : /* istanbul ignore next */ []));
|
|
1327
|
+
reportedDomains = signal(new Map(), ...(ngDevMode ? [{ debugName: "reportedDomains" }] : /* istanbul ignore next */ []));
|
|
1328
|
+
reportDomain(id, values, axis = 'primary', hidden = false) {
|
|
1329
|
+
this.reportedDomains.update((reported) => new Map(reported).set(id, { axis, values, hidden }));
|
|
1330
|
+
}
|
|
1331
|
+
valuesOn(axis, withHidden = false) {
|
|
1332
|
+
const found = [];
|
|
1333
|
+
for (const report of this.reportedDomains().values()) {
|
|
1334
|
+
if (report.axis === axis && (withHidden || !report.hidden)) {
|
|
1335
|
+
found.push(report.values);
|
|
1336
|
+
}
|
|
1141
1337
|
}
|
|
1142
|
-
|
|
1143
|
-
const overflow = height - mark.height;
|
|
1144
|
-
return { y: mark.top - overflow / 2, height };
|
|
1338
|
+
return found;
|
|
1145
1339
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
: this.scales.yPosition();
|
|
1152
|
-
const spans = this.spans();
|
|
1153
|
-
const format = this.valueFormat();
|
|
1154
|
-
return this.data().map((point, index) => {
|
|
1155
|
-
const span = spans[index];
|
|
1156
|
-
const foot = toY(span.from);
|
|
1157
|
-
const tip = toY(span.to);
|
|
1158
|
-
const below = tip > foot;
|
|
1159
|
-
// Only a segment with one under it gives up the gap; the baseline segment would lift the stack off the axis.
|
|
1160
|
-
const gap = span.from === 0 ? 0 : Math.min(STACK_SEGMENT_GAP, Math.abs(tip - foot));
|
|
1161
|
-
const baseline = below ? foot + gap : foot - gap;
|
|
1162
|
-
const color = point.color ??
|
|
1163
|
-
this.seriesColor() ??
|
|
1164
|
-
CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
1165
|
-
return {
|
|
1166
|
-
key: point.id ?? String(index),
|
|
1167
|
-
point,
|
|
1168
|
-
x: toX(index),
|
|
1169
|
-
tip,
|
|
1170
|
-
below,
|
|
1171
|
-
baseline,
|
|
1172
|
-
top: Math.min(tip, baseline),
|
|
1173
|
-
height: Math.abs(tip - baseline),
|
|
1174
|
-
labelY: below ? tip + VALUE_LABEL_GAP : tip - VALUE_LABEL_GAP,
|
|
1175
|
-
pinY: this.pinYOf(tip, baseline, below),
|
|
1176
|
-
origin: below ? 'top' : 'bottom',
|
|
1177
|
-
formattedValue: format(point.value, 'tooltip'),
|
|
1178
|
-
color,
|
|
1179
|
-
hatched: (point.fill ?? this.seriesFill()) === 'hatched',
|
|
1180
|
-
};
|
|
1340
|
+
releaseDomain(id) {
|
|
1341
|
+
this.reportedDomains.update((reported) => {
|
|
1342
|
+
const next = new Map(reported);
|
|
1343
|
+
next.delete(id);
|
|
1344
|
+
return next;
|
|
1181
1345
|
});
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
|
|
1185
|
-
|
|
1346
|
+
}
|
|
1347
|
+
/** A template that replaces the panel's body. */
|
|
1348
|
+
tooltipTemplate = input(null, ...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
1349
|
+
/** Extra clearance between the mark and the panel, for a value label printed in that gap. */
|
|
1350
|
+
tooltipExtraGap = input(0, { ...(ngDevMode ? { debugName: "tooltipExtraGap" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1351
|
+
tooltipSources = signal(new Map(), ...(ngDevMode ? [{ debugName: "tooltipSources" }] : /* istanbul ignore next */ []));
|
|
1352
|
+
reportTooltip(id, source) {
|
|
1353
|
+
this.tooltipSources.update((sources) => new Map(sources).set(id, source));
|
|
1354
|
+
}
|
|
1355
|
+
releaseTooltip(id) {
|
|
1356
|
+
this.tooltipSources.update((sources) => {
|
|
1357
|
+
const next = new Map(sources);
|
|
1358
|
+
next.delete(id);
|
|
1359
|
+
return next;
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
/** Two or more marks that show a tooltip: the panel is about the category, not the mark under the pointer. */
|
|
1363
|
+
composed = computed(() => [...this.tooltipSources().values()].filter((source) => source.offersTooltip?.() ?? true).length > 1, ...(ngDevMode ? [{ debugName: "composed" }] : /* istanbul ignore next */ []));
|
|
1364
|
+
cursorResolved = computed(() => {
|
|
1365
|
+
const cursor = this.cursor();
|
|
1366
|
+
if (cursor !== 'auto') {
|
|
1367
|
+
return cursor;
|
|
1368
|
+
}
|
|
1369
|
+
const readsCategory = [...this.tooltipSources().values()].some((source) => source.readsCategory?.() ?? false);
|
|
1370
|
+
return this.composed() || readsCategory ? 'category' : 'none';
|
|
1371
|
+
}, ...(ngDevMode ? [{ debugName: "cursorResolved" }] : /* istanbul ignore next */ []));
|
|
1372
|
+
cursorOn = computed(() => this.cursorResolved() === 'category', ...(ngDevMode ? [{ debugName: "cursorOn" }] : /* istanbul ignore next */ []));
|
|
1373
|
+
/** The tooltip context to show, if any; at most one mark has one at a time. */
|
|
1374
|
+
activeTooltip = computed(() => [...this.tooltipSources().values()].find((source) => source.context() !== null) ?? null, ...(ngDevMode ? [{ debugName: "activeTooltip" }] : /* istanbul ignore next */ []));
|
|
1375
|
+
// By source and position, not label: two marks may read under one label.
|
|
1376
|
+
pickedKey = signal(null, ...(ngDevMode ? [{ debugName: "pickedKey" }] : /* istanbul ignore next */ []));
|
|
1377
|
+
pickedReading = computed(() => {
|
|
1378
|
+
const picked = this.pickedKey();
|
|
1379
|
+
return picked === null
|
|
1380
|
+
? null
|
|
1381
|
+
: (this.readingsTopDown().find((reading) => reading.key === picked) ??
|
|
1382
|
+
null);
|
|
1383
|
+
}, ...(ngDevMode ? [{ debugName: "pickedReading" }] : /* istanbul ignore next */ []));
|
|
1384
|
+
tooltipContext = computed(() => {
|
|
1385
|
+
const merged = this.categoryContext();
|
|
1386
|
+
const picked = this.pickedReading();
|
|
1387
|
+
return picked === null || !this.cursorOn() || merged === null
|
|
1388
|
+
? merged
|
|
1389
|
+
: { ...merged, entries: [picked.entry] };
|
|
1390
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1391
|
+
categoryContext = computed(() => {
|
|
1392
|
+
const base = this.activeTooltip()?.context() ?? null;
|
|
1393
|
+
const categoryIndex = this.activeIndex();
|
|
1394
|
+
if (this.cursorResolved() !== 'category' || categoryIndex < 0) {
|
|
1395
|
+
return base;
|
|
1396
|
+
}
|
|
1397
|
+
const readings = [...this.tooltipSources().values()].flatMap((source) => source.axisEntries?.() ?? []);
|
|
1398
|
+
if (base === null) {
|
|
1399
|
+
return readings.length === 0
|
|
1400
|
+
? null
|
|
1401
|
+
: {
|
|
1402
|
+
category: this.categories()[categoryIndex] ?? '',
|
|
1403
|
+
entries: topDown(readings),
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
// 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.
|
|
1407
|
+
const named = new Map(base.entries.map((entry) => [entry.label, entry]));
|
|
1408
|
+
if (readings.every((reading) => named.has(reading.label))) {
|
|
1409
|
+
return base;
|
|
1410
|
+
}
|
|
1411
|
+
const drawn = new Set(readings.map((reading) => reading.label));
|
|
1412
|
+
return {
|
|
1413
|
+
...base,
|
|
1414
|
+
entries: [
|
|
1415
|
+
...base.entries.filter((entry) => !drawn.has(entry.label)),
|
|
1416
|
+
...topDown(readings).map((reading) => named.get(reading.label) ?? reading),
|
|
1417
|
+
],
|
|
1418
|
+
};
|
|
1419
|
+
}, ...(ngDevMode ? [{ debugName: "categoryContext" }] : /* istanbul ignore next */ []));
|
|
1420
|
+
tooltipOrigin = computed(() => this.pickedReading()?.element ?? this.categoryOrigin(), ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1421
|
+
categoryOrigin = computed(() => {
|
|
1422
|
+
const own = this.activeTooltip()?.origin() ?? null;
|
|
1423
|
+
if (this.activeTooltip()?.stacked?.() && own instanceof Element) {
|
|
1424
|
+
return this.stackTop(own);
|
|
1425
|
+
}
|
|
1426
|
+
if (this.cursorResolved() !== 'category' ||
|
|
1427
|
+
(own !== null && !(own instanceof Element))) {
|
|
1428
|
+
return own;
|
|
1429
|
+
}
|
|
1430
|
+
// Anchor over the tallest reading at the category, pointer over it or not: the opening mark
|
|
1431
|
+
// puts the panel low under a column, and pointer-only readings make it jump at the column's edge.
|
|
1432
|
+
const boxes = [...this.tooltipSources().values()]
|
|
1433
|
+
.map((source) => (source.axisOrigin ?? source.origin)())
|
|
1434
|
+
.filter((origin) => origin instanceof Element)
|
|
1435
|
+
.map((element) => ({ element, top: element.getBoundingClientRect().top }))
|
|
1436
|
+
.filter(({ element }) => {
|
|
1437
|
+
const box = element.getBoundingClientRect();
|
|
1438
|
+
return box.width > 0 && box.height > 0;
|
|
1439
|
+
});
|
|
1440
|
+
const reading = this.readingAnchorTop();
|
|
1441
|
+
if (reading !== null && boxes.every(({ top }) => reading <= top)) {
|
|
1442
|
+
return this.cursorOrigin();
|
|
1443
|
+
}
|
|
1444
|
+
return boxes.length === 0
|
|
1445
|
+
? (own ?? this.cursorOrigin())
|
|
1446
|
+
: boxes.reduce((highest, candidate) => candidate.top < highest.top ? candidate : highest).element;
|
|
1447
|
+
}, ...(ngDevMode ? [{ debugName: "categoryOrigin" }] : /* istanbul ignore next */ []));
|
|
1448
|
+
/** The highest reading a mark reports without an element; the cursor band shrinks to a marker's
|
|
1449
|
+
* box there, so the panel and the pin anchor to it as to a marker. */
|
|
1450
|
+
readingY = computed(() => {
|
|
1451
|
+
let highest = null;
|
|
1452
|
+
for (const source of this.tooltipSources().values()) {
|
|
1453
|
+
const y = source.axisReadingY?.() ?? null;
|
|
1454
|
+
if (y !== null && (highest === null || y < highest)) {
|
|
1455
|
+
highest = y;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return highest;
|
|
1459
|
+
}, ...(ngDevMode ? [{ debugName: "readingY" }] : /* istanbul ignore next */ []));
|
|
1460
|
+
// In client pixels, as the boxes it is compared with; from the reading, not the anchor's box, which may not have moved yet.
|
|
1461
|
+
readingAnchorTop() {
|
|
1462
|
+
const y = this.readingY();
|
|
1463
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1464
|
+
const viewHeight = this.viewHeight();
|
|
1465
|
+
if (y === null || !canvas || viewHeight <= 0) {
|
|
1466
|
+
return null;
|
|
1467
|
+
}
|
|
1468
|
+
const frame = canvas.getBoundingClientRect();
|
|
1469
|
+
const radius = parseFloat(getComputedStyle(this.host.nativeElement).getPropertyValue('--ds-chart-dot-radius')) || 0;
|
|
1470
|
+
return frame.top + ((y - radius) * frame.height) / viewHeight;
|
|
1471
|
+
}
|
|
1472
|
+
tooltipPinned = computed(() => (this.activeTooltip()?.pinned?.() ?? false) || this.cursorPinned(), ...(ngDevMode ? [{ debugName: "tooltipPinned" }] : /* istanbul ignore next */ []));
|
|
1473
|
+
/** Compared by value: a mark that reports and reads `yPosition()` in one effect would otherwise loop forever. */
|
|
1474
|
+
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 });
|
|
1475
|
+
// Counts values, not reporters: a line series registers both axes, so an empty one would raise a second axis.
|
|
1476
|
+
hasSecondaryAxis = computed(() => this.valuesOn('secondary').some((values) => values.length > 0), ...(ngDevMode ? [{ debugName: "hasSecondaryAxis" }] : /* istanbul ignore next */ []));
|
|
1477
|
+
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 &&
|
|
1478
|
+
a.domain.min === b.domain.min &&
|
|
1479
|
+
a.domain.max === b.domain.max &&
|
|
1480
|
+
a.ticks.length === b.ticks.length &&
|
|
1481
|
+
a.ticks.every((tick, index) => tick === b.ticks[index]) });
|
|
1482
|
+
secondaryYPosition = computed(() => {
|
|
1483
|
+
if (!this.hasSecondaryAxis()) {
|
|
1484
|
+
return this.yPosition();
|
|
1485
|
+
}
|
|
1486
|
+
const plot = this.secondaryPlot();
|
|
1487
|
+
return valueScale(this.secondary().domain, plot.top, plot.height);
|
|
1488
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryYPosition" }] : /* istanbul ignore next */ []));
|
|
1489
|
+
secondaryTicks = computed(() => {
|
|
1490
|
+
if (!this.hasSecondaryAxis()) {
|
|
1491
|
+
return [];
|
|
1492
|
+
}
|
|
1493
|
+
const toY = this.secondaryYPosition();
|
|
1494
|
+
const format = this.valueFormatResolved();
|
|
1495
|
+
return this.secondary().ticks.map((value) => ({
|
|
1496
|
+
value,
|
|
1497
|
+
y: toY(value),
|
|
1498
|
+
label: format(value, 'tick'),
|
|
1499
|
+
}));
|
|
1500
|
+
}, ...(ngDevMode ? [{ debugName: "secondaryTicks" }] : /* istanbul ignore next */ []));
|
|
1501
|
+
/** Second gridlines only where the scales do not share rows; an aligned axis would double every stroke. */
|
|
1502
|
+
showSecondaryGridlines = computed(() => this.hasSecondaryAxis() &&
|
|
1503
|
+
(this.stacked() || !this.secondary().aligned) &&
|
|
1504
|
+
this.secondaryTicks().length > 1, ...(ngDevMode ? [{ debugName: "showSecondaryGridlines" }] : /* istanbul ignore next */ []));
|
|
1505
|
+
secondaryLabelX = computed(() => this.stacked()
|
|
1506
|
+
? this.plot().left - CHART_AXIS_LABEL_GAP
|
|
1507
|
+
: this.plot().left + this.plot().width + CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "secondaryLabelX" }] : /* istanbul ignore next */ []));
|
|
1508
|
+
secondaryLabelAnchor = computed(() => this.stacked() ? 'end' : 'start', ...(ngDevMode ? [{ debugName: "secondaryLabelAnchor" }] : /* istanbul ignore next */ []));
|
|
1509
|
+
secondaryPlotBottom = computed(() => this.secondaryPlot().top + this.secondaryPlot().height, ...(ngDevMode ? [{ debugName: "secondaryPlotBottom" }] : /* istanbul ignore next */ []));
|
|
1510
|
+
/** No tint on a single-scale plot. */
|
|
1511
|
+
axisLabelFill = computed(() => this.hasSecondaryAxis() ? this.axisColor() : null, ...(ngDevMode ? [{ debugName: "axisLabelFill" }] : /* istanbul ignore next */ []));
|
|
1512
|
+
secondaryAxisLabelFill = computed(() => this.secondaryAxisColor(), ...(ngDevMode ? [{ debugName: "secondaryAxisLabelFill" }] : /* istanbul ignore next */ []));
|
|
1513
|
+
bands = computed(() => bandScale(this.categories().length, this.plot().width, CHART_BAND_PADDING), ...(ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []));
|
|
1514
|
+
bandWidth = computed(() => this.bands().bandWidth, ...(ngDevMode ? [{ debugName: "bandWidth" }] : /* istanbul ignore next */ []));
|
|
1515
|
+
xPosition = computed(() => {
|
|
1516
|
+
const plot = this.plot();
|
|
1517
|
+
const bands = this.bands();
|
|
1518
|
+
return (index) => plot.left + bands.position(index) + bands.bandWidth / 2;
|
|
1519
|
+
}, ...(ngDevMode ? [{ debugName: "xPosition" }] : /* istanbul ignore next */ []));
|
|
1520
|
+
yPosition = computed(() => {
|
|
1521
|
+
const plot = this.plot();
|
|
1522
|
+
return valueScale(this.domain(), plot.top, plot.height);
|
|
1523
|
+
}, ...(ngDevMode ? [{ debugName: "yPosition" }] : /* istanbul ignore next */ []));
|
|
1524
|
+
zeroOffset = computed(() => this.yPosition()(0), ...(ngDevMode ? [{ debugName: "zeroOffset" }] : /* istanbul ignore next */ []));
|
|
1525
|
+
bandAt(index) {
|
|
1526
|
+
if (this.cursorResolved() !== 'category' || index < 0) {
|
|
1527
|
+
return null;
|
|
1528
|
+
}
|
|
1529
|
+
const width = this.bandWidth();
|
|
1530
|
+
const plot = this.plot();
|
|
1531
|
+
return {
|
|
1532
|
+
x: this.xPosition()(index) - width / 2,
|
|
1533
|
+
width,
|
|
1534
|
+
top: plot.top,
|
|
1535
|
+
bottom: plot.top + plot.height,
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
/** The band the panel reads from, drawn invisible as its fallback anchor. */
|
|
1539
|
+
cursorBand = computed(() => this.bandAt(this.activeIndex()), ...(ngDevMode ? [{ debugName: "cursorBand" }] : /* istanbul ignore next */ []));
|
|
1540
|
+
// A held band is not highlighted: under a pin the highlight follows the pointer alone.
|
|
1541
|
+
highlightBand = computed(() => this.bandAt(this.tooltipPinned() ? this.hoveredCategory() : this.activeIndex()), ...(ngDevMode ? [{ debugName: "highlightBand" }] : /* istanbul ignore next */ []));
|
|
1542
|
+
/** The same state machine the element marks run on; here the index counts categories. */
|
|
1543
|
+
cursorState = chartActiveMark(() => this.defaults.tooltipLingerMs(), () => this.hoverDelayMs());
|
|
1544
|
+
activeIndex = this.cursorState.index;
|
|
1545
|
+
pointerAt = signal(null, ...(ngDevMode ? [{ debugName: "pointerAt" }] : /* istanbul ignore next */ []));
|
|
1546
|
+
// Set at once, not after the hover delay.
|
|
1547
|
+
pointerInBand = signal(false, ...(ngDevMode ? [{ debugName: "pointerInBand" }] : /* istanbul ignore next */ []));
|
|
1548
|
+
hoveredCategory = signal(-1, ...(ngDevMode ? [{ debugName: "hoveredCategory" }] : /* istanbul ignore next */ []));
|
|
1549
|
+
/** Under the panel: it opens over the tallest reading, so the disc sits at that reading's head -
|
|
1550
|
+
* inside a column, below a marker, and over a column too short to hold it. */
|
|
1551
|
+
bandPinY = signal(0, ...(ngDevMode ? [{ debugName: "bandPinY" }] : /* istanbul ignore next */ []));
|
|
1552
|
+
// The highest segment at the mark's category, by where each lands: a segment glides after a data change.
|
|
1553
|
+
stackTop(segment) {
|
|
1554
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1555
|
+
const index = segment
|
|
1556
|
+
.closest('[data-mark-index]')
|
|
1557
|
+
?.getAttribute('data-mark-index');
|
|
1558
|
+
if (!canvas || index == null) {
|
|
1559
|
+
return segment;
|
|
1560
|
+
}
|
|
1561
|
+
const segments = this.host.nativeElement.querySelectorAll(`[data-mark-index="${index}"] > .bar`);
|
|
1562
|
+
let highest = segment;
|
|
1563
|
+
let highestTop = landedExtent(segment, canvas, this.viewHeight()).top;
|
|
1564
|
+
for (const candidate of segments) {
|
|
1565
|
+
const top = landedExtent(candidate, canvas, this.viewHeight()).top;
|
|
1566
|
+
if (top < highestTop) {
|
|
1567
|
+
highest = candidate;
|
|
1568
|
+
highestTop = top;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
return highest;
|
|
1572
|
+
}
|
|
1573
|
+
// Read from the marks' bound geometry, not their boxes: after a data change the boxes are mid-glide,
|
|
1574
|
+
// and the pin glides to where the reading lands.
|
|
1575
|
+
measureBandPinY() {
|
|
1576
|
+
const band = this.cursorBand();
|
|
1186
1577
|
const inset = CHART_PIN_RADIUS + CHART_PIN_GAP;
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1189
|
-
|
|
1578
|
+
const origin = this.tooltipOrigin();
|
|
1579
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1580
|
+
if (!band || !canvas || !(origin instanceof Element)) {
|
|
1581
|
+
return (band?.top ?? 0) + inset;
|
|
1582
|
+
}
|
|
1583
|
+
const { top, height } = landedExtent(origin, canvas, this.viewHeight());
|
|
1584
|
+
if (height < 2 * inset && !origin.matches('.bar')) {
|
|
1585
|
+
return top + height + inset;
|
|
1586
|
+
}
|
|
1587
|
+
const value = origin.parentElement?.querySelector(':scope > .value');
|
|
1588
|
+
return pinYAbove(top, height, value ? landedTextTop(value) : null, inset);
|
|
1589
|
+
}
|
|
1590
|
+
/** How far a held pin sits above the panel's anchor; the panel rises by as much to stay over it. */
|
|
1591
|
+
pinRise = signal(0, ...(ngDevMode ? [{ debugName: "pinRise" }] : /* istanbul ignore next */ []));
|
|
1592
|
+
tooltipGap = computed(() => Math.max(this.tooltipExtraGap(), this.pinRise()), ...(ngDevMode ? [{ debugName: "tooltipGap" }] : /* istanbul ignore next */ []));
|
|
1593
|
+
pinnedCategories = computed(() => this.cursorPinned() && this.cursorBand() ? [this.activeIndex()] : [], ...(ngDevMode ? [{ debugName: "pinnedCategories" }] : /* istanbul ignore next */ []));
|
|
1594
|
+
lineSeries = contentChildren(LineSeriesComponent, { ...(ngDevMode ? { debugName: "lineSeries" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1595
|
+
pinnedLine = computed(() => this.lineSeries().length > 0, ...(ngDevMode ? [{ debugName: "pinnedLine" }] : /* istanbul ignore next */ []));
|
|
1596
|
+
bandPins = computed(() => this.pinOnClickResolved() && this.pointerInBand(), ...(ngDevMode ? [{ debugName: "bandPins" }] : /* istanbul ignore next */ []));
|
|
1597
|
+
cursorPointer = computed(() => this.activeIndex() < 0 ? null : this.pointerAt(), ...(ngDevMode ? [{ debugName: "cursorPointer" }] : /* istanbul ignore next */ []));
|
|
1598
|
+
/** Whether the cursor is held. */
|
|
1599
|
+
cursorPinned = this.cursorState.pinned;
|
|
1600
|
+
drawsUnpin = !inject(CHART_UNPIN_DRAWN_BY_HOST, {
|
|
1601
|
+
optional: true,
|
|
1602
|
+
});
|
|
1603
|
+
releaseCursor() {
|
|
1604
|
+
this.cursorState.release();
|
|
1605
|
+
}
|
|
1606
|
+
canvasElement = viewChild('canvasEl', ...(ngDevMode ? [{ debugName: "canvasElement" }] : /* istanbul ignore next */ []));
|
|
1607
|
+
// Read once per hover and dropped on scroll: reading on every move forces a second layout after the band update.
|
|
1608
|
+
canvasRect = null;
|
|
1609
|
+
forgetCanvasRect = () => {
|
|
1610
|
+
this.canvasRect = null;
|
|
1611
|
+
};
|
|
1612
|
+
// Client x to view units: the canvas is scaled to its box.
|
|
1613
|
+
viewXOf(event, canvas) {
|
|
1614
|
+
this.canvasRect ??= canvas.getBoundingClientRect();
|
|
1615
|
+
return (((event.clientX - this.canvasRect.left) / this.canvasRect.width) *
|
|
1616
|
+
this.viewWidth());
|
|
1617
|
+
}
|
|
1618
|
+
plotPointer(event, canvas) {
|
|
1619
|
+
const plot = this.plot();
|
|
1620
|
+
const viewX = this.viewXOf(event, canvas);
|
|
1621
|
+
// Every point belongs to its nearest category, so the cursor never passes through "none".
|
|
1622
|
+
const index = this.clampIndex(categoryAt(viewX, plot.left, plot.width, this.categories().length));
|
|
1623
|
+
this.pointerAt.set({ x: event.clientX, y: event.clientY });
|
|
1624
|
+
this.pointerInBand.set(index >= 0);
|
|
1625
|
+
this.hoveredCategory.set(index);
|
|
1626
|
+
if (index < 0) {
|
|
1627
|
+
if (event.type === 'pointerdown' && this.cursorPinned()) {
|
|
1628
|
+
this.cursorState.release();
|
|
1629
|
+
}
|
|
1630
|
+
else {
|
|
1631
|
+
this.cursorState.leave();
|
|
1632
|
+
}
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
// Under `selectRange` a press may become a drag; the range listener pins on a release in place.
|
|
1636
|
+
if (event.type === 'pointerdown' &&
|
|
1637
|
+
this.pinOnClickResolved() &&
|
|
1638
|
+
!this.selectRange()) {
|
|
1639
|
+
this.cursorState.pin(index, event);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
this.cursorState.enter(index, event);
|
|
1643
|
+
}
|
|
1644
|
+
/** Listens only when a category cursor is drawn, outside the zone. */
|
|
1645
|
+
listenForCursor(canvas) {
|
|
1646
|
+
const forgetRect = this.forgetCanvasRect;
|
|
1647
|
+
const onPointer = (event) => {
|
|
1648
|
+
if (event.type === 'pointerdown' && !isPrimaryPress(event)) {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
this.plotPointer(event, canvas);
|
|
1652
|
+
};
|
|
1653
|
+
const onEnter = () => window.addEventListener('scroll', forgetRect, {
|
|
1654
|
+
capture: true,
|
|
1655
|
+
passive: true,
|
|
1656
|
+
});
|
|
1657
|
+
const onLeave = () => {
|
|
1658
|
+
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
1659
|
+
forgetRect();
|
|
1660
|
+
this.pointerInBand.set(false);
|
|
1661
|
+
this.hoveredCategory.set(-1);
|
|
1662
|
+
// The panel goes back to the band the keyboard holds, which keeps it open while focus stays.
|
|
1663
|
+
if (this.keyboardFocusInside()) {
|
|
1664
|
+
this.cursorState.setIndex(this.focusedCategory());
|
|
1665
|
+
}
|
|
1666
|
+
else {
|
|
1667
|
+
this.cursorState.leave();
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
this.zone.runOutsideAngular(() => {
|
|
1671
|
+
canvas.addEventListener('pointerenter', onEnter);
|
|
1672
|
+
canvas.addEventListener('pointermove', onPointer);
|
|
1673
|
+
canvas.addEventListener('pointerdown', onPointer);
|
|
1674
|
+
canvas.addEventListener('pointerleave', onLeave);
|
|
1675
|
+
});
|
|
1676
|
+
return () => {
|
|
1677
|
+
canvas.removeEventListener('pointerenter', onEnter);
|
|
1678
|
+
canvas.removeEventListener('pointermove', onPointer);
|
|
1679
|
+
canvas.removeEventListener('pointerdown', onPointer);
|
|
1680
|
+
canvas.removeEventListener('pointerleave', onLeave);
|
|
1681
|
+
window.removeEventListener('scroll', forgetRect, { capture: true });
|
|
1682
|
+
forgetRect();
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
range = signal(null, ...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
1686
|
+
/** The categories a drag selected, both ends included; `null` when none are. */
|
|
1687
|
+
selectedRange = this.range.asReadonly();
|
|
1688
|
+
listenForRange(canvas) {
|
|
1689
|
+
const document = canvas.ownerDocument;
|
|
1690
|
+
const view = document.defaultView ?? window;
|
|
1691
|
+
let anchor = -1;
|
|
1692
|
+
let dragged = false;
|
|
1693
|
+
const forgetRectWhileDragging = () => this.forgetCanvasRect();
|
|
1694
|
+
// Past either end of the plot a drag holds the nearest category.
|
|
1695
|
+
const categoryOf = (event, clamp) => {
|
|
1696
|
+
const plot = this.plot();
|
|
1697
|
+
const viewX = this.viewXOf(event, canvas);
|
|
1698
|
+
const x = clamp
|
|
1699
|
+
? Math.min(Math.max(viewX, plot.left), plot.left + plot.width)
|
|
1700
|
+
: viewX;
|
|
1701
|
+
return categoryAt(x, plot.left, plot.width, this.categories().length);
|
|
1702
|
+
};
|
|
1703
|
+
const onMove = (event) => {
|
|
1704
|
+
const index = categoryOf(event, true);
|
|
1705
|
+
if (index < 0 || (index === anchor && !dragged)) {
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
dragged = true;
|
|
1709
|
+
this.range.set({
|
|
1710
|
+
from: Math.min(anchor, index),
|
|
1711
|
+
to: Math.max(anchor, index),
|
|
1712
|
+
});
|
|
1713
|
+
};
|
|
1714
|
+
const stopDrag = () => {
|
|
1715
|
+
view.removeEventListener('pointermove', onMove);
|
|
1716
|
+
view.removeEventListener('pointerup', onUp);
|
|
1717
|
+
view.removeEventListener('scroll', forgetRectWhileDragging, {
|
|
1718
|
+
capture: true,
|
|
1719
|
+
});
|
|
1720
|
+
anchor = -1;
|
|
1721
|
+
};
|
|
1722
|
+
const onUp = (event) => {
|
|
1723
|
+
if (!dragged && this.cursorOn() && this.pinOnClickResolved()) {
|
|
1724
|
+
this.cursorState.pin(anchor, event, null, canvas);
|
|
1725
|
+
}
|
|
1726
|
+
stopDrag();
|
|
1727
|
+
};
|
|
1728
|
+
const onDown = (event) => {
|
|
1729
|
+
if (!isPrimaryPress(event)) {
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
stopDrag();
|
|
1733
|
+
this.range.set(null);
|
|
1734
|
+
dragged = false;
|
|
1735
|
+
this.forgetCanvasRect();
|
|
1736
|
+
anchor = categoryOf(event, false);
|
|
1737
|
+
if (anchor >= 0) {
|
|
1738
|
+
view.addEventListener('pointermove', onMove);
|
|
1739
|
+
view.addEventListener('pointerup', onUp);
|
|
1740
|
+
view.addEventListener('scroll', forgetRectWhileDragging, {
|
|
1741
|
+
capture: true,
|
|
1742
|
+
passive: true,
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
const onOutside = (event) => {
|
|
1747
|
+
if (!(event.target instanceof Node) || !canvas.contains(event.target)) {
|
|
1748
|
+
this.range.set(null);
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
const onEscape = (event) => {
|
|
1752
|
+
if (event.key === 'Escape') {
|
|
1753
|
+
this.range.set(null);
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
this.zone.runOutsideAngular(() => {
|
|
1757
|
+
canvas.addEventListener('pointerdown', onDown);
|
|
1758
|
+
document.addEventListener('pointerdown', onOutside, true);
|
|
1759
|
+
document.addEventListener('keydown', onEscape);
|
|
1760
|
+
});
|
|
1761
|
+
return () => {
|
|
1762
|
+
stopDrag();
|
|
1763
|
+
canvas.removeEventListener('pointerdown', onDown);
|
|
1764
|
+
document.removeEventListener('pointerdown', onOutside, true);
|
|
1765
|
+
document.removeEventListener('keydown', onEscape);
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
rangeTotal = computed(() => {
|
|
1769
|
+
const range = this.range();
|
|
1770
|
+
if (!range) {
|
|
1771
|
+
return null;
|
|
1772
|
+
}
|
|
1773
|
+
const perSource = [...this.tooltipSources().values()].map((source) => source.valuesByCategory?.() ?? []);
|
|
1774
|
+
let total = 0;
|
|
1775
|
+
let count = 0;
|
|
1776
|
+
for (let index = range.from; index <= range.to; index++) {
|
|
1777
|
+
for (const values of perSource) {
|
|
1778
|
+
for (const value of values[index] ?? []) {
|
|
1779
|
+
total += value;
|
|
1780
|
+
count++;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
const categories = this.categories();
|
|
1785
|
+
const name = range.from === range.to
|
|
1786
|
+
? (categories[range.from] ?? '')
|
|
1787
|
+
: `${categories[range.from] ?? ''}-${categories[range.to] ?? ''}`;
|
|
1788
|
+
const format = this.valueFormatResolved();
|
|
1789
|
+
const rangeTotal = this.intl().chart.rangeTotal ?? DS_INTL_DEFAULTS.chart.rangeTotal;
|
|
1790
|
+
return rangeTotal(name, format(total, 'tooltip'), format(count > 0 ? total / count : 0, 'tooltip'));
|
|
1791
|
+
}, ...(ngDevMode ? [{ debugName: "rangeTotal" }] : /* istanbul ignore next */ []));
|
|
1792
|
+
rangeTextWidth = signal(0, ...(ngDevMode ? [{ debugName: "rangeTextWidth" }] : /* istanbul ignore next */ []));
|
|
1793
|
+
rangeBand = computed(() => {
|
|
1794
|
+
const range = this.range();
|
|
1795
|
+
const label = this.rangeTotal();
|
|
1796
|
+
const count = this.categories().length;
|
|
1797
|
+
if (!range || label === null || count === 0) {
|
|
1798
|
+
return null;
|
|
1799
|
+
}
|
|
1800
|
+
const plot = this.plot();
|
|
1801
|
+
const step = plot.width / count;
|
|
1802
|
+
const x = plot.left + step * range.from + RANGE_BAND_INSET;
|
|
1803
|
+
const width = step * (range.to - range.from + 1) - 2 * RANGE_BAND_INSET;
|
|
1804
|
+
const pillWidth = this.rangeTextWidth() + 2 * PILL_PADDING;
|
|
1805
|
+
const half = Math.min(pillWidth, plot.width) / 2;
|
|
1806
|
+
return {
|
|
1807
|
+
x,
|
|
1808
|
+
width,
|
|
1809
|
+
top: plot.top,
|
|
1810
|
+
height: plot.height,
|
|
1811
|
+
label,
|
|
1812
|
+
pillWidth,
|
|
1813
|
+
pillX: Math.min(Math.max(x + width / 2, plot.left + half), plot.left + plot.width - half),
|
|
1814
|
+
pillY: plot.top - RANGE_PILL_RISE,
|
|
1815
|
+
};
|
|
1816
|
+
}, ...(ngDevMode ? [{ debugName: "rangeBand" }] : /* istanbul ignore next */ []));
|
|
1817
|
+
/** Under the category cursor the highest reading at the category, or the one the keyboard picked;
|
|
1818
|
+
* otherwise the reading of the mark answering the pointer or focus. */
|
|
1819
|
+
activeReadout = computed(() => {
|
|
1820
|
+
if (this.cursorOn()) {
|
|
1821
|
+
const categoryIndex = this.activeIndex();
|
|
1822
|
+
if (categoryIndex < 0) {
|
|
1823
|
+
return null;
|
|
1824
|
+
}
|
|
1825
|
+
const top = this.pickedReading()?.entry ??
|
|
1826
|
+
highestReading([...this.tooltipSources().values()].flatMap((source) => source.axisEntries?.() ?? []));
|
|
1827
|
+
return top?.y === undefined
|
|
1828
|
+
? null
|
|
1829
|
+
: { categoryIndex, y: top.y, axis: top.axis };
|
|
1830
|
+
}
|
|
1831
|
+
for (const source of this.tooltipSources().values()) {
|
|
1832
|
+
const readout = source.axisReadout?.();
|
|
1833
|
+
if (readout) {
|
|
1834
|
+
return readout;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
return null;
|
|
1838
|
+
}, ...(ngDevMode ? [{ debugName: "activeReadout" }] : /* istanbul ignore next */ []));
|
|
1839
|
+
readoutTextWidth = signal(0, ...(ngDevMode ? [{ debugName: "readoutTextWidth" }] : /* istanbul ignore next */ []));
|
|
1840
|
+
/** A guide from the value axis at the active reading, and the axis value there in a pill on the axis. */
|
|
1841
|
+
shownReadout = computed(() => {
|
|
1842
|
+
const readout = this.showAxisReadout() ? this.activeReadout() : null;
|
|
1843
|
+
if (!readout) {
|
|
1844
|
+
return null;
|
|
1845
|
+
}
|
|
1846
|
+
const secondary = readout.axis === 'secondary' && this.hasSecondaryAxis();
|
|
1847
|
+
const plot = secondary ? this.secondaryPlot() : this.plot();
|
|
1848
|
+
const domain = secondary ? this.secondary().domain : this.domain();
|
|
1849
|
+
const share = plot.height > 0 ? (plot.top + plot.height - readout.y) / plot.height : 0;
|
|
1850
|
+
// Rounded off the float noise the inversion adds, so a reading of 620 prints as 620.
|
|
1851
|
+
const value = Math.round((domain.min + share * (domain.max - domain.min)) * 1e6) / 1e6;
|
|
1852
|
+
const onRight = secondary && !this.stacked();
|
|
1853
|
+
const half = this.bandWidth() / 2;
|
|
1854
|
+
const centre = this.xPosition()(readout.categoryIndex);
|
|
1855
|
+
const toMark = readout.reach === 'mark';
|
|
1856
|
+
const pillWidth = this.readoutTextWidth() + 2 * PILL_PADDING;
|
|
1857
|
+
const format = this.valueFormatResolved();
|
|
1858
|
+
return {
|
|
1859
|
+
categoryIndex: readout.categoryIndex,
|
|
1860
|
+
y: readout.y,
|
|
1861
|
+
label: format(value, format.handlesReadout ? 'readout' : 'tooltip'),
|
|
1862
|
+
x1: onRight && toMark ? centre - half : this.plot().left,
|
|
1863
|
+
x2: !onRight && toMark ? centre + half : this.plotRight(),
|
|
1864
|
+
pillWidth,
|
|
1865
|
+
pillX: onRight
|
|
1866
|
+
? this.plotRight() + READOUT_PILL_GAP
|
|
1867
|
+
: this.plot().left - READOUT_PILL_GAP - pillWidth,
|
|
1868
|
+
};
|
|
1869
|
+
}, ...(ngDevMode ? [{ debugName: "shownReadout" }] : /* istanbul ignore next */ []));
|
|
1870
|
+
hotCategory = computed(() => this.shownReadout()?.categoryIndex ?? -1, ...(ngDevMode ? [{ debugName: "hotCategory" }] : /* istanbul ignore next */ []));
|
|
1871
|
+
bandElement = viewChild('cursorBandEl', ...(ngDevMode ? [{ debugName: "bandElement" }] : /* istanbul ignore next */ []));
|
|
1872
|
+
cursorOrigin = computed(() => this.cursorBand() ? (this.bandElement()?.nativeElement ?? null) : null, ...(ngDevMode ? [{ debugName: "cursorOrigin" }] : /* istanbul ignore next */ []));
|
|
1873
|
+
keyboardStops = computed(() => this.cursorOn() && this.interactive(), ...(ngDevMode ? [{ debugName: "keyboardStops" }] : /* istanbul ignore next */ []));
|
|
1874
|
+
roving = signal(0, ...(ngDevMode ? [{ debugName: "roving" }] : /* istanbul ignore next */ []));
|
|
1875
|
+
refocusStop = false;
|
|
1876
|
+
focusedCategory = computed(() => Math.min(this.roving(), Math.max(0, this.categories().length - 1)), ...(ngDevMode ? [{ debugName: "focusedCategory" }] : /* istanbul ignore next */ []));
|
|
1877
|
+
focusedStopX = computed(() => this.xPosition()(this.focusedCategory()) - this.bandWidth() / 2, ...(ngDevMode ? [{ debugName: "focusedStopX" }] : /* istanbul ignore next */ []));
|
|
1878
|
+
categoryStops = computed(() => {
|
|
1879
|
+
const toX = this.xPosition();
|
|
1880
|
+
const width = this.bandWidth();
|
|
1881
|
+
return this.categories().map((category, index) => ({
|
|
1882
|
+
index,
|
|
1883
|
+
category,
|
|
1884
|
+
x: toX(index) - width / 2,
|
|
1885
|
+
width,
|
|
1886
|
+
}));
|
|
1887
|
+
}, ...(ngDevMode ? [{ debugName: "categoryStops" }] : /* istanbul ignore next */ []));
|
|
1888
|
+
// Only the active category's readings are known; a stop is named once the cursor is on it, which focusing it does first.
|
|
1889
|
+
stopLabel(index) {
|
|
1890
|
+
const category = this.categories()[index] ?? '';
|
|
1891
|
+
const context = this.activeIndex() === index ? this.categoryContext() : null;
|
|
1892
|
+
const readings = context?.entries.map((entry) => `${entry.label} ${entry.formatted ?? entry.value}`) ?? [];
|
|
1893
|
+
return readings.length ? `${category}: ${readings.join(', ')}` : category;
|
|
1894
|
+
}
|
|
1895
|
+
onStopFocus(index, event) {
|
|
1896
|
+
this.roving.set(index);
|
|
1897
|
+
this.pickedKey.set(null);
|
|
1898
|
+
this.cursorState.enter(index, event, null, event.target);
|
|
1899
|
+
}
|
|
1900
|
+
leavesChart(event) {
|
|
1901
|
+
const next = event.relatedTarget;
|
|
1902
|
+
return (!(next instanceof Element) || !this.host.nativeElement.contains(next));
|
|
1903
|
+
}
|
|
1904
|
+
onStopBlur(event) {
|
|
1905
|
+
if (this.leavesChart(event)) {
|
|
1906
|
+
this.cursorState.leave();
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
onChartFocusOut(event) {
|
|
1910
|
+
if (this.leavesChart(event)) {
|
|
1911
|
+
this.pickedKey.set(null);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
// Index after focus: the marker losing focus clears the series' cursor index on its way out.
|
|
1915
|
+
// Moving to another band lets a pin go; returning to the held band keeps it.
|
|
1916
|
+
focusStop(index) {
|
|
1917
|
+
this.roving.set(index);
|
|
1918
|
+
this.host.nativeElement
|
|
1919
|
+
.querySelector(`.category-stop[data-category-index="${index}"]`)
|
|
1920
|
+
?.focus();
|
|
1921
|
+
if (this.cursorPinned() && this.activeIndex() !== index) {
|
|
1922
|
+
this.cursorState.release();
|
|
1923
|
+
}
|
|
1924
|
+
this.cursorState.setIndex(index);
|
|
1925
|
+
}
|
|
1926
|
+
keyboardFocusInside() {
|
|
1927
|
+
const focused = this.host.nativeElement.ownerDocument.activeElement;
|
|
1928
|
+
return (this.keyboardStops() &&
|
|
1929
|
+
focused !== null &&
|
|
1930
|
+
this.host.nativeElement.contains(focused) &&
|
|
1931
|
+
focused.closest('.category-stop, [data-mark-index]') !== null);
|
|
1932
|
+
}
|
|
1933
|
+
// Ahead of the pin's own document-capture Escape, which would release the pin before the marker steps back.
|
|
1934
|
+
stepBackOnEscape = this.listenForEscapeFromMarker();
|
|
1935
|
+
listenForEscapeFromMarker() {
|
|
1936
|
+
if (!this.isBrowser) {
|
|
1937
|
+
return;
|
|
1190
1938
|
}
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1939
|
+
const document = this.host.nativeElement.ownerDocument;
|
|
1940
|
+
const onKey = (event) => {
|
|
1941
|
+
const target = event.target;
|
|
1942
|
+
if (event.key !== 'Escape' ||
|
|
1943
|
+
!this.keyboardStops() ||
|
|
1944
|
+
!this.cursorPinned() ||
|
|
1945
|
+
!(target instanceof Element) ||
|
|
1946
|
+
!this.host.nativeElement.contains(target) ||
|
|
1947
|
+
target.closest('.category-stop') !== null ||
|
|
1948
|
+
target.closest('[data-mark-index]') === null) {
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
event.stopImmediatePropagation();
|
|
1952
|
+
event.preventDefault();
|
|
1953
|
+
this.pickedKey.set(null);
|
|
1954
|
+
this.focusStop(this.focusedCategory());
|
|
1955
|
+
};
|
|
1956
|
+
document.addEventListener('keydown', onKey, true);
|
|
1957
|
+
inject(DestroyRef).onDestroy(() => document.removeEventListener('keydown', onKey, true));
|
|
1193
1958
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1959
|
+
// Held by the canvas, as a pointer pin is: a press on the band then releases it instead of re-pinning.
|
|
1960
|
+
pinFromKeyboard(index, event) {
|
|
1961
|
+
const canvas = this.canvasElement()?.nativeElement;
|
|
1962
|
+
this.cursorState.pin(index, event, null, canvas);
|
|
1196
1963
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1964
|
+
readingsTopDown() {
|
|
1965
|
+
return ([...this.tooltipSources()]
|
|
1966
|
+
.flatMap(([sourceId, source]) => {
|
|
1967
|
+
const elements = source.axisPointElements?.() ?? [];
|
|
1968
|
+
return (source.axisEntries?.() ?? []).map((entry, index) => ({
|
|
1969
|
+
key: `${sourceId}:${index}`,
|
|
1970
|
+
entry,
|
|
1971
|
+
element: elements[index] ?? null,
|
|
1972
|
+
}));
|
|
1973
|
+
})
|
|
1974
|
+
// A mark without `interactive` has no tabindex and would swallow the focus call.
|
|
1975
|
+
.filter((reading) => reading.element?.hasAttribute('tabindex') ?? false)
|
|
1976
|
+
.sort((a, b) => (a.entry.y ?? 0) - (b.entry.y ?? 0)));
|
|
1977
|
+
}
|
|
1978
|
+
onChartKey(event) {
|
|
1979
|
+
if (!this.keyboardStops() || !(event.target instanceof Element)) {
|
|
1202
1980
|
return;
|
|
1203
1981
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1982
|
+
const onStop = event.target.closest('.category-stop') !== null;
|
|
1983
|
+
const fromMarker = !onStop && event.target.closest('[data-mark-index]') !== null;
|
|
1984
|
+
if (!onStop && !fromMarker) {
|
|
1985
|
+
return;
|
|
1207
1986
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1987
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
1988
|
+
event.preventDefault();
|
|
1989
|
+
// The pointer may have moved or pinned the cursor elsewhere, or Escape cleared it, since the stop took focus.
|
|
1990
|
+
if (this.cursorPinned() &&
|
|
1991
|
+
this.activeIndex() !== this.focusedCategory()) {
|
|
1992
|
+
this.cursorState.release();
|
|
1993
|
+
}
|
|
1994
|
+
this.cursorState.setIndex(this.focusedCategory());
|
|
1995
|
+
const readings = this.readingsTopDown();
|
|
1996
|
+
if (readings.length === 0) {
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
const at = readings.findIndex((reading) => reading.key === this.pickedKey());
|
|
2000
|
+
const step = event.key === 'ArrowDown' ? 1 : readings.length - 1;
|
|
2001
|
+
const next = at < 0
|
|
2002
|
+
? event.key === 'ArrowDown'
|
|
2003
|
+
? 0
|
|
2004
|
+
: readings.length - 1
|
|
2005
|
+
: (at + step) % readings.length;
|
|
2006
|
+
this.pickedKey.set(readings[next].key);
|
|
2007
|
+
readings[next].element.focus();
|
|
2008
|
+
return;
|
|
1213
2009
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
const hit = markOf(event);
|
|
1217
|
-
const next = event.relatedTarget instanceof Element
|
|
1218
|
-
? event.relatedTarget.closest('[data-mark-index]')
|
|
1219
|
-
: null;
|
|
1220
|
-
if (hit && next !== hit.element && !this.scales.cursorOn?.()) {
|
|
1221
|
-
this.activeMark.leave();
|
|
2010
|
+
if (!fromMarker) {
|
|
2011
|
+
return;
|
|
1222
2012
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
2013
|
+
if (event.key === 'Tab') {
|
|
2014
|
+
// Moved before the browser acts, so Tab leaves from the stop: a marker sits before it in the DOM.
|
|
2015
|
+
this.focusStop(this.focusedCategory());
|
|
2016
|
+
return;
|
|
2017
|
+
}
|
|
2018
|
+
const next = event.key === 'Escape'
|
|
2019
|
+
? this.focusedCategory()
|
|
2020
|
+
: nextRovingIndex(event.key, this.focusedCategory(), this.categories().length);
|
|
2021
|
+
if (next !== null) {
|
|
2022
|
+
event.preventDefault();
|
|
2023
|
+
this.focusStop(next);
|
|
1229
2024
|
}
|
|
1230
|
-
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1231
2025
|
}
|
|
1232
|
-
|
|
1233
|
-
const
|
|
1234
|
-
|
|
2026
|
+
onStopKey(event) {
|
|
2027
|
+
const current = this.focusedCategory();
|
|
2028
|
+
const next = event.key === 'ArrowUp' || event.key === 'ArrowDown'
|
|
2029
|
+
? null
|
|
2030
|
+
: nextRovingIndex(event.key, current, this.categories().length);
|
|
2031
|
+
if (next !== null) {
|
|
2032
|
+
event.preventDefault();
|
|
2033
|
+
this.focusStop(next);
|
|
1235
2034
|
return;
|
|
1236
2035
|
}
|
|
1237
2036
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
event.preventDefault();
|
|
1242
|
-
this.pointClicked.emit(mark.point);
|
|
2037
|
+
event.preventDefault();
|
|
2038
|
+
if (this.pinOnClickResolved()) {
|
|
2039
|
+
this.pinFromKeyboard(current, event);
|
|
1243
2040
|
}
|
|
1244
|
-
return;
|
|
1245
2041
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
2042
|
+
else if (event.key === 'Escape') {
|
|
2043
|
+
this.cursorState.release();
|
|
2044
|
+
this.cursorState.leave();
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
// Captured ahead of a series' own arrow keys, which would otherwise move focus without the range.
|
|
2048
|
+
extendRangeFromKeys = this.listenForRangeKeys();
|
|
2049
|
+
listenForRangeKeys() {
|
|
2050
|
+
if (!this.isBrowser) {
|
|
1248
2051
|
return;
|
|
1249
2052
|
}
|
|
1250
|
-
|
|
2053
|
+
const host = this.host.nativeElement;
|
|
2054
|
+
const onKey = (event) => {
|
|
2055
|
+
const target = event.target;
|
|
2056
|
+
if (!this.selectRange() ||
|
|
2057
|
+
!event.shiftKey ||
|
|
2058
|
+
(event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') ||
|
|
2059
|
+
!(target instanceof Element)) {
|
|
2060
|
+
return;
|
|
2061
|
+
}
|
|
2062
|
+
const stop = target.closest('.category-stop');
|
|
2063
|
+
const mark = stop ? null : target.closest('[data-mark-index]');
|
|
2064
|
+
// A column's mark index is its category; a line marker reports its category as it takes focus.
|
|
2065
|
+
const current = stop
|
|
2066
|
+
? this.focusedCategory()
|
|
2067
|
+
: mark?.hasAttribute('data-point-key')
|
|
2068
|
+
? this.activeIndex()
|
|
2069
|
+
: Number(mark?.getAttribute('data-mark-index') ?? -1);
|
|
2070
|
+
if ((!stop && !mark) || current < 0) {
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
event.preventDefault();
|
|
2074
|
+
event.stopPropagation();
|
|
2075
|
+
const next = this.extendRange(current, event.key === 'ArrowRight' ? 1 : -1);
|
|
2076
|
+
if (next === current) {
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
if (stop) {
|
|
2080
|
+
this.focusStop(next);
|
|
2081
|
+
}
|
|
2082
|
+
else if (mark) {
|
|
2083
|
+
this.markInCategory(mark, current, next)?.focus();
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
host.addEventListener('keydown', onKey, true);
|
|
2087
|
+
inject(DestroyRef).onDestroy(() => host.removeEventListener('keydown', onKey, true));
|
|
2088
|
+
}
|
|
2089
|
+
// Grows or shrinks the range from its far end; from a category outside the range's ends, a new one
|
|
2090
|
+
// starts there. Returns the category the far end moved to.
|
|
2091
|
+
extendRange(current, step) {
|
|
2092
|
+
const next = Math.min(Math.max(current + step, 0), this.categories().length - 1);
|
|
2093
|
+
const range = this.range();
|
|
2094
|
+
const anchor = range && current === range.to
|
|
2095
|
+
? range.from
|
|
2096
|
+
: range && current === range.from
|
|
2097
|
+
? range.to
|
|
2098
|
+
: current;
|
|
2099
|
+
this.range.set({
|
|
2100
|
+
from: Math.min(anchor, next),
|
|
2101
|
+
to: Math.max(anchor, next),
|
|
2102
|
+
});
|
|
2103
|
+
return next;
|
|
1251
2104
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
2105
|
+
// The same series' mark at another category: a column is indexed by its category, a line marker keyed by it.
|
|
2106
|
+
markInCategory(mark, current, next) {
|
|
2107
|
+
const pointKey = mark.getAttribute('data-point-key');
|
|
2108
|
+
if (pointKey === null) {
|
|
2109
|
+
return (mark.parentElement?.querySelector(`:scope > [data-mark-index="${next}"]`) ?? null);
|
|
2110
|
+
}
|
|
2111
|
+
const keys = categoryKeys(this.categories());
|
|
2112
|
+
const seriesId = pointKey.slice(0, -(keys[current].length + 1));
|
|
2113
|
+
return (mark.parentElement?.querySelector(`[data-point-key="${CSS.escape(`${seriesId}-${keys[next]}`)}"]`) ?? null);
|
|
1254
2114
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
2115
|
+
setActiveIndex(index) {
|
|
2116
|
+
this.cursorState.setIndex(this.clampIndex(index));
|
|
2117
|
+
}
|
|
2118
|
+
clampIndex(index) {
|
|
2119
|
+
const last = this.categories().length - 1;
|
|
2120
|
+
return Number.isFinite(index)
|
|
2121
|
+
? Math.min(Math.max(Math.trunc(index), -1), last)
|
|
2122
|
+
: -1;
|
|
2123
|
+
}
|
|
2124
|
+
plotRight = computed(() => this.plot().left + this.plot().width, ...(ngDevMode ? [{ debugName: "plotRight" }] : /* istanbul ignore next */ []));
|
|
2125
|
+
plotBottom = computed(() => this.plot().top + this.plot().height, ...(ngDevMode ? [{ debugName: "plotBottom" }] : /* istanbul ignore next */ []));
|
|
2126
|
+
axisLabelX = computed(() => this.plot().left - CHART_AXIS_LABEL_GAP, ...(ngDevMode ? [{ debugName: "axisLabelX" }] : /* istanbul ignore next */ []));
|
|
2127
|
+
/** Clears the reservation the view height budgets, only when it is there; otherwise the labels fall past the viewBox. */
|
|
2128
|
+
categoryLabelY = computed(() => this.secondaryPlotBottom() +
|
|
2129
|
+
(this.reachesBelowZero() ? this.valueSpace() : 0) +
|
|
2130
|
+
CHART_CATEGORY_LABEL_OFFSET, ...(ngDevMode ? [{ debugName: "categoryLabelY" }] : /* istanbul ignore next */ []));
|
|
2131
|
+
ticks = computed(() => {
|
|
2132
|
+
const domain = this.domain();
|
|
2133
|
+
const toY = this.yPosition();
|
|
2134
|
+
const format = this.valueFormatResolved();
|
|
2135
|
+
return tickValues(domain.min, domain.max, this.tickCount()).map((value) => ({
|
|
2136
|
+
value,
|
|
2137
|
+
y: toY(value),
|
|
2138
|
+
label: format(value, 'tick'),
|
|
2139
|
+
}));
|
|
2140
|
+
}, ...(ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []));
|
|
2141
|
+
labelTexts = computed(() => [
|
|
2142
|
+
...this.ticks().map((tick) => tick.label),
|
|
2143
|
+
...this.secondaryTicks().map((tick) => tick.label),
|
|
2144
|
+
...this.categories(),
|
|
2145
|
+
].join('\n'), ...(ngDevMode ? [{ debugName: "labelTexts" }] : /* istanbul ignore next */ []));
|
|
2146
|
+
/** Rotation is tried before thinning; both use the widest label as rendered. */
|
|
2147
|
+
categoryLabelsRotated = computed(() => rotationWouldFit([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length)), ...(ngDevMode ? [{ debugName: "categoryLabelsRotated" }] : /* istanbul ignore next */ []));
|
|
2148
|
+
categoryLabelInterval = computed(() => labelInterval([this.measuredCategoryLabelWidth()], this.plot().width / Math.max(1, this.categories().length), this.categoryLabelsRotated()), ...(ngDevMode ? [{ debugName: "categoryLabelInterval" }] : /* istanbul ignore next */ []));
|
|
2149
|
+
labelHovered = signal(null, ...(ngDevMode ? [{ debugName: "labelHovered" }] : /* istanbul ignore next */ []));
|
|
2150
|
+
categoryLabelHover = this.labelHovered.asReadonly();
|
|
2151
|
+
onCategoryLabelEnter(index, event) {
|
|
2152
|
+
if (!this.cursorOn()) {
|
|
2153
|
+
this.labelHovered.set({ index, event });
|
|
1261
2154
|
}
|
|
1262
|
-
|
|
2155
|
+
}
|
|
2156
|
+
onCategoryLabelLeave() {
|
|
2157
|
+
this.labelHovered.set(null);
|
|
2158
|
+
}
|
|
2159
|
+
categoryLabels = computed(() => {
|
|
2160
|
+
const toX = this.xPosition();
|
|
2161
|
+
const interval = this.categoryLabelInterval();
|
|
2162
|
+
const keys = categoryKeys(this.categories());
|
|
2163
|
+
return this.categories()
|
|
2164
|
+
.map((text, index) => ({ x: toX(index), text, index, key: keys[index] }))
|
|
2165
|
+
.filter((label) => label.index % interval === 0);
|
|
2166
|
+
}, ...(ngDevMode ? [{ debugName: "categoryLabels" }] : /* istanbul ignore next */ []));
|
|
2167
|
+
reachesBelowZero = computed(() => this.domain().min < 0, ...(ngDevMode ? [{ debugName: "reachesBelowZero" }] : /* istanbul ignore next */ []));
|
|
2168
|
+
/** Read off `categories` alone: the marks are projected into the branch this decides, so waiting for a report would deadlock. */
|
|
2169
|
+
isEmpty = computed(() => this.categories().length === 0, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
2170
|
+
accessibleName = computed(() => this.summary() ?? this.caption() ?? this.intl().chart.title, ...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
2171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2172
|
+
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: [
|
|
1263
2173
|
{
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
formatted: mark.formattedValue,
|
|
1267
|
-
color: mark.color,
|
|
1268
|
-
hatched: mark.hatched,
|
|
1269
|
-
detail: this.shareDetail(categoryIndex),
|
|
1270
|
-
y: mark.tip,
|
|
2174
|
+
provide: CHART_SCALES,
|
|
2175
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
1271
2176
|
},
|
|
1272
|
-
];
|
|
1273
|
-
}, ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
1274
|
-
axisPointElements = computed(() => this.axisEntries().length === 0
|
|
1275
|
-
? []
|
|
1276
|
-
: [
|
|
1277
|
-
this.host.nativeElement.querySelector(`.columns [data-mark-index="${this.scales.activeIndex()}"]`),
|
|
1278
|
-
], ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
1279
|
-
shareDetail(index) {
|
|
1280
|
-
return this.partOfWhole()
|
|
1281
|
-
? describeShare(this.data().map((point) => point.value), index, this.locale, (share) => this.intl().chart.shareOfTotal(share))
|
|
1282
|
-
: undefined;
|
|
1283
|
-
}
|
|
1284
|
-
tooltipContext = computed(() => {
|
|
1285
|
-
const mark = this.marks()[this.activeMark.index()];
|
|
1286
|
-
if (this.tooltip() === 'none' || !mark) {
|
|
1287
|
-
return null;
|
|
1288
|
-
}
|
|
1289
|
-
const series = this.seriesLabel();
|
|
1290
|
-
return {
|
|
1291
|
-
category: series ? mark.point.label : '',
|
|
1292
|
-
entries: [
|
|
1293
|
-
{
|
|
1294
|
-
label: series ?? mark.point.label,
|
|
1295
|
-
value: mark.point.value,
|
|
1296
|
-
formatted: mark.formattedValue,
|
|
1297
|
-
color: mark.color,
|
|
1298
|
-
hatched: mark.hatched,
|
|
1299
|
-
detail: this.shareDetail(this.activeMark.index()),
|
|
1300
|
-
},
|
|
1301
|
-
],
|
|
1302
|
-
};
|
|
1303
|
-
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1304
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1305
|
-
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-ring-sweep{0%{opacity:0;transform:rotate(-30deg) scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}.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-rise 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 });
|
|
2177
|
+
], 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 });
|
|
1306
2178
|
}
|
|
1307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type:
|
|
2179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartComponent, decorators: [{
|
|
1308
2180
|
type: Component,
|
|
1309
|
-
args: [{ selector: '
|
|
1310
|
-
|
|
2181
|
+
args: [{ selector: 'ds-chart', standalone: true, exportAs: 'dsChart', imports: [
|
|
2182
|
+
ChartSkeletonComponent,
|
|
2183
|
+
ChartTooltipDirective,
|
|
2184
|
+
ChartPinMarkerComponent,
|
|
2185
|
+
ChartPlacedDirective,
|
|
2186
|
+
ChartStatesComponent,
|
|
2187
|
+
], host: {
|
|
2188
|
+
'[class.framed]': "frameResolved() === 'auto'",
|
|
2189
|
+
'[class.measuring]': '!settled()',
|
|
2190
|
+
'[style.--_chart-view-height]': "viewHeight() + 'px'",
|
|
2191
|
+
'(keydown)': 'onChartKey($event)',
|
|
2192
|
+
'(focusout)': 'onChartFocusOut($event)',
|
|
2193
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
2194
|
+
{
|
|
2195
|
+
provide: CHART_SCALES,
|
|
2196
|
+
useExisting: forwardRef(() => ChartComponent),
|
|
2197
|
+
},
|
|
2198
|
+
], 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"] }]
|
|
2199
|
+
}], 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), { ...{
|
|
2200
|
+
descendants: true,
|
|
2201
|
+
}, isSignal: true }] }], canvasElement: [{ type: i0.ViewChild, args: ['canvasEl', { isSignal: true }] }], bandElement: [{ type: i0.ViewChild, args: ['cursorBandEl', { isSignal: true }] }] } });
|
|
2202
|
+
function highestReading(readings) {
|
|
2203
|
+
let highest = null;
|
|
2204
|
+
for (const reading of readings) {
|
|
2205
|
+
if (reading.y !== undefined &&
|
|
2206
|
+
(highest?.y === undefined || reading.y < highest.y)) {
|
|
2207
|
+
highest = reading;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return highest;
|
|
2211
|
+
}
|
|
2212
|
+
// A pin's `transform` attribute is where it lands; its computed transform is mid-glide.
|
|
2213
|
+
function landedTranslateY(element) {
|
|
2214
|
+
const match = /translate\(\s*[-\d.e]+[\s,]+([-\d.e]+)/.exec(element.getAttribute('transform') ?? '');
|
|
2215
|
+
return match ? parseFloat(match[1]) : 0;
|
|
2216
|
+
}
|
|
2217
|
+
function boundNumber(element, name) {
|
|
2218
|
+
return parseFloat(element.getAttribute(name) ?? '') || 0;
|
|
2219
|
+
}
|
|
2220
|
+
/** Top and height in view units of where `origin` lands: a column's cap and a marker by their bound
|
|
2221
|
+
* attributes, anything else by its box. */
|
|
2222
|
+
function landedExtent(origin, canvas, viewHeight) {
|
|
2223
|
+
const cap = origin.matches('.bar') ? origin.querySelector('.bar-cap') : null;
|
|
2224
|
+
if (cap) {
|
|
2225
|
+
return { top: boundNumber(cap, 'y'), height: boundNumber(cap, 'height') };
|
|
2226
|
+
}
|
|
2227
|
+
if (origin instanceof SVGCircleElement) {
|
|
2228
|
+
const radius = parseFloat(getComputedStyle(origin).r) || 0;
|
|
2229
|
+
return { top: boundNumber(origin, 'cy') - radius, height: 2 * radius };
|
|
2230
|
+
}
|
|
2231
|
+
const frame = canvas.getBoundingClientRect();
|
|
2232
|
+
const scale = frame.height > 0 ? viewHeight / frame.height : 1;
|
|
2233
|
+
const box = origin.getBoundingClientRect();
|
|
2234
|
+
return { top: (box.top - frame.top) * scale, height: box.height * scale };
|
|
2235
|
+
}
|
|
2236
|
+
// The label is placed by `--_column-value-y` (its baseline); `getBBox` is in its own space, so its `y` is the ascent.
|
|
2237
|
+
function landedTextTop(label) {
|
|
2238
|
+
const baseline = parseFloat(label.style.getPropertyValue('--_column-value-y')) || 0;
|
|
2239
|
+
return baseline + label.getBBox().y;
|
|
2240
|
+
}
|
|
1311
2241
|
|
|
2242
|
+
/** Distance from a mark's tip to its value label's baseline. */
|
|
2243
|
+
const VALUE_LABEL_GAP = 8;
|
|
2244
|
+
// The printed value's cap height at `--font-size-xs`.
|
|
2245
|
+
const VALUE_LABEL_HEIGHT = 10;
|
|
2246
|
+
/** Blank at a stacked segment's lower end: a background-colour gap, not a drawn rule (which vanishes in print). */
|
|
2247
|
+
const STACK_SEGMENT_GAP = 2;
|
|
1312
2248
|
let nextSeriesId = 0;
|
|
1313
|
-
// The active marker's default radius, `--chart-dot-radius-active`.
|
|
1314
|
-
const PIN_MARKER_CLEARANCE = 6;
|
|
1315
2249
|
/**
|
|
1316
|
-
* One
|
|
2250
|
+
* One column per datum, drawn against the scales `ds-chart` supplies.
|
|
1317
2251
|
*
|
|
1318
|
-
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants.
|
|
1319
|
-
*
|
|
2252
|
+
* Hosted on a `<g>`: an element SVG does not know renders nothing, nor do its descendants. Written
|
|
2253
|
+
* as `<svg:g dsColumnSeries>`.
|
|
1320
2254
|
*/
|
|
1321
|
-
class
|
|
2255
|
+
class ColumnSeriesComponent {
|
|
1322
2256
|
leaveMark = leaveMark;
|
|
1323
2257
|
scales = inject(CHART_SCALES);
|
|
1324
|
-
|
|
2258
|
+
host = inject(ElementRef);
|
|
2259
|
+
locale = injectDsLocale();
|
|
2260
|
+
intl = inject(DS_INTL);
|
|
2261
|
+
/** Not `input.required`: the preset reads `tooltipContext()` from a binding on this same element,
|
|
2262
|
+
* and a required input throws NG0950 before its value is written. */
|
|
1325
2263
|
data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1326
|
-
/**
|
|
1327
|
-
|
|
1328
|
-
/** Lays the line and markers on a background-colour band so they stay legible where they cross other marks. */
|
|
1329
|
-
outline = input(true, { ...(ngDevMode ? { debugName: "outline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2264
|
+
/** Prints each column's value above the column. */
|
|
2265
|
+
showValues = input(true, { ...(ngDevMode ? { debugName: "showValues" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1330
2266
|
/** Turns on the click affordance (pointer cursor and hover tint). `pointClicked` fires either way. */
|
|
1331
2267
|
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1332
2268
|
/** Holds the clicked mark and its tooltip until a second click, Escape or a press outside. Unset
|
|
@@ -1334,351 +2270,366 @@ class LineSeriesComponent {
|
|
|
1334
2270
|
pinOnClick = input(null, { ...(ngDevMode ? { debugName: "pinOnClick" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? null : booleanAttribute(value)) });
|
|
1335
2271
|
pinOnClickResolved = resolveWithConfig(this.pinOnClick, (config) => config.chart?.pinOnClick, true);
|
|
1336
2272
|
pins = computed(() => this.pinOnClickResolved() && !this.scales.cursorOn?.(), ...(ngDevMode ? [{ debugName: "pins" }] : /* istanbul ignore next */ []));
|
|
1337
|
-
/** Fades every
|
|
2273
|
+
/** Fades every mark but the one under the pointer. Off by default: it costs separation between the rest. */
|
|
1338
2274
|
dimOthers = input(false, { ...(ngDevMode ? { debugName: "dimOthers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1339
|
-
/**
|
|
1340
|
-
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
1341
|
-
/** A dash pattern per series, in series order. A series past the end, or given `''`, draws solid. */
|
|
1342
|
-
patterns = input([], ...(ngDevMode ? [{ debugName: "patterns" }] : /* istanbul ignore next */ []));
|
|
1343
|
-
/** Fills each area from the series below it rather than from the baseline (stacked plots). */
|
|
1344
|
-
stacked = input(false, { ...(ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1345
|
-
dashFor(seriesIndex) {
|
|
1346
|
-
return this.patterns()[seriesIndex] || null;
|
|
1347
|
-
}
|
|
1348
|
-
/** Milliseconds between one series' entrance and the next, narrowed to fit the stagger budget; `0` is off. */
|
|
2275
|
+
/** Milliseconds between one mark's entrance and the next, narrowed to fit 260ms. `0` is no stagger. */
|
|
1349
2276
|
staggerMs = input(40, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1350
|
-
/**
|
|
1351
|
-
|
|
1352
|
-
/**
|
|
1353
|
-
* holds each reading to the next; `'smooth'` is a monotone cubic that draws no peak the data lacks. */
|
|
1354
|
-
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
1355
|
-
/** Whether a hovered or focused reading opens a tooltip: `'item'` names the marker, `'axis'` every
|
|
1356
|
-
* series at the category, turning the container's category cursor on under `cursor="auto"`. */
|
|
2277
|
+
/** Declares the marks are parts of one whole; each mark's share then appears on the tooltip's second line. */
|
|
2278
|
+
partOfWhole = input(false, { ...(ngDevMode ? { debugName: "partOfWhole" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2279
|
+
/** Whether a hovered or focused column opens a tooltip. */
|
|
1357
2280
|
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
1358
|
-
/** Where
|
|
1359
|
-
tooltipAnchor = input('
|
|
1360
|
-
/** Milliseconds the panel survives the pointer leaving the
|
|
2281
|
+
/** Where the tooltip is pinned: `'mark'` is the column, `'cell'` the full-height category cell (panel at the plot top). */
|
|
2282
|
+
tooltipAnchor = input('mark', ...(ngDevMode ? [{ debugName: "tooltipAnchor" }] : /* istanbul ignore next */ []));
|
|
2283
|
+
/** Milliseconds the panel survives the pointer leaving the mark within the chart. */
|
|
1361
2284
|
tooltipLingerMs = input(CHART_TOOLTIP_LINGER_MS, { ...(ngDevMode ? { debugName: "tooltipLingerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
1362
2285
|
/** Formats every value this series prints: `'tick'` for an axis label, `'tooltip'` for a value in full. */
|
|
1363
2286
|
valueFormat = input(chartValueFormat(injectDsLocale()), ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
1364
|
-
/** The
|
|
2287
|
+
/** The mark's share of its category slot before the maximum width caps it. Measured off the slot,
|
|
2288
|
+
* not `bandWidth()`, whose padding is already taken out (both would narrow columns twice). */
|
|
2289
|
+
columnWidthRatio = input(0.8, { ...(ngDevMode ? { debugName: "columnWidthRatio" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2290
|
+
/** This series' position among the slots a category's band is divided into. */
|
|
2291
|
+
slot = input(0, { ...(ngDevMode ? { debugName: "slot" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2292
|
+
/** How many slots the band is divided into: the series drawn side by side. */
|
|
2293
|
+
slotCount = input(1, { ...(ngDevMode ? { debugName: "slotCount" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
2294
|
+
/** Where each mark starts and ends on the value axis, one entry per point. Unset, marks run from zero. */
|
|
2295
|
+
offsets = input(null, ...(ngDevMode ? [{ debugName: "offsets" }] : /* istanbul ignore next */ []));
|
|
2296
|
+
/** The only series in its slot, as a waterfall's floating bars are: each answers the pointer over the whole plot height. */
|
|
2297
|
+
soleSeries = input(false, { ...(ngDevMode ? { debugName: "soleSeries" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2298
|
+
/** Which value axis the columns are measured against; `'secondary'` reads the second axis. */
|
|
2299
|
+
axis = input('primary', ...(ngDevMode ? [{ debugName: "axis" }] : /* istanbul ignore next */ []));
|
|
2300
|
+
/** One colour for the whole series. Unset, each mark takes the categorical palette by position;
|
|
2301
|
+
* a point's own colour wins. */
|
|
2302
|
+
seriesColor = input(null, ...(ngDevMode ? [{ debugName: "seriesColor" }] : /* istanbul ignore next */ []));
|
|
2303
|
+
/** `seriesColor` for the fill pattern. A point's own `fill` wins. */
|
|
2304
|
+
seriesFill = input(null, ...(ngDevMode ? [{ debugName: "seriesFill" }] : /* istanbul ignore next */ []));
|
|
2305
|
+
/** Names the series in the tooltip, making the category the panel's heading. */
|
|
2306
|
+
seriesLabel = input(null, ...(ngDevMode ? [{ debugName: "seriesLabel" }] : /* istanbul ignore next */ []));
|
|
2307
|
+
/** Identifies this series to the legend, so hovering a legend item can single it out. */
|
|
2308
|
+
seriesKey = input(null, ...(ngDevMode ? [{ debugName: "seriesKey" }] : /* istanbul ignore next */ []));
|
|
2309
|
+
/** The series the reader is pointing at in the legend. It brightens; under `dimOthers` every other
|
|
2310
|
+
* series fades instead, as the other columns do when one is hovered. */
|
|
2311
|
+
highlighted = input(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
2312
|
+
dimmedBySeries = computed(() => dimmedBy(this.dimOthers(), this.highlighted(), this.seriesKey()), ...(ngDevMode ? [{ debugName: "dimmedBySeries" }] : /* istanbul ignore next */ []));
|
|
2313
|
+
spotlit = computed(() => this.highlighted() !== null && this.highlighted() === this.seriesKey(), ...(ngDevMode ? [{ debugName: "spotlit" }] : /* istanbul ignore next */ []));
|
|
2314
|
+
/** Sinks every column to the baseline; the value axis follows the chart's `rescaleOnHide`. Set it
|
|
2315
|
+
* rather than removing the series to animate a legend hiding it. */
|
|
2316
|
+
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2317
|
+
/** Reads the columns as a running total, as a waterfall's are: the axis guide stops at the hovered
|
|
2318
|
+
* column, and under `dimOthers` every column after it fades. */
|
|
2319
|
+
runningTotal = input(false, { ...(ngDevMode ? { debugName: "runningTotal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
2320
|
+
/** The clicked datum. Fires on click and on Enter or Space, whatever `interactive` says. */
|
|
1365
2321
|
pointClicked = output();
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
2322
|
+
seriesId = nextSeriesId++;
|
|
2323
|
+
domainId = `column-series-${this.seriesId}`;
|
|
2324
|
+
/** Per instance: otherwise every hatched mark takes the first chart's `<pattern>` colour. */
|
|
2325
|
+
hatchId = `ds-column-hatch-${this.seriesId}`;
|
|
2326
|
+
/** Where each mark spans, which the axis has to hold: a stacked segment's top is the running total. */
|
|
2327
|
+
spans = computed(() => this.spansOf(this.hidden()), ...(ngDevMode ? [{ debugName: "spans" }] : /* istanbul ignore next */ []));
|
|
2328
|
+
spansOf(hidden) {
|
|
2329
|
+
const given = this.offsets();
|
|
2330
|
+
return this.data().map((point, index) => given?.[index] ?? {
|
|
2331
|
+
from: 0,
|
|
2332
|
+
to: Number.isFinite(point.value) && !hidden ? point.value : 0,
|
|
2333
|
+
});
|
|
1369
2334
|
}
|
|
1370
2335
|
constructor() {
|
|
1371
|
-
effect(() =>
|
|
1372
|
-
this.scales.reportDomain(`${this.domainId}-primary`, this.valuesOn('primary'), 'primary');
|
|
1373
|
-
this.scales.reportDomain(`${this.domainId}-secondary`, this.valuesOn('secondary'), 'secondary');
|
|
1374
|
-
});
|
|
2336
|
+
effect(() => this.scales.reportDomain(this.domainId, this.spansOf(false).flatMap((span) => [span.from, span.to]), this.axis(), this.hidden()));
|
|
1375
2337
|
this.scales.reportTooltip(this.domainId, {
|
|
1376
2338
|
context: this.tooltipContext,
|
|
1377
|
-
origin: this.
|
|
2339
|
+
origin: computed(() => this.activeMark.origin()),
|
|
2340
|
+
pinned: this.activeMark.pinned,
|
|
1378
2341
|
offersTooltip: computed(() => this.tooltip() !== 'none'),
|
|
1379
|
-
|
|
1380
|
-
axisOrigin:
|
|
2342
|
+
stacked: computed(() => this.offsets() !== null),
|
|
2343
|
+
axisOrigin: computed(() => {
|
|
2344
|
+
const categoryIndex = this.scales.activeIndex();
|
|
2345
|
+
return categoryIndex < 0
|
|
2346
|
+
? null
|
|
2347
|
+
: (this.barElements()[categoryIndex]?.nativeElement ?? null);
|
|
2348
|
+
}),
|
|
1381
2349
|
axisEntries: this.axisEntries,
|
|
1382
2350
|
axisPointElements: this.axisPointElements,
|
|
2351
|
+
axisReadout: this.axisReadout,
|
|
2352
|
+
valuesByCategory: computed(() => this.hidden()
|
|
2353
|
+
? []
|
|
2354
|
+
: this.data().map((point) => Number.isFinite(point.value) ? [point.value] : [])),
|
|
1383
2355
|
});
|
|
1384
|
-
|
|
1385
|
-
|
|
2356
|
+
const host = this.host;
|
|
2357
|
+
listenForMarkFocus(host, (event, hit) => this.onMarkFocus(event, hit), () => {
|
|
1386
2358
|
this.activeMark.leave();
|
|
1387
|
-
this.scales.
|
|
2359
|
+
if (this.scales.cursorOn?.()) {
|
|
2360
|
+
this.scales.setActiveIndex(-1);
|
|
2361
|
+
}
|
|
2362
|
+
});
|
|
2363
|
+
afterRenderEffect({
|
|
2364
|
+
write: () => {
|
|
2365
|
+
const marks = this.marks();
|
|
2366
|
+
untracked(() => this.glideReordered(marks));
|
|
2367
|
+
},
|
|
2368
|
+
});
|
|
2369
|
+
let answeringLabel = false;
|
|
2370
|
+
effect(() => {
|
|
2371
|
+
const hover = this.scales.categoryLabelHover?.() ?? null;
|
|
2372
|
+
untracked(() => {
|
|
2373
|
+
const mark = hover &&
|
|
2374
|
+
host.nativeElement.querySelector(`[data-mark-index="${hover.index}"]`);
|
|
2375
|
+
if (hover && mark) {
|
|
2376
|
+
answeringLabel = true;
|
|
2377
|
+
this.activeMark.enter(hover.index, hover.event, this.tooltipMark(), mark);
|
|
2378
|
+
}
|
|
2379
|
+
else if (answeringLabel) {
|
|
2380
|
+
answeringLabel = false;
|
|
2381
|
+
this.activeMark.leave();
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
1388
2384
|
});
|
|
1389
2385
|
}
|
|
1390
2386
|
ngOnDestroy() {
|
|
1391
2387
|
this.scales.releaseTooltip(this.domainId);
|
|
1392
|
-
this.scales.releaseDomain(
|
|
1393
|
-
this.scales.releaseDomain(`${this.domainId}-secondary`);
|
|
2388
|
+
this.scales.releaseDomain(this.domainId);
|
|
1394
2389
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
2390
|
+
placedX = new Map();
|
|
2391
|
+
// A column the `@for` moves to another place in the DOM restarts its style and loses the transition,
|
|
2392
|
+
// so after a reorder every column whose key changed place glides from where it stood.
|
|
2393
|
+
glideReordered(marks) {
|
|
2394
|
+
const previous = this.placedX;
|
|
2395
|
+
this.placedX = new Map(marks.map((mark) => [mark.key, mark.x]));
|
|
2396
|
+
const before = [...previous.keys()].filter((key) => this.placedX.has(key));
|
|
2397
|
+
const after = marks
|
|
2398
|
+
.map((mark) => mark.key)
|
|
2399
|
+
.filter((key) => previous.has(key));
|
|
2400
|
+
if (before.every((key, index) => key === after[index])) {
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
marks.forEach((mark) => {
|
|
2404
|
+
const from = previous.get(mark.key);
|
|
2405
|
+
const column = this.host.nativeElement.querySelector(`.column[data-column-key="${CSS.escape(mark.key)}"]:not(.mark-leave)`);
|
|
2406
|
+
if (from === undefined || from === mark.x || !column) {
|
|
2407
|
+
return;
|
|
2408
|
+
}
|
|
2409
|
+
const timing = chartTiming(column, 'mark');
|
|
2410
|
+
if (!timing || typeof column.animate !== 'function') {
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
// Re-inserted, the column replays its entrance; it has already arrived.
|
|
2414
|
+
for (const animation of column.getAnimations({ subtree: true })) {
|
|
2415
|
+
if (animation instanceof CSSAnimation) {
|
|
2416
|
+
animation.finish();
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
const at = (x) => ({
|
|
2420
|
+
transform: `translateX(calc(${x}px + var(--_column-slot-offset)))`,
|
|
2421
|
+
});
|
|
2422
|
+
column.animate([at(from), at(mark.x)], timing);
|
|
2423
|
+
});
|
|
1400
2424
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
2425
|
+
activeMark = chartActiveMark(() => this.tooltipLingerMs(), () => this.scales.hoverDelayMs?.() ?? 0);
|
|
2426
|
+
barElements = viewChildren('barEl', ...(ngDevMode ? [{ debugName: "barElements" }] : /* istanbul ignore next */ []));
|
|
2427
|
+
/** 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. */
|
|
2428
|
+
slotStep = computed(() => {
|
|
2429
|
+
const count = this.data().length;
|
|
2430
|
+
const slots = Math.max(1, this.slotCount());
|
|
2431
|
+
return count > 0 ? this.scales.plot().width / count / slots : 0;
|
|
2432
|
+
}, ...(ngDevMode ? [{ debugName: "slotStep" }] : /* istanbul ignore next */ []));
|
|
2433
|
+
slotStepPx = computed(() => `${this.slotStep()}px`, ...(ngDevMode ? [{ debugName: "slotStepPx" }] : /* istanbul ignore next */ []));
|
|
2434
|
+
markWidthPx = computed(() => `${this.slotStep() * this.columnWidthRatio()}px`, ...(ngDevMode ? [{ debugName: "markWidthPx" }] : /* istanbul ignore next */ []));
|
|
2435
|
+
/** The whole canvas, reserved end included: falling short leaves a strip under the plot that answers no pointer. */
|
|
2436
|
+
hitHeight = computed(() => {
|
|
2437
|
+
const plot = this.scales.plot();
|
|
2438
|
+
return chartViewHeight(plot.height, plot.top, true);
|
|
2439
|
+
}, ...(ngDevMode ? [{ debugName: "hitHeight" }] : /* istanbul ignore next */ []));
|
|
2440
|
+
/** Stacked series overlap, so a stacked mark catches the pointer over its own segment only. */
|
|
2441
|
+
stacked = computed(() => this.offsets() !== null && !this.soleSeries(), ...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
2442
|
+
/** Keeps a thin segment reachable without letting it reach into its neighbours. */
|
|
2443
|
+
static MIN_STACK_HIT = 6;
|
|
2444
|
+
hitBox(mark) {
|
|
2445
|
+
if (!this.stacked()) {
|
|
2446
|
+
return { y: 0, height: this.hitHeight() };
|
|
1409
2447
|
}
|
|
1410
|
-
|
|
2448
|
+
const height = Math.max(mark.height, ColumnSeriesComponent.MIN_STACK_HIT);
|
|
2449
|
+
const overflow = height - mark.height;
|
|
2450
|
+
return { y: mark.top - overflow / 2, height };
|
|
1411
2451
|
}
|
|
1412
|
-
|
|
2452
|
+
hatchInUse = computed(() => this.marks().some((mark) => mark.hatched), ...(ngDevMode ? [{ debugName: "hatchInUse" }] : /* istanbul ignore next */ []));
|
|
2453
|
+
marks = computed(() => {
|
|
1413
2454
|
const toX = this.scales.xPosition();
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
const
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
x: point.x,
|
|
1447
|
-
y: point.y,
|
|
1448
|
-
value: point.value,
|
|
1449
|
-
category: categories[point.categoryIndex] ?? '',
|
|
1450
|
-
formattedValue: format(point.value, 'tooltip'),
|
|
1451
|
-
seriesLabel: series.label,
|
|
1452
|
-
seriesId: series.id,
|
|
1453
|
-
categoryIndex: point.categoryIndex,
|
|
1454
|
-
color,
|
|
1455
|
-
})),
|
|
2455
|
+
const toY = this.axis() === 'secondary'
|
|
2456
|
+
? this.scales.secondaryYPosition()
|
|
2457
|
+
: this.scales.yPosition();
|
|
2458
|
+
const spans = this.spans();
|
|
2459
|
+
const format = this.valueFormat();
|
|
2460
|
+
const keys = categoryKeys(this.data().map((point) => point.label));
|
|
2461
|
+
return this.data().map((point, index) => {
|
|
2462
|
+
const span = spans[index];
|
|
2463
|
+
const foot = toY(span.from);
|
|
2464
|
+
const tip = toY(span.to);
|
|
2465
|
+
const below = tip > foot;
|
|
2466
|
+
// Only a segment with one under it gives up the gap; the baseline segment would lift the stack off the axis.
|
|
2467
|
+
const gap = span.from === 0 ? 0 : Math.min(STACK_SEGMENT_GAP, Math.abs(tip - foot));
|
|
2468
|
+
const baseline = below ? foot + gap : foot - gap;
|
|
2469
|
+
const color = point.color ??
|
|
2470
|
+
this.seriesColor() ??
|
|
2471
|
+
CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length];
|
|
2472
|
+
return {
|
|
2473
|
+
key: point.id ?? keys[index],
|
|
2474
|
+
point,
|
|
2475
|
+
x: toX(index),
|
|
2476
|
+
tip,
|
|
2477
|
+
below,
|
|
2478
|
+
baseline,
|
|
2479
|
+
top: Math.min(tip, baseline),
|
|
2480
|
+
height: Math.abs(tip - baseline),
|
|
2481
|
+
labelY: below ? tip + VALUE_LABEL_GAP : tip - VALUE_LABEL_GAP,
|
|
2482
|
+
pinY: this.pinYOf(tip, baseline, below),
|
|
2483
|
+
origin: below ? 'top' : 'bottom',
|
|
2484
|
+
formattedValue: format(point.value, 'tooltip'),
|
|
2485
|
+
color,
|
|
2486
|
+
hatched: (point.fill ?? this.seriesFill()) === 'hatched',
|
|
1456
2487
|
};
|
|
1457
2488
|
});
|
|
1458
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
const lowerSegments = lineSegments(lower.map((value, categoryIndex) => value === null
|
|
1467
|
-
? null
|
|
1468
|
-
: {
|
|
1469
|
-
categoryIndex,
|
|
1470
|
-
x: toX(categoryIndex),
|
|
1471
|
-
y: toY(value),
|
|
1472
|
-
value,
|
|
1473
|
-
}));
|
|
1474
|
-
return segments
|
|
1475
|
-
.map((segment, index) => lowerSegments[index]
|
|
1476
|
-
? bandPath(segment, lowerSegments[index], curve)
|
|
1477
|
-
: areaPath(segment, toY(0), curve))
|
|
1478
|
-
.filter((path) => path.length > 0);
|
|
1479
|
-
}
|
|
1480
|
-
allMarkers = computed(() => this.plotted().flatMap((entry) => entry.markers), ...(ngDevMode ? [{ debugName: "allMarkers" }] : /* istanbul ignore next */ []));
|
|
1481
|
-
seriesStagger(index) {
|
|
1482
|
-
return `${staggerDelay(index, this.plotted().length, this.staggerMs())}ms`;
|
|
2489
|
+
}, ...(ngDevMode ? [{ debugName: "marks" }] : /* istanbul ignore next */ []));
|
|
2490
|
+
/** Inside the column's top when it holds the disc - the panel opens there - and over the column
|
|
2491
|
+
* and its printed value when it is too short, so the disc never crosses the baseline. */
|
|
2492
|
+
pinYOf(tip, baseline, below) {
|
|
2493
|
+
const top = Math.min(tip, baseline);
|
|
2494
|
+
return pinYAbove(top, Math.abs(tip - baseline), this.showValues() && !below
|
|
2495
|
+
? top - (VALUE_LABEL_GAP + VALUE_LABEL_HEIGHT)
|
|
2496
|
+
: null, CHART_PIN_RADIUS + CHART_PIN_GAP);
|
|
1483
2497
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
firstMarkerBySeries = computed(() => new Map(this.plotted().map((entry) => [
|
|
1487
|
-
entry.series.id,
|
|
1488
|
-
entry.markers[0]?.markIndex,
|
|
1489
|
-
])), ...(ngDevMode ? [{ debugName: "firstMarkerBySeries" }] : /* istanbul ignore next */ []));
|
|
1490
|
-
isTabStop(seriesId, markIndex) {
|
|
1491
|
-
return ((this.rovingBySeries().get(seriesId) ??
|
|
1492
|
-
this.firstMarkerBySeries().get(seriesId)) === markIndex);
|
|
2498
|
+
markStagger(index) {
|
|
2499
|
+
return `${staggerDelay(index, this.marks().length, this.staggerMs())}ms`;
|
|
1493
2500
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
2501
|
+
tooltipMark = computed(() => this.tooltipAnchor() === 'mark' ? '.bar' : undefined, ...(ngDevMode ? [{ debugName: "tooltipMark" }] : /* istanbul ignore next */ []));
|
|
2502
|
+
onMarkClick(event) {
|
|
2503
|
+
const hit = markOf(event);
|
|
2504
|
+
const mark = hit && this.marks()[hit.index];
|
|
2505
|
+
if (!hit || !mark) {
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
this.pointClicked.emit(mark.point);
|
|
2509
|
+
if (this.pins()) {
|
|
2510
|
+
this.activeMark.pin(hit.index, event, this.tooltipMark(), hit.element);
|
|
2511
|
+
}
|
|
1500
2512
|
}
|
|
1501
|
-
|
|
1502
|
-
? (this.allMarkers()[this.activeMark.index()] ?? null)
|
|
1503
|
-
: null, ...(ngDevMode ? [{ debugName: "pinnedMarker" }] : /* istanbul ignore next */ []));
|
|
1504
|
-
pinLift = CHART_PIN_RADIUS + CHART_PIN_GAP + PIN_MARKER_CLEARANCE;
|
|
1505
|
-
onMarkerOver(event) {
|
|
2513
|
+
onMarkOver(event) {
|
|
1506
2514
|
const hit = markOf(event);
|
|
1507
2515
|
if (hit && !this.scales.cursorOn?.()) {
|
|
1508
|
-
this.activeMark.enter(hit.index, event,
|
|
2516
|
+
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1509
2517
|
}
|
|
1510
2518
|
}
|
|
1511
|
-
|
|
2519
|
+
onMarkOut(event) {
|
|
1512
2520
|
const hit = markOf(event);
|
|
1513
|
-
if (
|
|
1514
|
-
return;
|
|
1515
|
-
}
|
|
1516
|
-
const next = event.relatedTarget instanceof Element
|
|
1517
|
-
? event.relatedTarget.closest('[data-mark-index]')
|
|
1518
|
-
: null;
|
|
1519
|
-
if (next !== hit.element) {
|
|
2521
|
+
if (hit && leftMark(event, hit) && !this.scales.cursorOn?.()) {
|
|
1520
2522
|
this.activeMark.leave();
|
|
1521
2523
|
}
|
|
1522
2524
|
}
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
this.
|
|
1528
|
-
this.scales.setActiveIndex(marker.categoryIndex);
|
|
2525
|
+
roving = rovingMarks(() => this.marks().length);
|
|
2526
|
+
onMarkFocus(event, hit) {
|
|
2527
|
+
this.roving.focus(hit.index);
|
|
2528
|
+
if (this.scales.cursorOn?.()) {
|
|
2529
|
+
this.scales.setActiveIndex(hit.index);
|
|
1529
2530
|
}
|
|
1530
|
-
this.activeMark.enter(hit.index, event,
|
|
2531
|
+
this.activeMark.enter(hit.index, event, this.tooltipMark(), hit.element);
|
|
1531
2532
|
}
|
|
1532
|
-
|
|
2533
|
+
onMarkKey(event) {
|
|
1533
2534
|
const hit = markOf(event);
|
|
1534
2535
|
if (!hit) {
|
|
1535
2536
|
return;
|
|
1536
2537
|
}
|
|
1537
2538
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
1538
|
-
|
|
1539
|
-
this.
|
|
2539
|
+
// A key pressed on a control inside belongs to that control.
|
|
2540
|
+
const mark = this.marks()[hit.index];
|
|
2541
|
+
if (this.interactive() && event.target === hit.element && mark) {
|
|
2542
|
+
event.preventDefault();
|
|
2543
|
+
this.pointClicked.emit(mark.point);
|
|
2544
|
+
}
|
|
1540
2545
|
return;
|
|
1541
2546
|
}
|
|
1542
2547
|
// The category cursor's `ds-chart` owns the other keys.
|
|
1543
2548
|
if (this.scales.cursorOn?.()) {
|
|
1544
2549
|
return;
|
|
1545
2550
|
}
|
|
1546
|
-
|
|
1547
|
-
const strand = this.allMarkers().filter((candidate) => candidate.seriesId === marker?.seriesId);
|
|
1548
|
-
const current = strand.findIndex((candidate) => candidate.markIndex === hit.index);
|
|
1549
|
-
const next = nextRovingIndex(event.key, current, strand.length);
|
|
1550
|
-
if (next === null) {
|
|
1551
|
-
return;
|
|
1552
|
-
}
|
|
1553
|
-
event.preventDefault();
|
|
1554
|
-
focusMark(hit.element.closest('.lines'), strand[next].markIndex);
|
|
2551
|
+
this.roving.navigate(event, hit.index, hit.element.closest('.columns'));
|
|
1555
2552
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
return highlighted !== null && highlighted !== seriesId;
|
|
2553
|
+
entryLabel(mark) {
|
|
2554
|
+
return `${mark.point.label}, ${mark.formattedValue}`;
|
|
1559
2555
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
this.activeMark.pin(hit.index, event, '.series-marker', hit.element);
|
|
2556
|
+
/** This series' reading at the cursor's category, filled whatever `tooltip` says; feeds only the container's category panel. */
|
|
2557
|
+
axisEntries = computed(() => {
|
|
2558
|
+
const categoryIndex = this.scales.activeIndex();
|
|
2559
|
+
const mark = this.marks()[categoryIndex];
|
|
2560
|
+
if (categoryIndex < 0 || !mark || this.hidden()) {
|
|
2561
|
+
return [];
|
|
1567
2562
|
}
|
|
1568
|
-
|
|
2563
|
+
return [
|
|
2564
|
+
{
|
|
2565
|
+
label: this.seriesLabel() ?? mark.point.label,
|
|
2566
|
+
value: mark.point.value,
|
|
2567
|
+
formatted: mark.formattedValue,
|
|
2568
|
+
color: mark.color,
|
|
2569
|
+
hatched: mark.hatched,
|
|
2570
|
+
detail: this.shareDetail(categoryIndex),
|
|
2571
|
+
y: mark.tip,
|
|
2572
|
+
axis: this.axis(),
|
|
2573
|
+
},
|
|
2574
|
+
];
|
|
2575
|
+
}, ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
2576
|
+
axisReadout = computed(() => {
|
|
2577
|
+
const index = this.activeMark.index();
|
|
2578
|
+
const mark = this.marks()[index];
|
|
2579
|
+
return mark && !this.hidden()
|
|
2580
|
+
? {
|
|
2581
|
+
categoryIndex: index,
|
|
2582
|
+
y: mark.tip,
|
|
2583
|
+
axis: this.axis(),
|
|
2584
|
+
reach: this.runningTotal() ? 'mark' : 'plot',
|
|
2585
|
+
}
|
|
2586
|
+
: null;
|
|
2587
|
+
}, ...(ngDevMode ? [{ debugName: "axisReadout" }] : /* istanbul ignore next */ []));
|
|
2588
|
+
isLater(index) {
|
|
2589
|
+
const active = this.activeMark.index();
|
|
2590
|
+
return (this.runningTotal() && this.dimOthers() && active >= 0 && index > active);
|
|
1569
2591
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
const series = this.data().find((entry) => entry.id === marker?.seriesId);
|
|
1573
|
-
if (marker && series) {
|
|
1574
|
-
this.pointClicked.emit({
|
|
1575
|
-
series,
|
|
1576
|
-
categoryIndex: marker.categoryIndex,
|
|
1577
|
-
value: marker.value,
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
2592
|
+
isOutsideRange(index) {
|
|
2593
|
+
return outsideRange(this.scales.selectedRange?.() ?? null, index);
|
|
1580
2594
|
}
|
|
1581
|
-
|
|
1582
|
-
|
|
2595
|
+
focusedMark = computed(() => this.marks()[this.roving.tabStop()] ?? null, ...(ngDevMode ? [{ debugName: "focusedMark" }] : /* istanbul ignore next */ []));
|
|
2596
|
+
axisPointElements = computed(() => this.axisEntries().length === 0
|
|
2597
|
+
? []
|
|
2598
|
+
: [
|
|
2599
|
+
this.host.nativeElement.querySelector(`.columns [data-mark-index="${this.scales.activeIndex()}"]`),
|
|
2600
|
+
], ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
2601
|
+
shareDetail(index) {
|
|
2602
|
+
return this.partOfWhole()
|
|
2603
|
+
? describeShare(this.data().map((point) => point.value), index, this.locale, (share) => this.intl().chart.shareOfTotal(share))
|
|
2604
|
+
: undefined;
|
|
1583
2605
|
}
|
|
1584
|
-
/** What this series reads at the cursor's category, whatever `tooltip` says; feeds the category panel. */
|
|
1585
|
-
axisEntries = computed(() => this.readingsAtCursor().map(({ reading }) => reading), ...(ngDevMode ? [{ debugName: "axisEntries" }] : /* istanbul ignore next */ []));
|
|
1586
|
-
readingsAtCursor = computed(() => {
|
|
1587
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1588
|
-
if (categoryIndex < 0) {
|
|
1589
|
-
return [];
|
|
1590
|
-
}
|
|
1591
|
-
return this.plotted().flatMap((entry) => {
|
|
1592
|
-
const marker = entry.markers.find((candidate) => candidate.categoryIndex === categoryIndex);
|
|
1593
|
-
return marker
|
|
1594
|
-
? [
|
|
1595
|
-
{
|
|
1596
|
-
seriesId: entry.series.id,
|
|
1597
|
-
markIndex: marker.markIndex,
|
|
1598
|
-
reading: {
|
|
1599
|
-
label: marker.seriesLabel,
|
|
1600
|
-
value: marker.value,
|
|
1601
|
-
formatted: marker.formattedValue,
|
|
1602
|
-
color: marker.color,
|
|
1603
|
-
y: marker.y,
|
|
1604
|
-
},
|
|
1605
|
-
},
|
|
1606
|
-
]
|
|
1607
|
-
: [];
|
|
1608
|
-
});
|
|
1609
|
-
}, ...(ngDevMode ? [{ debugName: "readingsAtCursor" }] : /* istanbul ignore next */ []));
|
|
1610
2606
|
tooltipContext = computed(() => {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
}
|
|
1614
|
-
if (this.tooltip() === 'axis') {
|
|
1615
|
-
return this.axisTooltipContext();
|
|
1616
|
-
}
|
|
1617
|
-
const marker = this.allMarkers()[this.activeMark.index()];
|
|
1618
|
-
if (!marker) {
|
|
2607
|
+
const mark = this.marks()[this.activeMark.index()];
|
|
2608
|
+
if (this.tooltip() === 'none' || !mark || this.hidden()) {
|
|
1619
2609
|
return null;
|
|
1620
2610
|
}
|
|
2611
|
+
const series = this.seriesLabel();
|
|
1621
2612
|
return {
|
|
1622
|
-
category:
|
|
2613
|
+
category: series ? mark.point.label : '',
|
|
1623
2614
|
entries: [
|
|
1624
2615
|
{
|
|
1625
|
-
label:
|
|
1626
|
-
value:
|
|
1627
|
-
formatted:
|
|
1628
|
-
color:
|
|
2616
|
+
label: series ?? mark.point.label,
|
|
2617
|
+
value: mark.point.value,
|
|
2618
|
+
formatted: mark.formattedValue,
|
|
2619
|
+
color: mark.color,
|
|
2620
|
+
hatched: mark.hatched,
|
|
2621
|
+
detail: this.shareDetail(this.activeMark.index()),
|
|
1629
2622
|
},
|
|
1630
2623
|
],
|
|
1631
2624
|
};
|
|
1632
2625
|
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
1633
|
-
|
|
1634
|
-
axisPointElements = computed(() => this.readingsAtCursor().map(({ markIndex }) => this.markerElements()[markIndex]?.nativeElement ?? null), ...(ngDevMode ? [{ debugName: "axisPointElements" }] : /* istanbul ignore next */ []));
|
|
1635
|
-
/** 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. */
|
|
1636
|
-
topReadingElement = computed(() => {
|
|
1637
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1638
|
-
if (categoryIndex < 0) {
|
|
1639
|
-
return null;
|
|
1640
|
-
}
|
|
1641
|
-
const highest = this.allMarkers()
|
|
1642
|
-
.filter((marker) => marker.categoryIndex === categoryIndex)
|
|
1643
|
-
.reduce((top, marker) => (top === null || marker.y < top.y ? marker : top), null);
|
|
1644
|
-
return highest
|
|
1645
|
-
? (this.markerElements()[highest.markIndex]?.nativeElement ?? null)
|
|
1646
|
-
: null;
|
|
1647
|
-
}, ...(ngDevMode ? [{ debugName: "topReadingElement" }] : /* istanbul ignore next */ []));
|
|
1648
|
-
tooltipOrigin = computed(() => {
|
|
1649
|
-
if (this.tooltip() !== 'axis') {
|
|
1650
|
-
return this.activeMark.origin();
|
|
1651
|
-
}
|
|
1652
|
-
if (this.tooltipAnchor() === 'pointer') {
|
|
1653
|
-
return this.scales.cursorPointer() ?? this.scales.cursorOrigin();
|
|
1654
|
-
}
|
|
1655
|
-
return this.topReadingElement() ?? this.scales.cursorOrigin();
|
|
1656
|
-
}, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : /* istanbul ignore next */ []));
|
|
1657
|
-
/** Every series' reading at the active category; a series with none contributes no row. */
|
|
1658
|
-
axisTooltipContext = computed(() => {
|
|
1659
|
-
const categoryIndex = this.scales.activeIndex();
|
|
1660
|
-
if (categoryIndex < 0) {
|
|
1661
|
-
return null;
|
|
1662
|
-
}
|
|
1663
|
-
const focused = this.focusedSeries();
|
|
1664
|
-
const entries = topDown(this.readingsAtCursor()
|
|
1665
|
-
.filter(({ seriesId }) => !focused || seriesId === focused)
|
|
1666
|
-
.map(({ reading }) => reading));
|
|
1667
|
-
if (!entries.length) {
|
|
1668
|
-
return null;
|
|
1669
|
-
}
|
|
1670
|
-
return {
|
|
1671
|
-
category: this.scales.categories()[categoryIndex] ?? '',
|
|
1672
|
-
entries,
|
|
1673
|
-
};
|
|
1674
|
-
}, ...(ngDevMode ? [{ debugName: "axisTooltipContext" }] : /* istanbul ignore next */ []));
|
|
1675
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LineSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1676
|
-
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-ring-sweep{0%{opacity:0;transform:rotate(-30deg) scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}.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 });
|
|
2626
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2627
|
+
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 });
|
|
1677
2628
|
}
|
|
1678
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type:
|
|
2629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ColumnSeriesComponent, decorators: [{
|
|
1679
2630
|
type: Component,
|
|
1680
|
-
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-ring-sweep{0%{opacity:0;transform:rotate(-30deg) scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}.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"] }]
|
|
1681
|
-
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }],
|
|
2631
|
+
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"] }]
|
|
2632
|
+
}], 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 }] }] } });
|
|
1682
2633
|
|
|
1683
2634
|
/**
|
|
1684
2635
|
* The names of a chart's reference lines, laid out by the same geometry that draws them.
|
|
@@ -1692,11 +2643,11 @@ class ReferenceLabelComponent {
|
|
|
1692
2643
|
thresholds = input([], ...(ngDevMode ? [{ debugName: "thresholds" }] : /* istanbul ignore next */ []));
|
|
1693
2644
|
lines = computed(() => thresholdMarks(this.thresholds(), this.scales.plot(), this.scales.yPosition()).filter((mark) => mark.label !== ''), ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
1694
2645
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1695
|
-
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: [".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:
|
|
2646
|
+
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 });
|
|
1696
2647
|
}
|
|
1697
2648
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLabelComponent, decorators: [{
|
|
1698
2649
|
type: Component,
|
|
1699
|
-
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: [".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:
|
|
2650
|
+
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"] }]
|
|
1700
2651
|
}], propDecorators: { thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }] } });
|
|
1701
2652
|
|
|
1702
2653
|
let nextReferenceId = 0;
|
|
@@ -1724,11 +2675,11 @@ class ReferenceLineComponent {
|
|
|
1724
2675
|
}
|
|
1725
2676
|
lines = computed(() => thresholdMarks(this.thresholds(), this.scales.plot(), this.scales.yPosition()), ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
1726
2677
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1727
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ReferenceLineComponent, isStandalone: true, selector: "g[dsReferenceLine]", inputs: { thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (lines().length) {\n <svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n </svg:g>\n}\n", styles: [".references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2678
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ReferenceLineComponent, isStandalone: true, selector: "g[dsReferenceLine]", inputs: { thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (lines().length) {\n <svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n </svg:g>\n}\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)}}}.references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1728
2679
|
}
|
|
1729
2680
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ReferenceLineComponent, decorators: [{
|
|
1730
2681
|
type: Component,
|
|
1731
|
-
args: [{ selector: 'g[dsReferenceLine]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (lines().length) {\n <svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n </svg:g>\n}\n", styles: [".references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"] }]
|
|
2682
|
+
args: [{ selector: 'g[dsReferenceLine]', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (lines().length) {\n <svg:g\n class=\"references\"\n aria-hidden=\"true\">\n @for (line of lines(); track line.key) {\n <svg:g\n class=\"reference\"\n [style.--_chart-threshold-color]=\"line.color\">\n @if (line.band) {\n <svg:rect\n class=\"threshold-band\"\n [attr.x]=\"line.left\"\n [attr.y]=\"line.top\"\n [attr.width]=\"line.width\"\n [attr.height]=\"line.height\" />\n } @else {\n <svg:line\n class=\"threshold-line\"\n [class.is-dashed]=\"line.dash === 'dashed'\"\n [class.is-dotted]=\"line.dash === 'dotted'\"\n [attr.x1]=\"line.left\"\n [attr.x2]=\"line.right\"\n [attr.y1]=\"line.y\"\n [attr.y2]=\"line.y\" />\n }\n </svg:g>\n }\n </svg:g>\n}\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)}}}.references{--_chart-threshold-color: var(--ds-chart-threshold-color, var(--chart-threshold-color));--_chart-threshold-band-opacity: var(--ds-chart-threshold-band-opacity, var(--chart-threshold-band-opacity));--_chart-threshold-dashed-pattern: var(--ds-chart-threshold-dashed-pattern, var(--chart-threshold-dashed-pattern));--_chart-threshold-dotted-pattern: var(--ds-chart-threshold-dotted-pattern, var(--chart-threshold-dotted-pattern));pointer-events:none}.threshold-line{stroke:var(--_chart-threshold-color);stroke-width:var(--ds-chart-line-width)}.threshold-line.is-dashed{stroke-dasharray:var(--_chart-threshold-dashed-pattern)}.threshold-line.is-dotted{stroke-dasharray:var(--_chart-threshold-dotted-pattern);stroke-linecap:round}.threshold-band{fill:var(--_chart-threshold-color);fill-opacity:var(--_chart-threshold-band-opacity)}@media(forced-colors:active){.threshold-line{stroke:CanvasText}.threshold-band{fill:CanvasText}}\n"] }]
|
|
1732
2683
|
}], ctorParameters: () => [], propDecorators: { thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }] } });
|
|
1733
2684
|
|
|
1734
2685
|
/**
|
|
@@ -1752,16 +2703,16 @@ class SeriesAnnotationComponent {
|
|
|
1752
2703
|
})), plot.left + plot.width);
|
|
1753
2704
|
}, ...(ngDevMode ? [{ debugName: "placed" }] : /* istanbul ignore next */ []));
|
|
1754
2705
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SeriesAnnotationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1755
|
-
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: [".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 });
|
|
2706
|
+
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 });
|
|
1756
2707
|
}
|
|
1757
2708
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: SeriesAnnotationComponent, decorators: [{
|
|
1758
2709
|
type: Component,
|
|
1759
|
-
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: [".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"] }]
|
|
2710
|
+
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"] }]
|
|
1760
2711
|
}], propDecorators: { annotations: [{ type: i0.Input, args: [{ isSignal: true, alias: "annotations", required: false }] }] } });
|
|
1761
2712
|
|
|
1762
2713
|
/**
|
|
1763
2714
|
* Generated bundle index. Do not edit.
|
|
1764
2715
|
*/
|
|
1765
2716
|
|
|
1766
|
-
export { CHART_DEFAULT_VALUE_SPACE, CHART_SCALES, ChartComponent, ColumnSeriesComponent, LineSeriesComponent, ReferenceLabelComponent, ReferenceLineComponent, SeriesAnnotationComponent, annotationMarks, chartViewHeight, stackOffsets };
|
|
2717
|
+
export { CHART_DEFAULT_AXIS_GUTTER, CHART_DEFAULT_VALUE_SPACE, CHART_SCALES, ChartComponent, ColumnSeriesComponent, LineSeriesComponent, ReferenceLabelComponent, ReferenceLineComponent, SeriesAnnotationComponent, annotationMarks, chartViewHeight, stackOffsets };
|
|
1767
2718
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-chart.mjs.map
|