@edsis/angular 22.1.6 → 22.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +87 -399
- package/SECURITY.md +18 -0
- package/SUPPORT.md +15 -0
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +125 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +146 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +52 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/edsis-angular-chart-area.mjs +508 -0
- package/fesm2022/edsis-angular-chart-bar.mjs +946 -0
- package/fesm2022/edsis-angular-chart-core.mjs +1282 -0
- package/fesm2022/edsis-angular-chart-line.mjs +544 -0
- package/fesm2022/edsis-angular-chart-pie.mjs +524 -0
- package/fesm2022/edsis-angular-chart-primitives.mjs +1647 -0
- package/fesm2022/edsis-angular-chart-radar.mjs +693 -0
- package/fesm2022/edsis-angular-chart-radial.mjs +542 -0
- package/fesm2022/edsis-angular-chart-scatter.mjs +486 -0
- package/fesm2022/edsis-angular-chart.mjs +3 -0
- package/fesm2022/edsis-angular-component-accordion.mjs +513 -0
- package/fesm2022/edsis-angular-component-alert-dialog.mjs +1001 -0
- package/fesm2022/edsis-angular-component-alert.mjs +268 -0
- package/fesm2022/edsis-angular-component-aspect-ratio.mjs +80 -0
- package/fesm2022/edsis-angular-component-avatar.mjs +410 -0
- package/fesm2022/edsis-angular-component-badge.mjs +111 -0
- package/fesm2022/edsis-angular-component-breadcrumb.mjs +464 -0
- package/fesm2022/edsis-angular-component-button-group.mjs +252 -0
- package/fesm2022/edsis-angular-component-button.mjs +155 -0
- package/fesm2022/edsis-angular-component-calendar.mjs +835 -0
- package/fesm2022/edsis-angular-component-card.mjs +460 -0
- package/fesm2022/edsis-angular-component-carousel.mjs +700 -0
- package/fesm2022/edsis-angular-component-checkbox.mjs +398 -0
- package/fesm2022/edsis-angular-component-collapsible.mjs +305 -0
- package/fesm2022/edsis-angular-component-combobox.mjs +544 -0
- package/fesm2022/edsis-angular-component-command.mjs +815 -0
- package/fesm2022/edsis-angular-component-composer.mjs +840 -0
- package/fesm2022/edsis-angular-component-context-menu.mjs +197 -0
- package/fesm2022/edsis-angular-component-date-picker.mjs +798 -0
- package/fesm2022/edsis-angular-component-dialog.mjs +798 -0
- package/fesm2022/edsis-angular-component-drawer.mjs +2 -0
- package/fesm2022/edsis-angular-component-dropdown-menu.mjs +1259 -0
- package/fesm2022/edsis-angular-component-editor.mjs +1000 -0
- package/fesm2022/edsis-angular-component-empty.mjs +351 -0
- package/fesm2022/edsis-angular-component-form.mjs +821 -0
- package/fesm2022/edsis-angular-component-hover-card.mjs +486 -0
- package/fesm2022/edsis-angular-component-icon.mjs +253 -0
- package/fesm2022/edsis-angular-component-input-group.mjs +453 -0
- package/fesm2022/edsis-angular-component-input-otp.mjs +957 -0
- package/fesm2022/edsis-angular-component-input.mjs +87 -0
- package/fesm2022/edsis-angular-component-item.mjs +720 -0
- package/fesm2022/edsis-angular-component-kanban.mjs +812 -0
- package/fesm2022/edsis-angular-component-kbd.mjs +124 -0
- package/fesm2022/edsis-angular-component-label.mjs +82 -0
- package/fesm2022/edsis-angular-component-menubar.mjs +481 -0
- package/fesm2022/edsis-angular-component-native-select.mjs +168 -0
- package/fesm2022/edsis-angular-component-navigation-menu.mjs +685 -0
- package/fesm2022/edsis-angular-component-pagination.mjs +425 -0
- package/fesm2022/edsis-angular-component-pillbox.mjs +1679 -0
- package/fesm2022/edsis-angular-component-popover.mjs +292 -0
- package/fesm2022/edsis-angular-component-progress.mjs +184 -0
- package/fesm2022/edsis-angular-component-radio.mjs +491 -0
- package/fesm2022/edsis-angular-component-resizable.mjs +703 -0
- package/fesm2022/edsis-angular-component-scroll-area.mjs +133 -0
- package/fesm2022/edsis-angular-component-segmented-control.mjs +408 -0
- package/fesm2022/edsis-angular-component-select.mjs +743 -0
- package/fesm2022/edsis-angular-component-separator.mjs +102 -0
- package/fesm2022/edsis-angular-component-sheet.mjs +874 -0
- package/fesm2022/edsis-angular-component-skeleton.mjs +62 -0
- package/fesm2022/edsis-angular-component-slider.mjs +676 -0
- package/fesm2022/edsis-angular-component-spinner.mjs +157 -0
- package/fesm2022/edsis-angular-component-switch.mjs +361 -0
- package/fesm2022/edsis-angular-component-table.mjs +446 -0
- package/fesm2022/edsis-angular-component-tabs.mjs +592 -0
- package/fesm2022/edsis-angular-component-textarea.mjs +85 -0
- package/fesm2022/edsis-angular-component-timeline.mjs +619 -0
- package/fesm2022/edsis-angular-component-toast.mjs +231 -0
- package/fesm2022/edsis-angular-component-toggle-group.mjs +579 -0
- package/fesm2022/edsis-angular-component-toggle.mjs +189 -0
- package/fesm2022/edsis-angular-component-tooltip.mjs +804 -0
- package/fesm2022/edsis-angular-component-utils-core.mjs +181 -0
- package/fesm2022/edsis-angular-component-utils-overlay.mjs +54 -0
- package/fesm2022/edsis-angular-component-utils-scale.mjs +76 -0
- package/fesm2022/edsis-angular-component-utils.mjs +2 -0
- package/fesm2022/edsis-angular-component.mjs +0 -0
- package/fesm2022/edsis-angular-navigation-core.mjs +15 -0
- package/fesm2022/edsis-angular-navigation-icon.mjs +35 -0
- package/fesm2022/edsis-angular-navigation-navigation-badge-count.component-BWWWaUgy.mjs +234 -0
- package/fesm2022/edsis-angular-navigation-navigation-dockbar-menu.component-Bx2bxTID.mjs +834 -0
- package/fesm2022/edsis-angular-navigation-navigation-entry-grid.component-Duzt1ffz.mjs +823 -0
- package/fesm2022/edsis-angular-navigation-navigation-flyout-menu.component-cJ8Q1vM6.mjs +670 -0
- package/fesm2022/edsis-angular-navigation-navigation-horizontal.component-CDQ1wt2_.mjs +689 -0
- package/fesm2022/edsis-angular-navigation-navigation-item.component-C1VzerJp.mjs +1522 -0
- package/fesm2022/edsis-angular-navigation-navigation-list.component-BPYLfrID.mjs +346 -0
- package/fesm2022/edsis-angular-navigation-service.mjs +558 -0
- package/fesm2022/edsis-angular-navigation-types.mjs +151 -0
- package/fesm2022/edsis-angular-navigation.mjs +3338 -0
- package/fesm2022/edsis-angular-sdk.mjs +100 -0
- package/fesm2022/edsis-angular-theme-component-settings.mjs +1877 -0
- package/fesm2022/edsis-angular-theme-layout-services.mjs +252 -0
- package/fesm2022/edsis-angular-theme-layout-types.mjs +45 -0
- package/fesm2022/edsis-angular-theme-layout-wrapper.mjs +2568 -0
- package/fesm2022/edsis-angular-theme-layout.mjs +1089 -0
- package/fesm2022/edsis-angular-theme-page-core.mjs +315 -0
- package/fesm2022/edsis-angular-theme-page-filter.mjs +409 -0
- package/fesm2022/edsis-angular-theme-page-overview.mjs +88 -0
- package/fesm2022/edsis-angular-theme-page-root.mjs +693 -0
- package/fesm2022/edsis-angular-theme-page-side.mjs +342 -0
- package/fesm2022/edsis-angular-theme-page-slots.mjs +258 -0
- package/fesm2022/edsis-angular-theme-page.mjs +7 -0
- package/fesm2022/edsis-angular-theme-shell-services.mjs +231 -0
- package/fesm2022/edsis-angular-theme-shell-types.mjs +102 -0
- package/fesm2022/edsis-angular-theme-shell.mjs +1352 -0
- package/fesm2022/edsis-angular-theme-styles.mjs +572 -0
- package/fesm2022/edsis-angular-theme.mjs +0 -0
- package/fesm2022/edsis-angular.mjs +5 -8
- package/navigation/README.md +576 -0
- package/package.json +477 -52
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +120 -0
- package/theme/component/settings/README.md +154 -0
- package/theme/layout/README.md +604 -0
- package/theme/page/README.md +505 -0
- package/theme/shell/README.md +344 -0
- package/theme/styles/README.md +202 -0
- package/theme/styles/css/base/components.css +577 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +208 -0
- package/theme/styles/css/base/theme.css +353 -0
- package/theme/styles/css/base/tokens.css +388 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/fonts.css +85 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/edsis-angular-chart-area.d.ts +139 -0
- package/types/edsis-angular-chart-bar.d.ts +291 -0
- package/types/edsis-angular-chart-core.d.ts +822 -0
- package/types/edsis-angular-chart-line.d.ts +148 -0
- package/types/edsis-angular-chart-pie.d.ts +202 -0
- package/types/edsis-angular-chart-primitives.d.ts +360 -0
- package/types/edsis-angular-chart-radar.d.ts +198 -0
- package/types/edsis-angular-chart-radial.d.ts +187 -0
- package/types/edsis-angular-chart-scatter.d.ts +181 -0
- package/types/edsis-angular-chart.d.ts +3 -0
- package/types/edsis-angular-component-accordion.d.ts +139 -0
- package/types/edsis-angular-component-alert-dialog.d.ts +288 -0
- package/types/edsis-angular-component-alert.d.ts +72 -0
- package/types/edsis-angular-component-aspect-ratio.d.ts +20 -0
- package/types/edsis-angular-component-avatar.d.ts +111 -0
- package/types/edsis-angular-component-badge.d.ts +36 -0
- package/types/edsis-angular-component-breadcrumb.d.ts +85 -0
- package/types/edsis-angular-component-button-group.d.ts +50 -0
- package/types/edsis-angular-component-button.d.ts +44 -0
- package/types/edsis-angular-component-calendar.d.ts +150 -0
- package/types/edsis-angular-component-card.d.ts +123 -0
- package/types/edsis-angular-component-carousel.d.ts +155 -0
- package/types/edsis-angular-component-checkbox.d.ts +100 -0
- package/types/edsis-angular-component-collapsible.d.ts +68 -0
- package/types/edsis-angular-component-combobox.d.ts +105 -0
- package/types/edsis-angular-component-command.d.ts +215 -0
- package/types/edsis-angular-component-composer.d.ts +190 -0
- package/types/edsis-angular-component-context-menu.d.ts +64 -0
- package/types/edsis-angular-component-date-picker.d.ts +199 -0
- package/types/edsis-angular-component-dialog.d.ts +231 -0
- package/types/edsis-angular-component-drawer.d.ts +2 -0
- package/types/edsis-angular-component-dropdown-menu.d.ts +370 -0
- package/types/edsis-angular-component-editor.d.ts +234 -0
- package/types/edsis-angular-component-empty.d.ts +85 -0
- package/types/edsis-angular-component-form.d.ts +223 -0
- package/types/edsis-angular-component-hover-card.d.ts +133 -0
- package/types/edsis-angular-component-icon.d.ts +90 -0
- package/types/edsis-angular-component-input-group.d.ts +98 -0
- package/types/edsis-angular-component-input-otp.d.ts +249 -0
- package/types/edsis-angular-component-input.d.ts +31 -0
- package/types/edsis-angular-component-item.d.ts +169 -0
- package/types/edsis-angular-component-kanban.d.ts +165 -0
- package/types/edsis-angular-component-kbd.d.ts +25 -0
- package/types/edsis-angular-component-label.d.ts +19 -0
- package/types/edsis-angular-component-menubar.d.ts +123 -0
- package/types/edsis-angular-component-native-select.d.ts +39 -0
- package/types/edsis-angular-component-navigation-menu.d.ts +163 -0
- package/types/edsis-angular-component-pagination.d.ts +83 -0
- package/types/edsis-angular-component-pillbox.d.ts +380 -0
- package/types/edsis-angular-component-popover.d.ts +96 -0
- package/types/edsis-angular-component-progress.d.ts +45 -0
- package/types/edsis-angular-component-radio.d.ts +137 -0
- package/types/edsis-angular-component-resizable.d.ts +166 -0
- package/types/edsis-angular-component-scroll-area.d.ts +37 -0
- package/types/edsis-angular-component-segmented-control.d.ts +102 -0
- package/types/edsis-angular-component-select.d.ts +138 -0
- package/types/edsis-angular-component-separator.d.ts +26 -0
- package/types/edsis-angular-component-sheet.d.ts +240 -0
- package/types/edsis-angular-component-skeleton.d.ts +13 -0
- package/types/edsis-angular-component-slider.d.ts +148 -0
- package/types/edsis-angular-component-spinner.d.ts +31 -0
- package/types/edsis-angular-component-switch.d.ts +101 -0
- package/types/edsis-angular-component-table.d.ts +109 -0
- package/types/edsis-angular-component-tabs.d.ts +183 -0
- package/types/edsis-angular-component-textarea.d.ts +27 -0
- package/types/edsis-angular-component-timeline.d.ts +146 -0
- package/types/edsis-angular-component-toast.d.ts +60 -0
- package/types/edsis-angular-component-toggle-group.d.ts +161 -0
- package/types/edsis-angular-component-toggle.d.ts +47 -0
- package/types/edsis-angular-component-tooltip.d.ts +233 -0
- package/types/edsis-angular-component-utils-core.d.ts +175 -0
- package/types/edsis-angular-component-utils-overlay.d.ts +17 -0
- package/types/edsis-angular-component-utils-scale.d.ts +27 -0
- package/types/edsis-angular-component-utils.d.ts +2 -0
- package/types/edsis-angular-component.d.ts +1 -0
- package/types/edsis-angular-navigation-core.d.ts +55 -0
- package/types/edsis-angular-navigation-icon.d.ts +9 -0
- package/types/edsis-angular-navigation-service.d.ts +121 -0
- package/types/edsis-angular-navigation-types.d.ts +185 -0
- package/types/edsis-angular-navigation.d.ts +862 -0
- package/types/edsis-angular-sdk.d.ts +87 -0
- package/types/edsis-angular-theme-component-settings.d.ts +205 -0
- package/types/edsis-angular-theme-layout-services.d.ts +143 -0
- package/types/edsis-angular-theme-layout-types.d.ts +36 -0
- package/types/edsis-angular-theme-layout-wrapper.d.ts +670 -0
- package/types/edsis-angular-theme-layout.d.ts +218 -0
- package/types/edsis-angular-theme-page-core.d.ts +151 -0
- package/types/edsis-angular-theme-page-filter.d.ts +127 -0
- package/types/edsis-angular-theme-page-overview.d.ts +28 -0
- package/types/edsis-angular-theme-page-root.d.ts +172 -0
- package/types/edsis-angular-theme-page-side.d.ts +90 -0
- package/types/edsis-angular-theme-page-slots.d.ts +61 -0
- package/types/edsis-angular-theme-page.d.ts +7 -0
- package/types/edsis-angular-theme-shell-services.d.ts +188 -0
- package/types/edsis-angular-theme-shell-types.d.ts +102 -0
- package/types/edsis-angular-theme-shell.d.ts +178 -0
- package/types/edsis-angular-theme-styles.d.ts +295 -0
- package/types/edsis-angular-theme.d.ts +1 -0
- package/types/edsis-angular.d.ts +5 -2
- package/fesm2022/edsis-angular-block-shell.mjs +0 -1329
- package/fesm2022/edsis-angular-block-shell.mjs.map +0 -1
- package/fesm2022/edsis-angular-block-themes.mjs +0 -1007
- package/fesm2022/edsis-angular-block-themes.mjs.map +0 -1
- package/fesm2022/edsis-angular-module-auth.mjs +0 -2582
- package/fesm2022/edsis-angular-module-auth.mjs.map +0 -1
- package/fesm2022/edsis-angular-platform-mfe.mjs +0 -329
- package/fesm2022/edsis-angular-platform-mfe.mjs.map +0 -1
- package/fesm2022/edsis-angular-services-runtime.mjs +0 -385
- package/fesm2022/edsis-angular-services-runtime.mjs.map +0 -1
- package/fesm2022/edsis-angular.mjs.map +0 -1
- package/types/edsis-angular-block-shell.d.ts +0 -190
- package/types/edsis-angular-block-themes.d.ts +0 -94
- package/types/edsis-angular-module-auth.d.ts +0 -533
- package/types/edsis-angular-platform-mfe.d.ts +0 -126
- package/types/edsis-angular-services-runtime.d.ts +0 -118
|
@@ -0,0 +1,1647 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, TemplateRef, afterNextRender, afterRenderEffect, computed, contentChild, inject, input, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { CartesianContext, CategoricalViewportContext, ChartContext, ScatterViewportContext, bandTicks, effectiveIndexRange, indexRangeSize, linearTicks, nearestCategoryIndex, normalizeIndexRange, normalizeNumericDomain, panIndexRange, panNumericDomain, seriesColorVar, zoomIndexRange, zoomNumericDomain } from "@edsis/angular/chart/core";
|
|
4
|
+
import { DOCUMENT, NgComponentOutlet, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
5
|
+
var ChartAxisX = class ChartAxisX {
|
|
6
|
+
ctx = inject(CartesianContext);
|
|
7
|
+
tickCount = input(5, ...ngDevMode ? [{ debugName: "tickCount" }] : /* istanbul ignore next */ []);
|
|
8
|
+
tickLine = input(true, ...ngDevMode ? [{ debugName: "tickLine" }] : /* istanbul ignore next */ []);
|
|
9
|
+
tickFormat = input((v) => String(v), ...ngDevMode ? [{ debugName: "tickFormat" }] : /* istanbul ignore next */ []);
|
|
10
|
+
innerWidth = this.ctx.innerWidth;
|
|
11
|
+
transform = computed(() => `translate(0,${this.ctx.innerHeight()})`, ...ngDevMode ? [{ debugName: "transform" }] : /* istanbul ignore next */ []);
|
|
12
|
+
ticks = computed(() => {
|
|
13
|
+
if (this.ctx.orientation() === "horizontal") {
|
|
14
|
+
const scale = this.ctx.valueScale();
|
|
15
|
+
return scale ? linearTicks(scale, this.tickCount(), this.tickFormat()) : [];
|
|
16
|
+
}
|
|
17
|
+
const scale = this.ctx.categoryScale();
|
|
18
|
+
return scale ? bandTicks(scale) : [];
|
|
19
|
+
}, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
21
|
+
minVersion: "12.0.0",
|
|
22
|
+
version: "22.2.3",
|
|
23
|
+
ngImport: i0,
|
|
24
|
+
type: ChartAxisX,
|
|
25
|
+
deps: [],
|
|
26
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
27
|
+
});
|
|
28
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
29
|
+
minVersion: "17.0.0",
|
|
30
|
+
version: "22.2.3",
|
|
31
|
+
type: ChartAxisX,
|
|
32
|
+
isStandalone: true,
|
|
33
|
+
selector: "svg:g[ChartAxisX]",
|
|
34
|
+
inputs: {
|
|
35
|
+
tickCount: {
|
|
36
|
+
classPropertyName: "tickCount",
|
|
37
|
+
publicName: "tickCount",
|
|
38
|
+
isSignal: true,
|
|
39
|
+
isRequired: false,
|
|
40
|
+
transformFunction: null
|
|
41
|
+
},
|
|
42
|
+
tickLine: {
|
|
43
|
+
classPropertyName: "tickLine",
|
|
44
|
+
publicName: "tickLine",
|
|
45
|
+
isSignal: true,
|
|
46
|
+
isRequired: false,
|
|
47
|
+
transformFunction: null
|
|
48
|
+
},
|
|
49
|
+
tickFormat: {
|
|
50
|
+
classPropertyName: "tickFormat",
|
|
51
|
+
publicName: "tickFormat",
|
|
52
|
+
isSignal: true,
|
|
53
|
+
isRequired: false,
|
|
54
|
+
transformFunction: null
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
host: {
|
|
58
|
+
properties: { "attr.transform": "transform()" },
|
|
59
|
+
classAttribute: "chart-axis chart-axis-x text-muted-foreground"
|
|
60
|
+
},
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
template: `
|
|
63
|
+
<svg:line class="stroke-border" [attr.x1]="0" [attr.x2]="innerWidth()" y1="0" y2="0" />
|
|
64
|
+
@for (t of ticks(); track t.value) {
|
|
65
|
+
<svg:g [attr.transform]="'translate(' + t.offset + ',0)'">
|
|
66
|
+
@if (tickLine()) {
|
|
67
|
+
<svg:line class="stroke-border" y1="0" y2="6" />
|
|
68
|
+
}
|
|
69
|
+
<svg:text
|
|
70
|
+
class="fill-current"
|
|
71
|
+
y="18"
|
|
72
|
+
text-anchor="middle"
|
|
73
|
+
style="font-size: var(--text-xs); font-family: var(--font-sans)"
|
|
74
|
+
>
|
|
75
|
+
{{ t.label }}
|
|
76
|
+
</svg:text>
|
|
77
|
+
</svg:g>
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
isInline: true
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
84
|
+
minVersion: "12.0.0",
|
|
85
|
+
version: "22.2.3",
|
|
86
|
+
ngImport: i0,
|
|
87
|
+
type: ChartAxisX,
|
|
88
|
+
decorators: [{
|
|
89
|
+
type: Component,
|
|
90
|
+
args: [{
|
|
91
|
+
selector: "svg:g[ChartAxisX]",
|
|
92
|
+
host: {
|
|
93
|
+
class: "chart-axis chart-axis-x text-muted-foreground",
|
|
94
|
+
"[attr.transform]": "transform()"
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<svg:line class="stroke-border" [attr.x1]="0" [attr.x2]="innerWidth()" y1="0" y2="0" />
|
|
98
|
+
@for (t of ticks(); track t.value) {
|
|
99
|
+
<svg:g [attr.transform]="'translate(' + t.offset + ',0)'">
|
|
100
|
+
@if (tickLine()) {
|
|
101
|
+
<svg:line class="stroke-border" y1="0" y2="6" />
|
|
102
|
+
}
|
|
103
|
+
<svg:text
|
|
104
|
+
class="fill-current"
|
|
105
|
+
y="18"
|
|
106
|
+
text-anchor="middle"
|
|
107
|
+
style="font-size: var(--text-xs); font-family: var(--font-sans)"
|
|
108
|
+
>
|
|
109
|
+
{{ t.label }}
|
|
110
|
+
</svg:text>
|
|
111
|
+
</svg:g>
|
|
112
|
+
}
|
|
113
|
+
`
|
|
114
|
+
}]
|
|
115
|
+
}],
|
|
116
|
+
propDecorators: {
|
|
117
|
+
tickCount: [{
|
|
118
|
+
type: i0.Input,
|
|
119
|
+
args: [{
|
|
120
|
+
isSignal: true,
|
|
121
|
+
alias: "tickCount",
|
|
122
|
+
required: false
|
|
123
|
+
}]
|
|
124
|
+
}],
|
|
125
|
+
tickLine: [{
|
|
126
|
+
type: i0.Input,
|
|
127
|
+
args: [{
|
|
128
|
+
isSignal: true,
|
|
129
|
+
alias: "tickLine",
|
|
130
|
+
required: false
|
|
131
|
+
}]
|
|
132
|
+
}],
|
|
133
|
+
tickFormat: [{
|
|
134
|
+
type: i0.Input,
|
|
135
|
+
args: [{
|
|
136
|
+
isSignal: true,
|
|
137
|
+
alias: "tickFormat",
|
|
138
|
+
required: false
|
|
139
|
+
}]
|
|
140
|
+
}]
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
var ChartAxisY = class ChartAxisY {
|
|
144
|
+
ctx = inject(CartesianContext);
|
|
145
|
+
tickCount = input(5, ...ngDevMode ? [{ debugName: "tickCount" }] : /* istanbul ignore next */ []);
|
|
146
|
+
tickLine = input(true, ...ngDevMode ? [{ debugName: "tickLine" }] : /* istanbul ignore next */ []);
|
|
147
|
+
tickFormat = input((v) => String(v), ...ngDevMode ? [{ debugName: "tickFormat" }] : /* istanbul ignore next */ []);
|
|
148
|
+
innerHeight = this.ctx.innerHeight;
|
|
149
|
+
ticks = computed(() => {
|
|
150
|
+
if (this.ctx.orientation() === "horizontal") {
|
|
151
|
+
const scale = this.ctx.categoryScale();
|
|
152
|
+
return scale ? bandTicks(scale) : [];
|
|
153
|
+
}
|
|
154
|
+
const scale = this.ctx.valueScale();
|
|
155
|
+
return scale ? linearTicks(scale, this.tickCount(), this.tickFormat()) : [];
|
|
156
|
+
}, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
157
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
158
|
+
minVersion: "12.0.0",
|
|
159
|
+
version: "22.2.3",
|
|
160
|
+
ngImport: i0,
|
|
161
|
+
type: ChartAxisY,
|
|
162
|
+
deps: [],
|
|
163
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
164
|
+
});
|
|
165
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
166
|
+
minVersion: "17.0.0",
|
|
167
|
+
version: "22.2.3",
|
|
168
|
+
type: ChartAxisY,
|
|
169
|
+
isStandalone: true,
|
|
170
|
+
selector: "svg:g[ChartAxisY]",
|
|
171
|
+
inputs: {
|
|
172
|
+
tickCount: {
|
|
173
|
+
classPropertyName: "tickCount",
|
|
174
|
+
publicName: "tickCount",
|
|
175
|
+
isSignal: true,
|
|
176
|
+
isRequired: false,
|
|
177
|
+
transformFunction: null
|
|
178
|
+
},
|
|
179
|
+
tickLine: {
|
|
180
|
+
classPropertyName: "tickLine",
|
|
181
|
+
publicName: "tickLine",
|
|
182
|
+
isSignal: true,
|
|
183
|
+
isRequired: false,
|
|
184
|
+
transformFunction: null
|
|
185
|
+
},
|
|
186
|
+
tickFormat: {
|
|
187
|
+
classPropertyName: "tickFormat",
|
|
188
|
+
publicName: "tickFormat",
|
|
189
|
+
isSignal: true,
|
|
190
|
+
isRequired: false,
|
|
191
|
+
transformFunction: null
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
host: { classAttribute: "chart-axis chart-axis-y text-muted-foreground" },
|
|
195
|
+
ngImport: i0,
|
|
196
|
+
template: `
|
|
197
|
+
<svg:line class="stroke-border" x1="0" x2="0" [attr.y1]="0" [attr.y2]="innerHeight()" />
|
|
198
|
+
@for (t of ticks(); track t.value) {
|
|
199
|
+
<svg:g [attr.transform]="'translate(0,' + t.offset + ')'">
|
|
200
|
+
@if (tickLine()) {
|
|
201
|
+
<svg:line class="stroke-border" x1="-6" x2="0" />
|
|
202
|
+
}
|
|
203
|
+
<svg:text
|
|
204
|
+
class="fill-current"
|
|
205
|
+
x="-8"
|
|
206
|
+
dy="0.32em"
|
|
207
|
+
text-anchor="end"
|
|
208
|
+
style="font-size: var(--text-xs); font-family: var(--font-sans)"
|
|
209
|
+
>
|
|
210
|
+
{{ t.label }}
|
|
211
|
+
</svg:text>
|
|
212
|
+
</svg:g>
|
|
213
|
+
}
|
|
214
|
+
`,
|
|
215
|
+
isInline: true
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
219
|
+
minVersion: "12.0.0",
|
|
220
|
+
version: "22.2.3",
|
|
221
|
+
ngImport: i0,
|
|
222
|
+
type: ChartAxisY,
|
|
223
|
+
decorators: [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{
|
|
226
|
+
selector: "svg:g[ChartAxisY]",
|
|
227
|
+
host: { class: "chart-axis chart-axis-y text-muted-foreground" },
|
|
228
|
+
template: `
|
|
229
|
+
<svg:line class="stroke-border" x1="0" x2="0" [attr.y1]="0" [attr.y2]="innerHeight()" />
|
|
230
|
+
@for (t of ticks(); track t.value) {
|
|
231
|
+
<svg:g [attr.transform]="'translate(0,' + t.offset + ')'">
|
|
232
|
+
@if (tickLine()) {
|
|
233
|
+
<svg:line class="stroke-border" x1="-6" x2="0" />
|
|
234
|
+
}
|
|
235
|
+
<svg:text
|
|
236
|
+
class="fill-current"
|
|
237
|
+
x="-8"
|
|
238
|
+
dy="0.32em"
|
|
239
|
+
text-anchor="end"
|
|
240
|
+
style="font-size: var(--text-xs); font-family: var(--font-sans)"
|
|
241
|
+
>
|
|
242
|
+
{{ t.label }}
|
|
243
|
+
</svg:text>
|
|
244
|
+
</svg:g>
|
|
245
|
+
}
|
|
246
|
+
`
|
|
247
|
+
}]
|
|
248
|
+
}],
|
|
249
|
+
propDecorators: {
|
|
250
|
+
tickCount: [{
|
|
251
|
+
type: i0.Input,
|
|
252
|
+
args: [{
|
|
253
|
+
isSignal: true,
|
|
254
|
+
alias: "tickCount",
|
|
255
|
+
required: false
|
|
256
|
+
}]
|
|
257
|
+
}],
|
|
258
|
+
tickLine: [{
|
|
259
|
+
type: i0.Input,
|
|
260
|
+
args: [{
|
|
261
|
+
isSignal: true,
|
|
262
|
+
alias: "tickLine",
|
|
263
|
+
required: false
|
|
264
|
+
}]
|
|
265
|
+
}],
|
|
266
|
+
tickFormat: [{
|
|
267
|
+
type: i0.Input,
|
|
268
|
+
args: [{
|
|
269
|
+
isSignal: true,
|
|
270
|
+
alias: "tickFormat",
|
|
271
|
+
required: false
|
|
272
|
+
}]
|
|
273
|
+
}]
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var ChartGrid = class ChartGrid {
|
|
277
|
+
ctx = inject(CartesianContext);
|
|
278
|
+
tickCount = input(5, ...ngDevMode ? [{ debugName: "tickCount" }] : /* istanbul ignore next */ []);
|
|
279
|
+
ticks = computed(() => {
|
|
280
|
+
const scale = this.ctx.valueScale();
|
|
281
|
+
return scale ? linearTicks(scale, this.tickCount()) : [];
|
|
282
|
+
}, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
283
|
+
line = (offset) => {
|
|
284
|
+
if (this.ctx.orientation() === "vertical") return {
|
|
285
|
+
x1: 0,
|
|
286
|
+
x2: this.ctx.innerWidth(),
|
|
287
|
+
y1: offset,
|
|
288
|
+
y2: offset
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
x1: offset,
|
|
292
|
+
x2: offset,
|
|
293
|
+
y1: 0,
|
|
294
|
+
y2: this.ctx.innerHeight()
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
298
|
+
minVersion: "12.0.0",
|
|
299
|
+
version: "22.2.3",
|
|
300
|
+
ngImport: i0,
|
|
301
|
+
type: ChartGrid,
|
|
302
|
+
deps: [],
|
|
303
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
304
|
+
});
|
|
305
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
306
|
+
minVersion: "17.0.0",
|
|
307
|
+
version: "22.2.3",
|
|
308
|
+
type: ChartGrid,
|
|
309
|
+
isStandalone: true,
|
|
310
|
+
selector: "svg:g[ChartGrid]",
|
|
311
|
+
inputs: { tickCount: {
|
|
312
|
+
classPropertyName: "tickCount",
|
|
313
|
+
publicName: "tickCount",
|
|
314
|
+
isSignal: true,
|
|
315
|
+
isRequired: false,
|
|
316
|
+
transformFunction: null
|
|
317
|
+
} },
|
|
318
|
+
host: { classAttribute: "chart-grid text-border" },
|
|
319
|
+
ngImport: i0,
|
|
320
|
+
template: `
|
|
321
|
+
@for (t of ticks(); track t.value) {
|
|
322
|
+
<svg:line
|
|
323
|
+
class="stroke-border"
|
|
324
|
+
stroke-dasharray="3 3"
|
|
325
|
+
[attr.x1]="line(t.offset).x1"
|
|
326
|
+
[attr.x2]="line(t.offset).x2"
|
|
327
|
+
[attr.y1]="line(t.offset).y1"
|
|
328
|
+
[attr.y2]="line(t.offset).y2"
|
|
329
|
+
/>
|
|
330
|
+
}
|
|
331
|
+
`,
|
|
332
|
+
isInline: true
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
336
|
+
minVersion: "12.0.0",
|
|
337
|
+
version: "22.2.3",
|
|
338
|
+
ngImport: i0,
|
|
339
|
+
type: ChartGrid,
|
|
340
|
+
decorators: [{
|
|
341
|
+
type: Component,
|
|
342
|
+
args: [{
|
|
343
|
+
selector: "svg:g[ChartGrid]",
|
|
344
|
+
host: { class: "chart-grid text-border" },
|
|
345
|
+
template: `
|
|
346
|
+
@for (t of ticks(); track t.value) {
|
|
347
|
+
<svg:line
|
|
348
|
+
class="stroke-border"
|
|
349
|
+
stroke-dasharray="3 3"
|
|
350
|
+
[attr.x1]="line(t.offset).x1"
|
|
351
|
+
[attr.x2]="line(t.offset).x2"
|
|
352
|
+
[attr.y1]="line(t.offset).y1"
|
|
353
|
+
[attr.y2]="line(t.offset).y2"
|
|
354
|
+
/>
|
|
355
|
+
}
|
|
356
|
+
`
|
|
357
|
+
}]
|
|
358
|
+
}],
|
|
359
|
+
propDecorators: { tickCount: [{
|
|
360
|
+
type: i0.Input,
|
|
361
|
+
args: [{
|
|
362
|
+
isSignal: true,
|
|
363
|
+
alias: "tickCount",
|
|
364
|
+
required: false
|
|
365
|
+
}]
|
|
366
|
+
}] }
|
|
367
|
+
});
|
|
368
|
+
var ChartCrosshair = class ChartCrosshair {
|
|
369
|
+
root = inject(ChartContext);
|
|
370
|
+
cart = inject(CartesianContext);
|
|
371
|
+
line = computed(() => {
|
|
372
|
+
const active = this.root.activePoint();
|
|
373
|
+
const scale = this.cart.categoryScale();
|
|
374
|
+
const categories = this.cart.categories();
|
|
375
|
+
if (!active || !scale || active.index < 0 || active.index >= categories.length) return null;
|
|
376
|
+
const pos = (scale(categories[active.index]) ?? 0) + scale.bandwidth() / 2;
|
|
377
|
+
if (this.cart.orientation() === "vertical") return {
|
|
378
|
+
x1: pos,
|
|
379
|
+
x2: pos,
|
|
380
|
+
y1: 0,
|
|
381
|
+
y2: this.cart.innerHeight()
|
|
382
|
+
};
|
|
383
|
+
return {
|
|
384
|
+
x1: 0,
|
|
385
|
+
x2: this.cart.innerWidth(),
|
|
386
|
+
y1: pos,
|
|
387
|
+
y2: pos
|
|
388
|
+
};
|
|
389
|
+
}, ...ngDevMode ? [{ debugName: "line" }] : /* istanbul ignore next */ []);
|
|
390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
391
|
+
minVersion: "12.0.0",
|
|
392
|
+
version: "22.2.3",
|
|
393
|
+
ngImport: i0,
|
|
394
|
+
type: ChartCrosshair,
|
|
395
|
+
deps: [],
|
|
396
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
397
|
+
});
|
|
398
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
399
|
+
minVersion: "17.0.0",
|
|
400
|
+
version: "22.2.3",
|
|
401
|
+
type: ChartCrosshair,
|
|
402
|
+
isStandalone: true,
|
|
403
|
+
selector: "svg:g[ChartCrosshair]",
|
|
404
|
+
host: { classAttribute: "chart-crosshair" },
|
|
405
|
+
ngImport: i0,
|
|
406
|
+
template: `
|
|
407
|
+
@if (line(); as l) {
|
|
408
|
+
<svg:line
|
|
409
|
+
class="stroke-border"
|
|
410
|
+
stroke-dasharray="3 3"
|
|
411
|
+
[attr.x1]="l.x1"
|
|
412
|
+
[attr.x2]="l.x2"
|
|
413
|
+
[attr.y1]="l.y1"
|
|
414
|
+
[attr.y2]="l.y2"
|
|
415
|
+
/>
|
|
416
|
+
}
|
|
417
|
+
`,
|
|
418
|
+
isInline: true
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
422
|
+
minVersion: "12.0.0",
|
|
423
|
+
version: "22.2.3",
|
|
424
|
+
ngImport: i0,
|
|
425
|
+
type: ChartCrosshair,
|
|
426
|
+
decorators: [{
|
|
427
|
+
type: Component,
|
|
428
|
+
args: [{
|
|
429
|
+
selector: "svg:g[ChartCrosshair]",
|
|
430
|
+
host: { class: "chart-crosshair" },
|
|
431
|
+
template: `
|
|
432
|
+
@if (line(); as l) {
|
|
433
|
+
<svg:line
|
|
434
|
+
class="stroke-border"
|
|
435
|
+
stroke-dasharray="3 3"
|
|
436
|
+
[attr.x1]="l.x1"
|
|
437
|
+
[attr.x2]="l.x2"
|
|
438
|
+
[attr.y1]="l.y1"
|
|
439
|
+
[attr.y2]="l.y2"
|
|
440
|
+
/>
|
|
441
|
+
}
|
|
442
|
+
`
|
|
443
|
+
}]
|
|
444
|
+
}]
|
|
445
|
+
});
|
|
446
|
+
function clamp(value, min, max) {
|
|
447
|
+
return Math.min(max, Math.max(min, value));
|
|
448
|
+
}
|
|
449
|
+
function sameDomain(a, b) {
|
|
450
|
+
return Math.abs(a[0] - b[0]) < 1e-9 && Math.abs(a[1] - b[1]) < 1e-9;
|
|
451
|
+
}
|
|
452
|
+
var ChartBrush = class ChartBrush {
|
|
453
|
+
hitbox = viewChild.required("hitbox", ...ngDevMode ? [{ debugName: "hitbox" }] : /* istanbul ignore next */ []);
|
|
454
|
+
cart = inject(CartesianContext, { optional: true });
|
|
455
|
+
categorical = inject(CategoricalViewportContext, { optional: true });
|
|
456
|
+
scatter = inject(ScatterViewportContext, { optional: true });
|
|
457
|
+
document = inject(DOCUMENT);
|
|
458
|
+
detachDragListeners = null;
|
|
459
|
+
constructor() {
|
|
460
|
+
inject(DestroyRef).onDestroy(() => this.detachDragListeners?.());
|
|
461
|
+
}
|
|
462
|
+
mode = signal(null, ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
|
|
463
|
+
activePointerId = signal(null, ...ngDevMode ? [{ debugName: "activePointerId" }] : /* istanbul ignore next */ []);
|
|
464
|
+
categoryStartIndex = signal(null, ...ngDevMode ? [{ debugName: "categoryStartIndex" }] : /* istanbul ignore next */ []);
|
|
465
|
+
categoryPanStart = signal(null, ...ngDevMode ? [{ debugName: "categoryPanStart" }] : /* istanbul ignore next */ []);
|
|
466
|
+
scatterBrush = signal(null, ...ngDevMode ? [{ debugName: "scatterBrush" }] : /* istanbul ignore next */ []);
|
|
467
|
+
scatterPan = signal(null, ...ngDevMode ? [{ debugName: "scatterPan" }] : /* istanbul ignore next */ []);
|
|
468
|
+
width = computed(() => this.scatter?.innerWidth() ?? this.cart?.innerWidth() ?? 0, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
469
|
+
height = computed(() => this.scatter?.innerHeight() ?? this.cart?.innerHeight() ?? 0, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
470
|
+
categoryPreview = computed(() => {
|
|
471
|
+
const cart = this.cart;
|
|
472
|
+
const viewport = this.categorical;
|
|
473
|
+
const range = viewport?.brushRange();
|
|
474
|
+
const scale = cart?.categoryScale();
|
|
475
|
+
const categories = cart?.categories() ?? [];
|
|
476
|
+
if (!cart || !viewport || !range || !scale || categories.length === 0) return null;
|
|
477
|
+
const visibleStart = viewport.zoomRange()?.startIndex ?? 0;
|
|
478
|
+
const startVisible = range.startIndex - visibleStart;
|
|
479
|
+
const endVisible = range.endIndex - visibleStart;
|
|
480
|
+
if (startVisible < 0 || endVisible >= categories.length) return null;
|
|
481
|
+
const first = scale(categories[startVisible]) ?? 0;
|
|
482
|
+
const last = (scale(categories[endVisible]) ?? 0) + scale.bandwidth();
|
|
483
|
+
if (cart.orientation() === "vertical") return {
|
|
484
|
+
x: Math.min(first, last),
|
|
485
|
+
y: 0,
|
|
486
|
+
width: Math.abs(last - first),
|
|
487
|
+
height: cart.innerHeight()
|
|
488
|
+
};
|
|
489
|
+
return {
|
|
490
|
+
x: 0,
|
|
491
|
+
y: Math.min(first, last),
|
|
492
|
+
width: cart.innerWidth(),
|
|
493
|
+
height: Math.abs(last - first)
|
|
494
|
+
};
|
|
495
|
+
}, ...ngDevMode ? [{ debugName: "categoryPreview" }] : /* istanbul ignore next */ []);
|
|
496
|
+
scatterPreviewRect = computed(() => {
|
|
497
|
+
const preview = this.scatterBrush();
|
|
498
|
+
if (!preview) return null;
|
|
499
|
+
return {
|
|
500
|
+
x: Math.min(preview.start.x, preview.current.x),
|
|
501
|
+
y: Math.min(preview.start.y, preview.current.y),
|
|
502
|
+
width: Math.abs(preview.current.x - preview.start.x),
|
|
503
|
+
height: Math.abs(preview.current.y - preview.start.y)
|
|
504
|
+
};
|
|
505
|
+
}, ...ngDevMode ? [{ debugName: "scatterPreviewRect" }] : /* istanbul ignore next */ []);
|
|
506
|
+
onPointerDown(event) {
|
|
507
|
+
if (this.activePointerId() != null) return;
|
|
508
|
+
const local = this.localPoint(event);
|
|
509
|
+
if (!local) return;
|
|
510
|
+
if (this.scatter) {
|
|
511
|
+
if (!this.scatter.fullXDomain() || !this.scatter.fullYDomain()) return;
|
|
512
|
+
event.preventDefault();
|
|
513
|
+
this.beginDrag(event);
|
|
514
|
+
this.onScatterPointerDown(event, local);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
if (!this.cart || !this.categorical) return;
|
|
518
|
+
const index = nearestCategoryIndex({
|
|
519
|
+
categoryScale: this.cart.categoryScale,
|
|
520
|
+
categories: this.cart.categories,
|
|
521
|
+
orientation: this.cart.orientation
|
|
522
|
+
}, local.x, local.y);
|
|
523
|
+
if (index < 0) return;
|
|
524
|
+
event.preventDefault();
|
|
525
|
+
this.beginDrag(event);
|
|
526
|
+
const absoluteIndex = (this.categorical.zoomRange()?.startIndex ?? 0) + index;
|
|
527
|
+
if (event.pointerType === "touch" && this.categorical.hasZoom()) {
|
|
528
|
+
this.mode.set("category-pan");
|
|
529
|
+
this.categoryPanStart.set({
|
|
530
|
+
coord: this.pointerAxis(local),
|
|
531
|
+
range: this.categorical.zoomRange()
|
|
532
|
+
});
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
this.mode.set("category-brush");
|
|
536
|
+
this.categoryStartIndex.set(absoluteIndex);
|
|
537
|
+
this.categorical.brushRange.set({
|
|
538
|
+
startIndex: absoluteIndex,
|
|
539
|
+
endIndex: absoluteIndex
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
onPointerMove(event) {
|
|
543
|
+
if (this.activePointerId() !== event.pointerId) return;
|
|
544
|
+
const local = this.localPoint(event);
|
|
545
|
+
if (!local) return;
|
|
546
|
+
if (this.mode() === "category-brush" && this.cart && this.categorical) {
|
|
547
|
+
const startIndex = this.categoryStartIndex();
|
|
548
|
+
if (startIndex == null) return;
|
|
549
|
+
const index = nearestCategoryIndex({
|
|
550
|
+
categoryScale: this.cart.categoryScale,
|
|
551
|
+
categories: this.cart.categories,
|
|
552
|
+
orientation: this.cart.orientation
|
|
553
|
+
}, local.x, local.y);
|
|
554
|
+
if (index < 0) return;
|
|
555
|
+
const visibleStart = this.categorical.zoomRange()?.startIndex ?? 0;
|
|
556
|
+
this.categorical.brushRange.set(normalizeIndexRange(startIndex, visibleStart + index, this.categorical.dataCount()));
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (this.mode() === "category-pan" && this.cart && this.categorical) {
|
|
560
|
+
const pan = this.categoryPanStart();
|
|
561
|
+
if (!pan) return;
|
|
562
|
+
const scale = this.cart.categoryScale();
|
|
563
|
+
const step = scale?.step?.() ?? scale?.bandwidth() ?? 0;
|
|
564
|
+
if (step <= 0) return;
|
|
565
|
+
const deltaSteps = Math.round((pan.coord - this.pointerAxis(local)) / step);
|
|
566
|
+
this.categorical.zoomRange.set(panIndexRange(pan.range, this.categorical.dataCount(), deltaSteps));
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (this.mode() === "scatter-brush") {
|
|
570
|
+
const preview = this.scatterBrush();
|
|
571
|
+
if (!preview) return;
|
|
572
|
+
this.scatterBrush.set({
|
|
573
|
+
start: preview.start,
|
|
574
|
+
current: local
|
|
575
|
+
});
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (this.mode() === "scatter-pan" && this.scatter) {
|
|
579
|
+
const pan = this.scatterPan();
|
|
580
|
+
const xScale = this.scatter.xScale();
|
|
581
|
+
const yScale = this.scatter.yScale();
|
|
582
|
+
const fullX = this.scatter.fullXDomain();
|
|
583
|
+
const fullY = this.scatter.fullYDomain();
|
|
584
|
+
if (!pan || !xScale || !yScale || !fullX || !fullY) return;
|
|
585
|
+
const deltaX = xScale.invert(pan.start.x) - xScale.invert(local.x);
|
|
586
|
+
const deltaY = yScale.invert(pan.start.y) - yScale.invert(local.y);
|
|
587
|
+
this.scatter.zoomXDomain.set(panNumericDomain(pan.xDomain, fullX, deltaX));
|
|
588
|
+
this.scatter.zoomYDomain.set(panNumericDomain(pan.yDomain, fullY, deltaY));
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
onPointerUp(event) {
|
|
592
|
+
if (event && this.activePointerId() !== event.pointerId) return;
|
|
593
|
+
if (this.mode() === "category-brush" && this.categorical) {
|
|
594
|
+
const range = this.categorical.brushRange();
|
|
595
|
+
if (range && indexRangeSize(range, this.categorical.dataCount()) > 1) this.categorical.zoomRange.set(range);
|
|
596
|
+
this.categorical.brushRange.set(null);
|
|
597
|
+
}
|
|
598
|
+
if (this.mode() === "scatter-brush" && this.scatter) {
|
|
599
|
+
const preview = this.scatterBrush();
|
|
600
|
+
const xScale = this.scatter.xScale();
|
|
601
|
+
const yScale = this.scatter.yScale();
|
|
602
|
+
const fullX = this.scatter.fullXDomain();
|
|
603
|
+
const fullY = this.scatter.fullYDomain();
|
|
604
|
+
if (preview && xScale && yScale && fullX && fullY) {
|
|
605
|
+
const width = Math.abs(preview.current.x - preview.start.x);
|
|
606
|
+
const height = Math.abs(preview.current.y - preview.start.y);
|
|
607
|
+
if (width >= 6 && height >= 6) {
|
|
608
|
+
const nextX = normalizeNumericDomain(xScale.invert(preview.start.x), xScale.invert(preview.current.x));
|
|
609
|
+
const nextY = normalizeNumericDomain(yScale.invert(preview.start.y), yScale.invert(preview.current.y));
|
|
610
|
+
this.scatter.zoomXDomain.set(sameDomain(nextX, fullX) ? null : nextX);
|
|
611
|
+
this.scatter.zoomYDomain.set(sameDomain(nextY, fullY) ? null : nextY);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
this.scatterBrush.set(null);
|
|
615
|
+
}
|
|
616
|
+
this.mode.set(null);
|
|
617
|
+
this.categoryStartIndex.set(null);
|
|
618
|
+
this.categoryPanStart.set(null);
|
|
619
|
+
this.scatterPan.set(null);
|
|
620
|
+
this.endDrag(event);
|
|
621
|
+
}
|
|
622
|
+
onPointerCancel(event) {
|
|
623
|
+
if (this.activePointerId() !== event.pointerId) return;
|
|
624
|
+
this.mode.set(null);
|
|
625
|
+
this.categorical?.brushRange.set(null);
|
|
626
|
+
this.scatterBrush.set(null);
|
|
627
|
+
this.categoryStartIndex.set(null);
|
|
628
|
+
this.categoryPanStart.set(null);
|
|
629
|
+
this.scatterPan.set(null);
|
|
630
|
+
this.endDrag(event);
|
|
631
|
+
}
|
|
632
|
+
onWheel(event) {
|
|
633
|
+
const local = this.localPoint(event);
|
|
634
|
+
if (!local) return;
|
|
635
|
+
event.preventDefault();
|
|
636
|
+
if (this.scatter) {
|
|
637
|
+
const xScale = this.scatter.xScale();
|
|
638
|
+
const yScale = this.scatter.yScale();
|
|
639
|
+
const fullX = this.scatter.fullXDomain();
|
|
640
|
+
const fullY = this.scatter.fullYDomain();
|
|
641
|
+
if (!xScale || !yScale || !fullX || !fullY) return;
|
|
642
|
+
const factor = event.deltaY < 0 ? .8 : 1.25;
|
|
643
|
+
const currentX = this.scatter.zoomXDomain() ?? fullX;
|
|
644
|
+
const currentY = this.scatter.zoomYDomain() ?? fullY;
|
|
645
|
+
const nextX = zoomNumericDomain(currentX, fullX, xScale.invert(local.x), factor);
|
|
646
|
+
const nextY = zoomNumericDomain(currentY, fullY, yScale.invert(local.y), factor);
|
|
647
|
+
this.scatter.zoomXDomain.set(sameDomain(nextX, fullX) ? null : nextX);
|
|
648
|
+
this.scatter.zoomYDomain.set(sameDomain(nextY, fullY) ? null : nextY);
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
if (!this.cart || !this.categorical) return;
|
|
652
|
+
const visibleIndex = nearestCategoryIndex({
|
|
653
|
+
categoryScale: this.cart.categoryScale,
|
|
654
|
+
categories: this.cart.categories,
|
|
655
|
+
orientation: this.cart.orientation
|
|
656
|
+
}, local.x, local.y);
|
|
657
|
+
if (visibleIndex < 0) return;
|
|
658
|
+
const anchor = (this.categorical.zoomRange()?.startIndex ?? 0) + visibleIndex;
|
|
659
|
+
const factor = event.deltaY < 0 ? .75 : 1.25;
|
|
660
|
+
this.categorical.zoomRange.set(zoomIndexRange(this.categorical.zoomRange(), this.categorical.dataCount(), anchor, factor));
|
|
661
|
+
this.categorical.brushRange.set(null);
|
|
662
|
+
}
|
|
663
|
+
resetZoom() {
|
|
664
|
+
this.categorical?.resetZoom();
|
|
665
|
+
this.scatter?.resetZoom();
|
|
666
|
+
this.scatterBrush.set(null);
|
|
667
|
+
}
|
|
668
|
+
beginDrag(event) {
|
|
669
|
+
this.activePointerId.set(event.pointerId);
|
|
670
|
+
this.hitbox().nativeElement.setPointerCapture(event.pointerId);
|
|
671
|
+
const move = (next) => this.onPointerMove(next);
|
|
672
|
+
const up = (next) => this.onPointerUp(next);
|
|
673
|
+
const cancel = (next) => this.onPointerCancel(next);
|
|
674
|
+
this.document.addEventListener("pointermove", move);
|
|
675
|
+
this.document.addEventListener("pointerup", up);
|
|
676
|
+
this.document.addEventListener("pointercancel", cancel);
|
|
677
|
+
this.detachDragListeners = () => {
|
|
678
|
+
this.document.removeEventListener("pointermove", move);
|
|
679
|
+
this.document.removeEventListener("pointerup", up);
|
|
680
|
+
this.document.removeEventListener("pointercancel", cancel);
|
|
681
|
+
this.detachDragListeners = null;
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
endDrag(event) {
|
|
685
|
+
if (event && this.hitbox().nativeElement.hasPointerCapture(event.pointerId)) this.hitbox().nativeElement.releasePointerCapture(event.pointerId);
|
|
686
|
+
this.detachDragListeners?.();
|
|
687
|
+
this.activePointerId.set(null);
|
|
688
|
+
}
|
|
689
|
+
onScatterPointerDown(event, local) {
|
|
690
|
+
const fullX = this.scatter?.fullXDomain();
|
|
691
|
+
const fullY = this.scatter?.fullYDomain();
|
|
692
|
+
if (!this.scatter || !fullX || !fullY) return;
|
|
693
|
+
if (event.pointerType === "touch" && this.scatter.hasZoom()) {
|
|
694
|
+
this.mode.set("scatter-pan");
|
|
695
|
+
this.scatterPan.set({
|
|
696
|
+
start: local,
|
|
697
|
+
xDomain: this.scatter.zoomXDomain() ?? fullX,
|
|
698
|
+
yDomain: this.scatter.zoomYDomain() ?? fullY
|
|
699
|
+
});
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
this.mode.set("scatter-brush");
|
|
703
|
+
this.scatterBrush.set({
|
|
704
|
+
start: local,
|
|
705
|
+
current: local
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
localPoint(event) {
|
|
709
|
+
const hitbox = this.hitbox()?.nativeElement;
|
|
710
|
+
const width = this.width();
|
|
711
|
+
const height = this.height();
|
|
712
|
+
if (!hitbox || width <= 0 || height <= 0) return null;
|
|
713
|
+
const rect = hitbox.getBoundingClientRect();
|
|
714
|
+
if (rect.width <= 0 || rect.height <= 0) return null;
|
|
715
|
+
return {
|
|
716
|
+
x: clamp((event.clientX - rect.left) / rect.width * width, 0, width),
|
|
717
|
+
y: clamp((event.clientY - rect.top) / rect.height * height, 0, height)
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
pointerAxis(local) {
|
|
721
|
+
return this.cart?.orientation() === "horizontal" ? local.y : local.x;
|
|
722
|
+
}
|
|
723
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
724
|
+
minVersion: "12.0.0",
|
|
725
|
+
version: "22.2.3",
|
|
726
|
+
ngImport: i0,
|
|
727
|
+
type: ChartBrush,
|
|
728
|
+
deps: [],
|
|
729
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
730
|
+
});
|
|
731
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
732
|
+
minVersion: "17.0.0",
|
|
733
|
+
version: "22.2.3",
|
|
734
|
+
type: ChartBrush,
|
|
735
|
+
isStandalone: true,
|
|
736
|
+
selector: "svg:g[ChartBrush]",
|
|
737
|
+
host: { classAttribute: "chart-brush" },
|
|
738
|
+
viewQueries: [{
|
|
739
|
+
propertyName: "hitbox",
|
|
740
|
+
first: true,
|
|
741
|
+
predicate: ["hitbox"],
|
|
742
|
+
descendants: true,
|
|
743
|
+
isSignal: true
|
|
744
|
+
}],
|
|
745
|
+
ngImport: i0,
|
|
746
|
+
template: `
|
|
747
|
+
<svg:rect
|
|
748
|
+
#hitbox
|
|
749
|
+
class="fill-transparent touch-none"
|
|
750
|
+
x="0"
|
|
751
|
+
y="0"
|
|
752
|
+
[attr.width]="width()"
|
|
753
|
+
[attr.height]="height()"
|
|
754
|
+
(pointerdown)="onPointerDown($event)"
|
|
755
|
+
(wheel)="onWheel($event)"
|
|
756
|
+
(dblclick)="resetZoom()"
|
|
757
|
+
/>
|
|
758
|
+
|
|
759
|
+
@if (categoryPreview(); as rect) {
|
|
760
|
+
<svg:rect
|
|
761
|
+
class="fill-foreground/10 stroke-foreground/30"
|
|
762
|
+
[attr.x]="rect.x"
|
|
763
|
+
[attr.y]="rect.y"
|
|
764
|
+
[attr.width]="rect.width"
|
|
765
|
+
[attr.height]="rect.height"
|
|
766
|
+
stroke-dasharray="4 3"
|
|
767
|
+
/>
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
@if (scatterPreviewRect(); as rect) {
|
|
771
|
+
<svg:rect
|
|
772
|
+
class="fill-foreground/10 stroke-foreground/30"
|
|
773
|
+
[attr.x]="rect.x"
|
|
774
|
+
[attr.y]="rect.y"
|
|
775
|
+
[attr.width]="rect.width"
|
|
776
|
+
[attr.height]="rect.height"
|
|
777
|
+
stroke-dasharray="4 3"
|
|
778
|
+
/>
|
|
779
|
+
}
|
|
780
|
+
`,
|
|
781
|
+
isInline: true
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
785
|
+
minVersion: "12.0.0",
|
|
786
|
+
version: "22.2.3",
|
|
787
|
+
ngImport: i0,
|
|
788
|
+
type: ChartBrush,
|
|
789
|
+
decorators: [{
|
|
790
|
+
type: Component,
|
|
791
|
+
args: [{
|
|
792
|
+
selector: "svg:g[ChartBrush]",
|
|
793
|
+
host: { class: "chart-brush" },
|
|
794
|
+
template: `
|
|
795
|
+
<svg:rect
|
|
796
|
+
#hitbox
|
|
797
|
+
class="fill-transparent touch-none"
|
|
798
|
+
x="0"
|
|
799
|
+
y="0"
|
|
800
|
+
[attr.width]="width()"
|
|
801
|
+
[attr.height]="height()"
|
|
802
|
+
(pointerdown)="onPointerDown($event)"
|
|
803
|
+
(wheel)="onWheel($event)"
|
|
804
|
+
(dblclick)="resetZoom()"
|
|
805
|
+
/>
|
|
806
|
+
|
|
807
|
+
@if (categoryPreview(); as rect) {
|
|
808
|
+
<svg:rect
|
|
809
|
+
class="fill-foreground/10 stroke-foreground/30"
|
|
810
|
+
[attr.x]="rect.x"
|
|
811
|
+
[attr.y]="rect.y"
|
|
812
|
+
[attr.width]="rect.width"
|
|
813
|
+
[attr.height]="rect.height"
|
|
814
|
+
stroke-dasharray="4 3"
|
|
815
|
+
/>
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
@if (scatterPreviewRect(); as rect) {
|
|
819
|
+
<svg:rect
|
|
820
|
+
class="fill-foreground/10 stroke-foreground/30"
|
|
821
|
+
[attr.x]="rect.x"
|
|
822
|
+
[attr.y]="rect.y"
|
|
823
|
+
[attr.width]="rect.width"
|
|
824
|
+
[attr.height]="rect.height"
|
|
825
|
+
stroke-dasharray="4 3"
|
|
826
|
+
/>
|
|
827
|
+
}
|
|
828
|
+
`
|
|
829
|
+
}]
|
|
830
|
+
}],
|
|
831
|
+
ctorParameters: () => [],
|
|
832
|
+
propDecorators: { hitbox: [{
|
|
833
|
+
type: i0.ViewChild,
|
|
834
|
+
args: ["hitbox", { isSignal: true }]
|
|
835
|
+
}] }
|
|
836
|
+
});
|
|
837
|
+
var ChartPointerTracker = class ChartPointerTracker {
|
|
838
|
+
root = inject(ChartContext);
|
|
839
|
+
cart = inject(CartesianContext);
|
|
840
|
+
viewport = inject(CategoricalViewportContext, { optional: true });
|
|
841
|
+
onMove(event) {
|
|
842
|
+
const target = event.currentTarget;
|
|
843
|
+
if (!target) return;
|
|
844
|
+
const rect = target.getBoundingClientRect();
|
|
845
|
+
if (rect.width === 0 || rect.height === 0) return;
|
|
846
|
+
const { width, height } = this.root.dimensions();
|
|
847
|
+
const scaleX = width / rect.width;
|
|
848
|
+
const scaleY = height / rect.height;
|
|
849
|
+
const viewX = (event.clientX - rect.left) * scaleX;
|
|
850
|
+
const viewY = (event.clientY - rect.top) * scaleY;
|
|
851
|
+
const margin = this.cart.margin();
|
|
852
|
+
const localX = viewX - margin.left;
|
|
853
|
+
const localY = viewY - margin.top;
|
|
854
|
+
const index = nearestCategoryIndex({
|
|
855
|
+
categoryScale: this.cart.categoryScale,
|
|
856
|
+
categories: this.cart.categories,
|
|
857
|
+
orientation: this.cart.orientation
|
|
858
|
+
}, localX, localY);
|
|
859
|
+
if (index < 0) {
|
|
860
|
+
this.root.activePoint.set(null);
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
this.root.activePoint.set({
|
|
864
|
+
index,
|
|
865
|
+
datumIndex: (this.viewport?.zoomRange()?.startIndex ?? 0) + index,
|
|
866
|
+
clientX: event.clientX,
|
|
867
|
+
clientY: event.clientY
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
onLeave() {
|
|
871
|
+
this.root.activePoint.set(null);
|
|
872
|
+
}
|
|
873
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
874
|
+
minVersion: "12.0.0",
|
|
875
|
+
version: "22.2.3",
|
|
876
|
+
ngImport: i0,
|
|
877
|
+
type: ChartPointerTracker,
|
|
878
|
+
deps: [],
|
|
879
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
880
|
+
});
|
|
881
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
882
|
+
minVersion: "14.0.0",
|
|
883
|
+
version: "22.2.3",
|
|
884
|
+
type: ChartPointerTracker,
|
|
885
|
+
isStandalone: true,
|
|
886
|
+
selector: "svg:svg[ChartPointerTracker]",
|
|
887
|
+
host: { listeners: {
|
|
888
|
+
"pointermove": "onMove($event)",
|
|
889
|
+
"pointerleave": "onLeave()"
|
|
890
|
+
} },
|
|
891
|
+
ngImport: i0
|
|
892
|
+
});
|
|
893
|
+
};
|
|
894
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
895
|
+
minVersion: "12.0.0",
|
|
896
|
+
version: "22.2.3",
|
|
897
|
+
ngImport: i0,
|
|
898
|
+
type: ChartPointerTracker,
|
|
899
|
+
decorators: [{
|
|
900
|
+
type: Directive,
|
|
901
|
+
args: [{
|
|
902
|
+
selector: "svg:svg[ChartPointerTracker]",
|
|
903
|
+
host: {
|
|
904
|
+
"(pointermove)": "onMove($event)",
|
|
905
|
+
"(pointerleave)": "onLeave()"
|
|
906
|
+
}
|
|
907
|
+
}]
|
|
908
|
+
}]
|
|
909
|
+
});
|
|
910
|
+
function chartContainerElement(el) {
|
|
911
|
+
let node = el;
|
|
912
|
+
while (node && !node.hasAttribute("data-chart")) node = node.parentElement;
|
|
913
|
+
return node;
|
|
914
|
+
}
|
|
915
|
+
const FALLBACK_TOOLTIP_WIDTH = 128;
|
|
916
|
+
var ChartTooltip = class ChartTooltip {
|
|
917
|
+
root = inject(ChartContext);
|
|
918
|
+
host = inject(ElementRef);
|
|
919
|
+
zone = inject(NgZone);
|
|
920
|
+
platformId = inject(PLATFORM_ID);
|
|
921
|
+
destroyRef = inject(DestroyRef);
|
|
922
|
+
containerBox = signal(null, {
|
|
923
|
+
...ngDevMode ? { debugName: "containerBox" } : /* istanbul ignore next */ {},
|
|
924
|
+
equal: (a, b) => a?.left === b?.left && a?.top === b?.top && a?.width === b?.width
|
|
925
|
+
});
|
|
926
|
+
tooltipBox = signal({
|
|
927
|
+
width: FALLBACK_TOOLTIP_WIDTH,
|
|
928
|
+
height: 0
|
|
929
|
+
}, {
|
|
930
|
+
...ngDevMode ? { debugName: "tooltipBox" } : /* istanbul ignore next */ {},
|
|
931
|
+
equal: (a, b) => a.width === b.width && a.height === b.height
|
|
932
|
+
});
|
|
933
|
+
constructor() {
|
|
934
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
935
|
+
afterNextRender(() => this.observeContainer());
|
|
936
|
+
afterRenderEffect(() => {
|
|
937
|
+
this.payload();
|
|
938
|
+
this.measure();
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
xKey = input(null, ...ngDevMode ? [{ debugName: "xKey" }] : /* istanbul ignore next */ []);
|
|
942
|
+
data = input(null, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
943
|
+
valueKey = input(null, ...ngDevMode ? [{ debugName: "valueKey" }] : /* istanbul ignore next */ []);
|
|
944
|
+
indicator = input("dot", ...ngDevMode ? [{ debugName: "indicator" }] : /* istanbul ignore next */ []);
|
|
945
|
+
hideLabel = input(false, ...ngDevMode ? [{ debugName: "hideLabel" }] : /* istanbul ignore next */ []);
|
|
946
|
+
label = input(null, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
947
|
+
labelKey = input(null, ...ngDevMode ? [{ debugName: "labelKey" }] : /* istanbul ignore next */ []);
|
|
948
|
+
labelFormatter = input(null, ...ngDevMode ? [{ debugName: "labelFormatter" }] : /* istanbul ignore next */ []);
|
|
949
|
+
formatter = input(null, ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
|
|
950
|
+
customTpl = contentChild(TemplateRef, ...ngDevMode ? [{ debugName: "customTpl" }] : /* istanbul ignore next */ []);
|
|
951
|
+
visible = computed(() => this.root.activePoint() !== null, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
952
|
+
payload = computed(() => {
|
|
953
|
+
const active = this.root.activePoint();
|
|
954
|
+
const rows = this.data();
|
|
955
|
+
if (!active || !rows) return null;
|
|
956
|
+
const dataIndex = active.datumIndex != null && active.datumIndex < rows.length ? active.datumIndex : active.index;
|
|
957
|
+
if (dataIndex < 0 || dataIndex >= rows.length) return null;
|
|
958
|
+
const cfg = this.root.config();
|
|
959
|
+
const visibleKeys = this.root.visibleSeriesKeys();
|
|
960
|
+
const datum = rows[dataIndex];
|
|
961
|
+
const xKey = this.xKey();
|
|
962
|
+
const category = xKey && xKey in datum ? String(datum[xKey]) : String(active.index);
|
|
963
|
+
const activeSeriesKey = active.seriesKey && visibleKeys.includes(active.seriesKey) ? active.seriesKey : null;
|
|
964
|
+
const keys = activeSeriesKey ? [activeSeriesKey] : visibleKeys;
|
|
965
|
+
const valueKey = this.valueKey();
|
|
966
|
+
return {
|
|
967
|
+
category,
|
|
968
|
+
datum,
|
|
969
|
+
rows: keys.map((k) => {
|
|
970
|
+
const rawValue = valueKey != null && activeSeriesKey === k ? datum[valueKey] : datum[k];
|
|
971
|
+
return {
|
|
972
|
+
seriesKey: k,
|
|
973
|
+
label: cfg[k]?.label ?? k,
|
|
974
|
+
value: rawValue,
|
|
975
|
+
color: seriesColorVar(k),
|
|
976
|
+
icon: cfg[k]?.icon
|
|
977
|
+
};
|
|
978
|
+
})
|
|
979
|
+
};
|
|
980
|
+
}, ...ngDevMode ? [{ debugName: "payload" }] : /* istanbul ignore next */ []);
|
|
981
|
+
headerText(p) {
|
|
982
|
+
if (this.hideLabel()) return null;
|
|
983
|
+
const override = this.label();
|
|
984
|
+
const labelKey = this.labelKey();
|
|
985
|
+
const cfg = this.root.config();
|
|
986
|
+
const fromKey = labelKey ? cfg[labelKey]?.label ?? labelKey : null;
|
|
987
|
+
const raw = override ?? fromKey ?? p.category;
|
|
988
|
+
const fmt = this.labelFormatter();
|
|
989
|
+
return fmt ? fmt(raw, p) : raw;
|
|
990
|
+
}
|
|
991
|
+
formatRow(row, p) {
|
|
992
|
+
const fmt = this.formatter();
|
|
993
|
+
if (fmt) return fmt(row.value, row, p);
|
|
994
|
+
return row.value == null ? "" : String(row.value);
|
|
995
|
+
}
|
|
996
|
+
position = computed(() => {
|
|
997
|
+
const active = this.root.activePoint();
|
|
998
|
+
const box = this.containerBox();
|
|
999
|
+
if (!active || active.clientX == null || active.clientY == null || !box) return {
|
|
1000
|
+
x: 0,
|
|
1001
|
+
y: 0
|
|
1002
|
+
};
|
|
1003
|
+
const { width: tooltipWidth, height: tooltipHeight } = this.tooltipBox();
|
|
1004
|
+
const padding = 8;
|
|
1005
|
+
const minX = padding + tooltipWidth / 2;
|
|
1006
|
+
const maxX = Math.max(minX, box.width - padding - tooltipWidth / 2);
|
|
1007
|
+
const x = Math.min(maxX, Math.max(minX, active.clientX - box.left));
|
|
1008
|
+
const minY = padding + tooltipHeight;
|
|
1009
|
+
return {
|
|
1010
|
+
x,
|
|
1011
|
+
y: Math.max(minY, active.clientY - box.top - padding)
|
|
1012
|
+
};
|
|
1013
|
+
}, ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
|
|
1014
|
+
observeContainer() {
|
|
1015
|
+
const container = chartContainerElement(this.host.nativeElement);
|
|
1016
|
+
if (!container) return;
|
|
1017
|
+
this.measureContainer(container);
|
|
1018
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
1019
|
+
const observer = new ResizeObserver(() => this.zone.run(() => this.measureContainer(container)));
|
|
1020
|
+
observer.observe(container);
|
|
1021
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
1022
|
+
}
|
|
1023
|
+
measure() {
|
|
1024
|
+
const container = chartContainerElement(this.host.nativeElement);
|
|
1025
|
+
if (container) this.measureContainer(container);
|
|
1026
|
+
const card = this.host.nativeElement.querySelector("[role=\"tooltip\"]");
|
|
1027
|
+
this.tooltipBox.set({
|
|
1028
|
+
width: card?.offsetWidth || FALLBACK_TOOLTIP_WIDTH,
|
|
1029
|
+
height: card?.offsetHeight ?? 0
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
measureContainer(container) {
|
|
1033
|
+
const rect = container.getBoundingClientRect();
|
|
1034
|
+
this.containerBox.set({
|
|
1035
|
+
left: rect.left,
|
|
1036
|
+
top: rect.top,
|
|
1037
|
+
width: rect.width
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1041
|
+
minVersion: "12.0.0",
|
|
1042
|
+
version: "22.2.3",
|
|
1043
|
+
ngImport: i0,
|
|
1044
|
+
type: ChartTooltip,
|
|
1045
|
+
deps: [],
|
|
1046
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1047
|
+
});
|
|
1048
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1049
|
+
minVersion: "17.0.0",
|
|
1050
|
+
version: "22.2.3",
|
|
1051
|
+
type: ChartTooltip,
|
|
1052
|
+
isStandalone: true,
|
|
1053
|
+
selector: "ChartTooltip",
|
|
1054
|
+
inputs: {
|
|
1055
|
+
xKey: {
|
|
1056
|
+
classPropertyName: "xKey",
|
|
1057
|
+
publicName: "xKey",
|
|
1058
|
+
isSignal: true,
|
|
1059
|
+
isRequired: false,
|
|
1060
|
+
transformFunction: null
|
|
1061
|
+
},
|
|
1062
|
+
data: {
|
|
1063
|
+
classPropertyName: "data",
|
|
1064
|
+
publicName: "data",
|
|
1065
|
+
isSignal: true,
|
|
1066
|
+
isRequired: false,
|
|
1067
|
+
transformFunction: null
|
|
1068
|
+
},
|
|
1069
|
+
valueKey: {
|
|
1070
|
+
classPropertyName: "valueKey",
|
|
1071
|
+
publicName: "valueKey",
|
|
1072
|
+
isSignal: true,
|
|
1073
|
+
isRequired: false,
|
|
1074
|
+
transformFunction: null
|
|
1075
|
+
},
|
|
1076
|
+
indicator: {
|
|
1077
|
+
classPropertyName: "indicator",
|
|
1078
|
+
publicName: "indicator",
|
|
1079
|
+
isSignal: true,
|
|
1080
|
+
isRequired: false,
|
|
1081
|
+
transformFunction: null
|
|
1082
|
+
},
|
|
1083
|
+
hideLabel: {
|
|
1084
|
+
classPropertyName: "hideLabel",
|
|
1085
|
+
publicName: "hideLabel",
|
|
1086
|
+
isSignal: true,
|
|
1087
|
+
isRequired: false,
|
|
1088
|
+
transformFunction: null
|
|
1089
|
+
},
|
|
1090
|
+
label: {
|
|
1091
|
+
classPropertyName: "label",
|
|
1092
|
+
publicName: "label",
|
|
1093
|
+
isSignal: true,
|
|
1094
|
+
isRequired: false,
|
|
1095
|
+
transformFunction: null
|
|
1096
|
+
},
|
|
1097
|
+
labelKey: {
|
|
1098
|
+
classPropertyName: "labelKey",
|
|
1099
|
+
publicName: "labelKey",
|
|
1100
|
+
isSignal: true,
|
|
1101
|
+
isRequired: false,
|
|
1102
|
+
transformFunction: null
|
|
1103
|
+
},
|
|
1104
|
+
labelFormatter: {
|
|
1105
|
+
classPropertyName: "labelFormatter",
|
|
1106
|
+
publicName: "labelFormatter",
|
|
1107
|
+
isSignal: true,
|
|
1108
|
+
isRequired: false,
|
|
1109
|
+
transformFunction: null
|
|
1110
|
+
},
|
|
1111
|
+
formatter: {
|
|
1112
|
+
classPropertyName: "formatter",
|
|
1113
|
+
publicName: "formatter",
|
|
1114
|
+
isSignal: true,
|
|
1115
|
+
isRequired: false,
|
|
1116
|
+
transformFunction: null
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
host: {
|
|
1120
|
+
properties: { "attr.aria-hidden": "!visible()" },
|
|
1121
|
+
classAttribute: "pointer-events-none absolute inset-0 z-10"
|
|
1122
|
+
},
|
|
1123
|
+
queries: [{
|
|
1124
|
+
propertyName: "customTpl",
|
|
1125
|
+
first: true,
|
|
1126
|
+
predicate: TemplateRef,
|
|
1127
|
+
descendants: true,
|
|
1128
|
+
isSignal: true
|
|
1129
|
+
}],
|
|
1130
|
+
ngImport: i0,
|
|
1131
|
+
template: `
|
|
1132
|
+
@if (payload(); as p) {
|
|
1133
|
+
<div
|
|
1134
|
+
role="tooltip"
|
|
1135
|
+
class="pointer-events-none absolute grid min-w-32 max-w-72 -translate-x-1/2 -translate-y-full gap-1.5 rounded-lg border border-[hsl(var(--border)/var(--opacity-60))] bg-background px-3 py-1.5 text-xs shadow-md"
|
|
1136
|
+
[style.left.px]="position().x"
|
|
1137
|
+
[style.top.px]="position().y"
|
|
1138
|
+
>
|
|
1139
|
+
@if (customTpl(); as tpl) {
|
|
1140
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: p }" />
|
|
1141
|
+
} @else {
|
|
1142
|
+
@if (!hideLabel() && headerText(p); as header) {
|
|
1143
|
+
<div class="font-medium">{{ header }}</div>
|
|
1144
|
+
}
|
|
1145
|
+
<ul class="grid gap-1.5">
|
|
1146
|
+
@for (row of p.rows; track row.seriesKey) {
|
|
1147
|
+
<li class="flex w-full flex-wrap items-stretch gap-2">
|
|
1148
|
+
<span class="flex flex-1 items-center gap-1.5">
|
|
1149
|
+
@switch (indicator()) {
|
|
1150
|
+
@case ('dot') {
|
|
1151
|
+
<span
|
|
1152
|
+
class="h-2.5 w-2.5 shrink-0 rounded-sm"
|
|
1153
|
+
[style.background]="row.color"
|
|
1154
|
+
[style.borderColor]="row.color"
|
|
1155
|
+
></span>
|
|
1156
|
+
}
|
|
1157
|
+
@case ('line') {
|
|
1158
|
+
<span
|
|
1159
|
+
class="h-full min-h-4 w-1 shrink-0 rounded-sm"
|
|
1160
|
+
[style.background]="row.color"
|
|
1161
|
+
></span>
|
|
1162
|
+
}
|
|
1163
|
+
@case ('dashed') {
|
|
1164
|
+
<span
|
|
1165
|
+
class="h-0 w-3 shrink-0 self-center border-t-2 border-dashed"
|
|
1166
|
+
[style.borderColor]="row.color"
|
|
1167
|
+
></span>
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
@if (row.icon; as icon) {
|
|
1171
|
+
<span class="mr-1 inline-flex items-center text-muted-foreground">
|
|
1172
|
+
<ng-container *ngComponentOutlet="icon" />
|
|
1173
|
+
</span>
|
|
1174
|
+
}
|
|
1175
|
+
<span class="text-muted-foreground">{{ row.label }}</span>
|
|
1176
|
+
</span>
|
|
1177
|
+
<span class="font-mono font-medium tabular-nums text-foreground">
|
|
1178
|
+
{{ formatRow(row, p) }}
|
|
1179
|
+
</span>
|
|
1180
|
+
</li>
|
|
1181
|
+
}
|
|
1182
|
+
</ul>
|
|
1183
|
+
}
|
|
1184
|
+
</div>
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
<!-- Live region — announces category changes to AT. -->
|
|
1188
|
+
<div class="sr-only" aria-live="polite" aria-atomic="true">
|
|
1189
|
+
@if (payload(); as p) {
|
|
1190
|
+
{{ p.category }}
|
|
1191
|
+
}
|
|
1192
|
+
</div>
|
|
1193
|
+
`,
|
|
1194
|
+
isInline: true,
|
|
1195
|
+
dependencies: [{
|
|
1196
|
+
kind: "directive",
|
|
1197
|
+
type: NgTemplateOutlet,
|
|
1198
|
+
selector: "[ngTemplateOutlet]",
|
|
1199
|
+
inputs: [
|
|
1200
|
+
"ngTemplateOutletContext",
|
|
1201
|
+
"ngTemplateOutlet",
|
|
1202
|
+
"ngTemplateOutletInjector"
|
|
1203
|
+
]
|
|
1204
|
+
}, {
|
|
1205
|
+
kind: "directive",
|
|
1206
|
+
type: NgComponentOutlet,
|
|
1207
|
+
selector: "[ngComponentOutlet]",
|
|
1208
|
+
inputs: [
|
|
1209
|
+
"ngComponentOutlet",
|
|
1210
|
+
"ngComponentOutletInputs",
|
|
1211
|
+
"ngComponentOutletInjector",
|
|
1212
|
+
"ngComponentOutletEnvironmentInjector",
|
|
1213
|
+
"ngComponentOutletContent",
|
|
1214
|
+
"ngComponentOutletNgModule"
|
|
1215
|
+
],
|
|
1216
|
+
exportAs: ["ngComponentOutlet"]
|
|
1217
|
+
}]
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1220
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1221
|
+
minVersion: "12.0.0",
|
|
1222
|
+
version: "22.2.3",
|
|
1223
|
+
ngImport: i0,
|
|
1224
|
+
type: ChartTooltip,
|
|
1225
|
+
decorators: [{
|
|
1226
|
+
type: Component,
|
|
1227
|
+
args: [{
|
|
1228
|
+
selector: "ChartTooltip",
|
|
1229
|
+
imports: [NgTemplateOutlet, NgComponentOutlet],
|
|
1230
|
+
host: {
|
|
1231
|
+
class: "pointer-events-none absolute inset-0 z-10",
|
|
1232
|
+
"[attr.aria-hidden]": "!visible()"
|
|
1233
|
+
},
|
|
1234
|
+
template: `
|
|
1235
|
+
@if (payload(); as p) {
|
|
1236
|
+
<div
|
|
1237
|
+
role="tooltip"
|
|
1238
|
+
class="pointer-events-none absolute grid min-w-32 max-w-72 -translate-x-1/2 -translate-y-full gap-1.5 rounded-lg border border-[hsl(var(--border)/var(--opacity-60))] bg-background px-3 py-1.5 text-xs shadow-md"
|
|
1239
|
+
[style.left.px]="position().x"
|
|
1240
|
+
[style.top.px]="position().y"
|
|
1241
|
+
>
|
|
1242
|
+
@if (customTpl(); as tpl) {
|
|
1243
|
+
<ng-container *ngTemplateOutlet="tpl; context: { $implicit: p }" />
|
|
1244
|
+
} @else {
|
|
1245
|
+
@if (!hideLabel() && headerText(p); as header) {
|
|
1246
|
+
<div class="font-medium">{{ header }}</div>
|
|
1247
|
+
}
|
|
1248
|
+
<ul class="grid gap-1.5">
|
|
1249
|
+
@for (row of p.rows; track row.seriesKey) {
|
|
1250
|
+
<li class="flex w-full flex-wrap items-stretch gap-2">
|
|
1251
|
+
<span class="flex flex-1 items-center gap-1.5">
|
|
1252
|
+
@switch (indicator()) {
|
|
1253
|
+
@case ('dot') {
|
|
1254
|
+
<span
|
|
1255
|
+
class="h-2.5 w-2.5 shrink-0 rounded-sm"
|
|
1256
|
+
[style.background]="row.color"
|
|
1257
|
+
[style.borderColor]="row.color"
|
|
1258
|
+
></span>
|
|
1259
|
+
}
|
|
1260
|
+
@case ('line') {
|
|
1261
|
+
<span
|
|
1262
|
+
class="h-full min-h-4 w-1 shrink-0 rounded-sm"
|
|
1263
|
+
[style.background]="row.color"
|
|
1264
|
+
></span>
|
|
1265
|
+
}
|
|
1266
|
+
@case ('dashed') {
|
|
1267
|
+
<span
|
|
1268
|
+
class="h-0 w-3 shrink-0 self-center border-t-2 border-dashed"
|
|
1269
|
+
[style.borderColor]="row.color"
|
|
1270
|
+
></span>
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
@if (row.icon; as icon) {
|
|
1274
|
+
<span class="mr-1 inline-flex items-center text-muted-foreground">
|
|
1275
|
+
<ng-container *ngComponentOutlet="icon" />
|
|
1276
|
+
</span>
|
|
1277
|
+
}
|
|
1278
|
+
<span class="text-muted-foreground">{{ row.label }}</span>
|
|
1279
|
+
</span>
|
|
1280
|
+
<span class="font-mono font-medium tabular-nums text-foreground">
|
|
1281
|
+
{{ formatRow(row, p) }}
|
|
1282
|
+
</span>
|
|
1283
|
+
</li>
|
|
1284
|
+
}
|
|
1285
|
+
</ul>
|
|
1286
|
+
}
|
|
1287
|
+
</div>
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
<!-- Live region — announces category changes to AT. -->
|
|
1291
|
+
<div class="sr-only" aria-live="polite" aria-atomic="true">
|
|
1292
|
+
@if (payload(); as p) {
|
|
1293
|
+
{{ p.category }}
|
|
1294
|
+
}
|
|
1295
|
+
</div>
|
|
1296
|
+
`
|
|
1297
|
+
}]
|
|
1298
|
+
}],
|
|
1299
|
+
ctorParameters: () => [],
|
|
1300
|
+
propDecorators: {
|
|
1301
|
+
xKey: [{
|
|
1302
|
+
type: i0.Input,
|
|
1303
|
+
args: [{
|
|
1304
|
+
isSignal: true,
|
|
1305
|
+
alias: "xKey",
|
|
1306
|
+
required: false
|
|
1307
|
+
}]
|
|
1308
|
+
}],
|
|
1309
|
+
data: [{
|
|
1310
|
+
type: i0.Input,
|
|
1311
|
+
args: [{
|
|
1312
|
+
isSignal: true,
|
|
1313
|
+
alias: "data",
|
|
1314
|
+
required: false
|
|
1315
|
+
}]
|
|
1316
|
+
}],
|
|
1317
|
+
valueKey: [{
|
|
1318
|
+
type: i0.Input,
|
|
1319
|
+
args: [{
|
|
1320
|
+
isSignal: true,
|
|
1321
|
+
alias: "valueKey",
|
|
1322
|
+
required: false
|
|
1323
|
+
}]
|
|
1324
|
+
}],
|
|
1325
|
+
indicator: [{
|
|
1326
|
+
type: i0.Input,
|
|
1327
|
+
args: [{
|
|
1328
|
+
isSignal: true,
|
|
1329
|
+
alias: "indicator",
|
|
1330
|
+
required: false
|
|
1331
|
+
}]
|
|
1332
|
+
}],
|
|
1333
|
+
hideLabel: [{
|
|
1334
|
+
type: i0.Input,
|
|
1335
|
+
args: [{
|
|
1336
|
+
isSignal: true,
|
|
1337
|
+
alias: "hideLabel",
|
|
1338
|
+
required: false
|
|
1339
|
+
}]
|
|
1340
|
+
}],
|
|
1341
|
+
label: [{
|
|
1342
|
+
type: i0.Input,
|
|
1343
|
+
args: [{
|
|
1344
|
+
isSignal: true,
|
|
1345
|
+
alias: "label",
|
|
1346
|
+
required: false
|
|
1347
|
+
}]
|
|
1348
|
+
}],
|
|
1349
|
+
labelKey: [{
|
|
1350
|
+
type: i0.Input,
|
|
1351
|
+
args: [{
|
|
1352
|
+
isSignal: true,
|
|
1353
|
+
alias: "labelKey",
|
|
1354
|
+
required: false
|
|
1355
|
+
}]
|
|
1356
|
+
}],
|
|
1357
|
+
labelFormatter: [{
|
|
1358
|
+
type: i0.Input,
|
|
1359
|
+
args: [{
|
|
1360
|
+
isSignal: true,
|
|
1361
|
+
alias: "labelFormatter",
|
|
1362
|
+
required: false
|
|
1363
|
+
}]
|
|
1364
|
+
}],
|
|
1365
|
+
formatter: [{
|
|
1366
|
+
type: i0.Input,
|
|
1367
|
+
args: [{
|
|
1368
|
+
isSignal: true,
|
|
1369
|
+
alias: "formatter",
|
|
1370
|
+
required: false
|
|
1371
|
+
}]
|
|
1372
|
+
}],
|
|
1373
|
+
customTpl: [{
|
|
1374
|
+
type: i0.ContentChild,
|
|
1375
|
+
args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
|
|
1376
|
+
}]
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
var ChartLegend = class ChartLegend {
|
|
1380
|
+
root = inject(ChartContext);
|
|
1381
|
+
items = computed(() => {
|
|
1382
|
+
const cfg = this.root.config();
|
|
1383
|
+
const hidden = this.root.hiddenSeries();
|
|
1384
|
+
return this.root.seriesKeys().map((key) => ({
|
|
1385
|
+
seriesKey: key,
|
|
1386
|
+
label: cfg[key]?.label ?? key,
|
|
1387
|
+
color: seriesColorVar(key),
|
|
1388
|
+
hidden: hidden.has(key)
|
|
1389
|
+
}));
|
|
1390
|
+
}, ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
1391
|
+
toggle(key) {
|
|
1392
|
+
this.root.toggleSeries(key);
|
|
1393
|
+
}
|
|
1394
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1395
|
+
minVersion: "12.0.0",
|
|
1396
|
+
version: "22.2.3",
|
|
1397
|
+
ngImport: i0,
|
|
1398
|
+
type: ChartLegend,
|
|
1399
|
+
deps: [],
|
|
1400
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1401
|
+
});
|
|
1402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1403
|
+
minVersion: "17.0.0",
|
|
1404
|
+
version: "22.2.3",
|
|
1405
|
+
type: ChartLegend,
|
|
1406
|
+
isStandalone: true,
|
|
1407
|
+
selector: "ChartLegend",
|
|
1408
|
+
host: { classAttribute: "block pt-3" },
|
|
1409
|
+
ngImport: i0,
|
|
1410
|
+
template: `
|
|
1411
|
+
<ul
|
|
1412
|
+
class="flex flex-wrap items-center justify-center gap-3 text-xs"
|
|
1413
|
+
aria-label="Toggle chart series visibility"
|
|
1414
|
+
>
|
|
1415
|
+
@for (item of items(); track item.seriesKey) {
|
|
1416
|
+
<li>
|
|
1417
|
+
<button
|
|
1418
|
+
type="button"
|
|
1419
|
+
class="inline-flex min-h-11 items-center gap-2 rounded-md px-2.5 py-1.5 outline-none transition-opacity focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
1420
|
+
[class.opacity-50]="item.hidden"
|
|
1421
|
+
[attr.aria-pressed]="!item.hidden"
|
|
1422
|
+
[attr.aria-label]="(item.hidden ? 'Show ' : 'Hide ') + item.label"
|
|
1423
|
+
(click)="toggle(item.seriesKey)"
|
|
1424
|
+
>
|
|
1425
|
+
<span
|
|
1426
|
+
class="inline-block h-2.5 w-2.5 rounded-sm"
|
|
1427
|
+
[style.background]="item.color"
|
|
1428
|
+
></span>
|
|
1429
|
+
<span class="text-muted-foreground">{{ item.label }}</span>
|
|
1430
|
+
</button>
|
|
1431
|
+
</li>
|
|
1432
|
+
}
|
|
1433
|
+
</ul>
|
|
1434
|
+
`,
|
|
1435
|
+
isInline: true
|
|
1436
|
+
});
|
|
1437
|
+
};
|
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1439
|
+
minVersion: "12.0.0",
|
|
1440
|
+
version: "22.2.3",
|
|
1441
|
+
ngImport: i0,
|
|
1442
|
+
type: ChartLegend,
|
|
1443
|
+
decorators: [{
|
|
1444
|
+
type: Component,
|
|
1445
|
+
args: [{
|
|
1446
|
+
selector: "ChartLegend",
|
|
1447
|
+
host: { class: "block pt-3" },
|
|
1448
|
+
template: `
|
|
1449
|
+
<ul
|
|
1450
|
+
class="flex flex-wrap items-center justify-center gap-3 text-xs"
|
|
1451
|
+
aria-label="Toggle chart series visibility"
|
|
1452
|
+
>
|
|
1453
|
+
@for (item of items(); track item.seriesKey) {
|
|
1454
|
+
<li>
|
|
1455
|
+
<button
|
|
1456
|
+
type="button"
|
|
1457
|
+
class="inline-flex min-h-11 items-center gap-2 rounded-md px-2.5 py-1.5 outline-none transition-opacity focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
1458
|
+
[class.opacity-50]="item.hidden"
|
|
1459
|
+
[attr.aria-pressed]="!item.hidden"
|
|
1460
|
+
[attr.aria-label]="(item.hidden ? 'Show ' : 'Hide ') + item.label"
|
|
1461
|
+
(click)="toggle(item.seriesKey)"
|
|
1462
|
+
>
|
|
1463
|
+
<span
|
|
1464
|
+
class="inline-block h-2.5 w-2.5 rounded-sm"
|
|
1465
|
+
[style.background]="item.color"
|
|
1466
|
+
></span>
|
|
1467
|
+
<span class="text-muted-foreground">{{ item.label }}</span>
|
|
1468
|
+
</button>
|
|
1469
|
+
</li>
|
|
1470
|
+
}
|
|
1471
|
+
</ul>
|
|
1472
|
+
`
|
|
1473
|
+
}]
|
|
1474
|
+
}]
|
|
1475
|
+
});
|
|
1476
|
+
function formatNumber(value) {
|
|
1477
|
+
return Math.abs(value) >= 10 ? value.toFixed(0) : value.toFixed(1);
|
|
1478
|
+
}
|
|
1479
|
+
var ChartZoomControls = class ChartZoomControls {
|
|
1480
|
+
categorical = inject(CategoricalViewportContext, { optional: true });
|
|
1481
|
+
scatter = inject(ScatterViewportContext, { optional: true });
|
|
1482
|
+
status = computed(() => {
|
|
1483
|
+
if (this.categorical?.hasZoom()) {
|
|
1484
|
+
const count = this.categorical.dataCount();
|
|
1485
|
+
const range = effectiveIndexRange(this.categorical.zoomRange(), count);
|
|
1486
|
+
if (!range) return null;
|
|
1487
|
+
return `Showing ${range.startIndex + 1}-${range.endIndex + 1} of ${count}`;
|
|
1488
|
+
}
|
|
1489
|
+
if (this.scatter?.hasZoom()) {
|
|
1490
|
+
const xDomain = this.scatter.zoomXDomain() ?? this.scatter.fullXDomain();
|
|
1491
|
+
const yDomain = this.scatter.zoomYDomain() ?? this.scatter.fullYDomain();
|
|
1492
|
+
if (!xDomain || !yDomain) return null;
|
|
1493
|
+
return `X ${formatNumber(xDomain[0])}-${formatNumber(xDomain[1])} · Y ${formatNumber(yDomain[0])}-${formatNumber(yDomain[1])}`;
|
|
1494
|
+
}
|
|
1495
|
+
return null;
|
|
1496
|
+
}, ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
|
|
1497
|
+
hint = computed(() => {
|
|
1498
|
+
if (this.scatter) return "Drag to brush a region. Use the wheel to zoom and one-finger touch drag to pan while zoomed.";
|
|
1499
|
+
return "Drag to select a category range. Use the wheel to zoom and one-finger touch drag to pan while zoomed.";
|
|
1500
|
+
}, ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
|
|
1501
|
+
resetZoom() {
|
|
1502
|
+
this.categorical?.resetZoom();
|
|
1503
|
+
this.scatter?.resetZoom();
|
|
1504
|
+
}
|
|
1505
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1506
|
+
minVersion: "12.0.0",
|
|
1507
|
+
version: "22.2.3",
|
|
1508
|
+
ngImport: i0,
|
|
1509
|
+
type: ChartZoomControls,
|
|
1510
|
+
deps: [],
|
|
1511
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1512
|
+
});
|
|
1513
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1514
|
+
minVersion: "17.0.0",
|
|
1515
|
+
version: "22.2.3",
|
|
1516
|
+
type: ChartZoomControls,
|
|
1517
|
+
isStandalone: true,
|
|
1518
|
+
selector: "ChartZoomControls",
|
|
1519
|
+
host: { classAttribute: "mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-foreground" },
|
|
1520
|
+
ngImport: i0,
|
|
1521
|
+
template: `
|
|
1522
|
+
<p>{{ hint() }}</p>
|
|
1523
|
+
|
|
1524
|
+
@if (status(); as currentStatus) {
|
|
1525
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
1526
|
+
<span
|
|
1527
|
+
class="rounded-full border border-border bg-background px-2.5 py-1 font-medium text-foreground"
|
|
1528
|
+
>
|
|
1529
|
+
{{ currentStatus }}
|
|
1530
|
+
</span>
|
|
1531
|
+
<button
|
|
1532
|
+
type="button"
|
|
1533
|
+
class="inline-flex min-h-11 items-center rounded-md border border-border bg-background px-3 text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
1534
|
+
(click)="resetZoom()"
|
|
1535
|
+
>
|
|
1536
|
+
Reset zoom
|
|
1537
|
+
</button>
|
|
1538
|
+
</div>
|
|
1539
|
+
}
|
|
1540
|
+
`,
|
|
1541
|
+
isInline: true
|
|
1542
|
+
});
|
|
1543
|
+
};
|
|
1544
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1545
|
+
minVersion: "12.0.0",
|
|
1546
|
+
version: "22.2.3",
|
|
1547
|
+
ngImport: i0,
|
|
1548
|
+
type: ChartZoomControls,
|
|
1549
|
+
decorators: [{
|
|
1550
|
+
type: Component,
|
|
1551
|
+
args: [{
|
|
1552
|
+
selector: "ChartZoomControls",
|
|
1553
|
+
host: { class: "mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-foreground" },
|
|
1554
|
+
template: `
|
|
1555
|
+
<p>{{ hint() }}</p>
|
|
1556
|
+
|
|
1557
|
+
@if (status(); as currentStatus) {
|
|
1558
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
1559
|
+
<span
|
|
1560
|
+
class="rounded-full border border-border bg-background px-2.5 py-1 font-medium text-foreground"
|
|
1561
|
+
>
|
|
1562
|
+
{{ currentStatus }}
|
|
1563
|
+
</span>
|
|
1564
|
+
<button
|
|
1565
|
+
type="button"
|
|
1566
|
+
class="inline-flex min-h-11 items-center rounded-md border border-border bg-background px-3 text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
1567
|
+
(click)="resetZoom()"
|
|
1568
|
+
>
|
|
1569
|
+
Reset zoom
|
|
1570
|
+
</button>
|
|
1571
|
+
</div>
|
|
1572
|
+
}
|
|
1573
|
+
`
|
|
1574
|
+
}]
|
|
1575
|
+
}]
|
|
1576
|
+
});
|
|
1577
|
+
var PieCenter = class PieCenter {
|
|
1578
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1579
|
+
minVersion: "12.0.0",
|
|
1580
|
+
version: "22.2.3",
|
|
1581
|
+
ngImport: i0,
|
|
1582
|
+
type: PieCenter,
|
|
1583
|
+
deps: [],
|
|
1584
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1585
|
+
});
|
|
1586
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1587
|
+
minVersion: "14.0.0",
|
|
1588
|
+
version: "22.2.3",
|
|
1589
|
+
type: PieCenter,
|
|
1590
|
+
isStandalone: true,
|
|
1591
|
+
selector: "ChartPieCenter",
|
|
1592
|
+
host: { classAttribute: "flex max-w-40 flex-col items-center justify-center text-center" },
|
|
1593
|
+
ngImport: i0,
|
|
1594
|
+
template: `<ng-content />`,
|
|
1595
|
+
isInline: true
|
|
1596
|
+
});
|
|
1597
|
+
};
|
|
1598
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1599
|
+
minVersion: "12.0.0",
|
|
1600
|
+
version: "22.2.3",
|
|
1601
|
+
ngImport: i0,
|
|
1602
|
+
type: PieCenter,
|
|
1603
|
+
decorators: [{
|
|
1604
|
+
type: Component,
|
|
1605
|
+
args: [{
|
|
1606
|
+
selector: "ChartPieCenter",
|
|
1607
|
+
host: { class: "flex max-w-40 flex-col items-center justify-center text-center" },
|
|
1608
|
+
template: `<ng-content />`
|
|
1609
|
+
}]
|
|
1610
|
+
}]
|
|
1611
|
+
});
|
|
1612
|
+
var RadialCenter = class RadialCenter {
|
|
1613
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1614
|
+
minVersion: "12.0.0",
|
|
1615
|
+
version: "22.2.3",
|
|
1616
|
+
ngImport: i0,
|
|
1617
|
+
type: RadialCenter,
|
|
1618
|
+
deps: [],
|
|
1619
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1620
|
+
});
|
|
1621
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1622
|
+
minVersion: "14.0.0",
|
|
1623
|
+
version: "22.2.3",
|
|
1624
|
+
type: RadialCenter,
|
|
1625
|
+
isStandalone: true,
|
|
1626
|
+
selector: "ChartRadialCenter",
|
|
1627
|
+
host: { classAttribute: "flex max-w-40 flex-col items-center justify-center text-center" },
|
|
1628
|
+
ngImport: i0,
|
|
1629
|
+
template: `<ng-content />`,
|
|
1630
|
+
isInline: true
|
|
1631
|
+
});
|
|
1632
|
+
};
|
|
1633
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1634
|
+
minVersion: "12.0.0",
|
|
1635
|
+
version: "22.2.3",
|
|
1636
|
+
ngImport: i0,
|
|
1637
|
+
type: RadialCenter,
|
|
1638
|
+
decorators: [{
|
|
1639
|
+
type: Component,
|
|
1640
|
+
args: [{
|
|
1641
|
+
selector: "ChartRadialCenter",
|
|
1642
|
+
host: { class: "flex max-w-40 flex-col items-center justify-center text-center" },
|
|
1643
|
+
template: `<ng-content />`
|
|
1644
|
+
}]
|
|
1645
|
+
}]
|
|
1646
|
+
});
|
|
1647
|
+
export { ChartAxisX, ChartAxisY, ChartBrush, ChartCrosshair, ChartGrid, ChartLegend, ChartPointerTracker, ChartTooltip, ChartZoomControls, PieCenter, RadialCenter };
|