@ojiepermana/angular 22.1.10 → 22.1.12
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/README.md +32 -26
- 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 +137 -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 +147 -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 +25 -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/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- 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 +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -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 +165 -0
- package/theme/styles/css/base/theme.css +373 -0
- package/theme/styles/css/base/tokens.css +361 -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/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/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -1,7 +1,298 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, input, output, computed, Component } from '@angular/core';
|
|
3
|
+
import { ChartContext, CartesianContext, CategoricalViewportContext, resolveChartStyle, ChartThemeSpace, resolveChartMargin, DEFAULT_CARTESIAN_MARGIN_UNITS, setupCartesianChart, provideCartesianFromLineLayout, computeLineLayout, resolveSeriesColor, ChartRovingFocus, ChartMarkFocus, ChartDataTable } from '@ojiepermana/angular/chart/core';
|
|
4
|
+
export { buildCartesianScales, cloneLinear, computeAreaLayout, computeLineLayout, pointToBandAdapter, provideCartesianFromLineLayout } from '@ojiepermana/angular/chart/core';
|
|
5
|
+
import { ChartPointerTracker } from '@ojiepermana/angular/chart/primitives';
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
const defaultLineValueFormatter = (value) => `${value}`;
|
|
8
|
+
class LineChart {
|
|
9
|
+
root = inject(ChartContext);
|
|
10
|
+
cart = inject(CartesianContext);
|
|
11
|
+
viewport = inject(CategoricalViewportContext);
|
|
12
|
+
data = input.required(/* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
14
|
+
xKey = input.required(/* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "xKey" }] : /* istanbul ignore next */ []));
|
|
16
|
+
orientation = input('vertical', /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
18
|
+
/**
|
|
19
|
+
* Presentational style of the chart.
|
|
20
|
+
*
|
|
21
|
+
* Replaces `styles`, which read like a CSS styles bag rather than a single
|
|
22
|
+
* variant. Named `styleVariant` and not `variant` because `ChartBar` already
|
|
23
|
+
* publishes a `variant` input for its grouped versus stacked axis, and one
|
|
24
|
+
* name cannot mean two things across the family.
|
|
25
|
+
*/
|
|
26
|
+
styleVariant = input(undefined, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "styleVariant" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `styleVariant`. Still fully supported; when both are bound,
|
|
30
|
+
* `styleVariant` wins. Due for removal in the next major.
|
|
31
|
+
*/
|
|
32
|
+
styles = input('base', /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** The style actually in effect. Bind this, never `styles()`. */
|
|
35
|
+
chartStyle = resolveChartStyle(this.styleVariant, this.styles);
|
|
36
|
+
curve = input('monotone', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
38
|
+
themeSpace = inject(ChartThemeSpace);
|
|
39
|
+
/**
|
|
40
|
+
* Plot gutters. Leave it unset and they follow the theme-space density
|
|
41
|
+
* axis; set it and your numbers win, unchanged, whatever the axis says.
|
|
42
|
+
*/
|
|
43
|
+
margin = input(null, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "margin" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/** The margin actually in effect. Bind this, never `margin()`. */
|
|
46
|
+
plotMargin = resolveChartMargin(this.margin, DEFAULT_CARTESIAN_MARGIN_UNITS, this.themeSpace);
|
|
47
|
+
strokeWidth = input(2, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
|
|
49
|
+
showDots = input(true, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "showDots" }] : /* istanbul ignore next */ []));
|
|
51
|
+
dotRadius = input(3, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "dotRadius" }] : /* istanbul ignore next */ []));
|
|
53
|
+
dotColorKey = input(undefined, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "dotColorKey" }] : /* istanbul ignore next */ []));
|
|
55
|
+
dotStrokeColor = input(undefined, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "dotStrokeColor" }] : /* istanbul ignore next */ []));
|
|
57
|
+
dotStrokeWidth = input(0, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "dotStrokeWidth" }] : /* istanbul ignore next */ []));
|
|
59
|
+
showValueLabels = input(false, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "showValueLabels" }] : /* istanbul ignore next */ []));
|
|
61
|
+
valueLabelFormat = input(defaultLineValueFormatter, /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "valueLabelFormat" }] : /* istanbul ignore next */ []));
|
|
63
|
+
pointClick = output();
|
|
64
|
+
/**
|
|
65
|
+
* The shared cartesian scaffolding: geometry, the index window, the layout
|
|
66
|
+
* effect, and the click plus active-point plus aria-label handlers.
|
|
67
|
+
*
|
|
68
|
+
* Declared before `layout` because the layout computed reads its geometry.
|
|
69
|
+
*/
|
|
70
|
+
cx = setupCartesianChart({
|
|
71
|
+
data: () => this.data(),
|
|
72
|
+
margin: () => this.plotMargin(),
|
|
73
|
+
cartesian: { context: this.cart, orientation: () => this.orientation() },
|
|
74
|
+
viewport: this.viewport,
|
|
75
|
+
publishLayout: (inner) => provideCartesianFromLineLayout(this.cart, this.layout(), this.orientation(), inner.width, inner.height),
|
|
76
|
+
click: {
|
|
77
|
+
emit: (event) => this.pointClick.emit(event),
|
|
78
|
+
payload: (point, datumIndex, datum) => ({
|
|
79
|
+
seriesKey: point.seriesKey,
|
|
80
|
+
datumIndex,
|
|
81
|
+
category: point.category,
|
|
82
|
+
value: point.value,
|
|
83
|
+
datum,
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
ariaLabel: (point, label) => `${label} at ${point.category}: ${point.value}`,
|
|
87
|
+
});
|
|
88
|
+
layout = computed(() => computeLineLayout({
|
|
89
|
+
data: this.cx.visibleData(),
|
|
90
|
+
xKey: this.xKey(),
|
|
91
|
+
seriesKeys: this.root.visibleSeriesKeys(),
|
|
92
|
+
orientation: this.orientation(),
|
|
93
|
+
innerWidth: this.cx.innerWidth(),
|
|
94
|
+
innerHeight: this.cx.innerHeight(),
|
|
95
|
+
curve: this.curve(),
|
|
96
|
+
}), /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
98
|
+
series = computed(() => this.layout().series, /* @ts-ignore */
|
|
99
|
+
...(ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []));
|
|
100
|
+
ariaSummary = computed(() => {
|
|
101
|
+
const keys = this.root.visibleSeriesKeys();
|
|
102
|
+
return `Line chart, ${this.cx.visibleData().length} points, ${keys.length} series: ${keys.join(', ')}.`;
|
|
103
|
+
}, /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "ariaSummary" }] : /* istanbul ignore next */ []));
|
|
105
|
+
dataColumns = computed(() => [this.xKey(), ...this.root.visibleSeriesKeys()], /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "dataColumns" }] : /* istanbul ignore next */ []));
|
|
107
|
+
dotFill(point, fallbackColor) {
|
|
108
|
+
const colorKey = this.dotColorKey();
|
|
109
|
+
if (!colorKey) {
|
|
110
|
+
return fallbackColor;
|
|
111
|
+
}
|
|
112
|
+
// `point.datumIndex` is VISIBLE-relative here, unlike in emitClick where it is
|
|
113
|
+
// made absolute. The dot being painted is the one in the current window.
|
|
114
|
+
return resolveSeriesColor(this.cx.visibleData()[point.datumIndex]?.[colorKey], fallbackColor);
|
|
115
|
+
}
|
|
116
|
+
formatValueLabel(point) {
|
|
117
|
+
return this.valueLabelFormat()(point.value);
|
|
118
|
+
}
|
|
119
|
+
labelX(point) {
|
|
120
|
+
return this.orientation() === 'vertical' ? point.x : point.x + this.dotRadius() + 6;
|
|
121
|
+
}
|
|
122
|
+
labelY(point) {
|
|
123
|
+
return this.orientation() === 'vertical' ? point.y - this.dotRadius() - 8 : point.y;
|
|
124
|
+
}
|
|
125
|
+
labelAnchor() {
|
|
126
|
+
return this.orientation() === 'vertical' ? 'middle' : 'start';
|
|
127
|
+
}
|
|
128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: LineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: LineChart, isStandalone: true, selector: "ChartLine", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, xKey: { classPropertyName: "xKey", publicName: "xKey", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, styleVariant: { classPropertyName: "styleVariant", publicName: "styleVariant", isSignal: true, isRequired: false, transformFunction: null }, styles: { classPropertyName: "styles", publicName: "styles", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showDots: { classPropertyName: "showDots", publicName: "showDots", isSignal: true, isRequired: false, transformFunction: null }, dotRadius: { classPropertyName: "dotRadius", publicName: "dotRadius", isSignal: true, isRequired: false, transformFunction: null }, dotColorKey: { classPropertyName: "dotColorKey", publicName: "dotColorKey", isSignal: true, isRequired: false, transformFunction: null }, dotStrokeColor: { classPropertyName: "dotStrokeColor", publicName: "dotStrokeColor", isSignal: true, isRequired: false, transformFunction: null }, dotStrokeWidth: { classPropertyName: "dotStrokeWidth", publicName: "dotStrokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showValueLabels: { classPropertyName: "showValueLabels", publicName: "showValueLabels", isSignal: true, isRequired: false, transformFunction: null }, valueLabelFormat: { classPropertyName: "valueLabelFormat", publicName: "valueLabelFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointClick: "pointClick" }, host: { properties: { "attr.data-style": "chartStyle()" }, classAttribute: "relative block h-full w-full" }, providers: [CartesianContext, CategoricalViewportContext], ngImport: i0, template: `
|
|
130
|
+
<svg:svg
|
|
131
|
+
ChartPointerTracker
|
|
132
|
+
ChartRovingFocus
|
|
133
|
+
class="block h-full w-full overflow-visible"
|
|
134
|
+
[attr.viewBox]="cx.viewBox()"
|
|
135
|
+
preserveAspectRatio="none"
|
|
136
|
+
role="img"
|
|
137
|
+
[attr.aria-label]="ariaSummary()"
|
|
138
|
+
>
|
|
139
|
+
<svg:g [attr.transform]="cx.innerTransform()">
|
|
140
|
+
<!-- The brush hitbox is slotted first so it sits UNDER the marks: it is
|
|
141
|
+
a hit-testable rect, and on top it swallowed every click, hover and
|
|
142
|
+
cursor affordance the dots publish. -->
|
|
143
|
+
<ng-content select="svg:g[ChartBrush]" />
|
|
144
|
+
<ng-content select="svg\\:g[ChartGrid]" />
|
|
145
|
+
<svg:g class="chart-lines">
|
|
146
|
+
@for (s of series(); track s.seriesKey) {
|
|
147
|
+
<svg:path
|
|
148
|
+
class="chart-line"
|
|
149
|
+
fill="none"
|
|
150
|
+
stroke-linecap="round"
|
|
151
|
+
stroke-linejoin="round"
|
|
152
|
+
[attr.stroke]="s.color"
|
|
153
|
+
[attr.stroke-width]="strokeWidth()"
|
|
154
|
+
[attr.d]="s.linePath"
|
|
155
|
+
/>
|
|
156
|
+
@if (showDots()) {
|
|
157
|
+
@for (p of s.points; track p.datumIndex) {
|
|
158
|
+
<svg:circle
|
|
159
|
+
ChartMarkFocus
|
|
160
|
+
class="chart-dot cursor-pointer"
|
|
161
|
+
[attr.cx]="p.x"
|
|
162
|
+
[attr.cy]="p.y"
|
|
163
|
+
[attr.r]="dotRadius()"
|
|
164
|
+
[attr.fill]="dotFill(p, s.color)"
|
|
165
|
+
[attr.stroke]="dotStrokeColor()"
|
|
166
|
+
[attr.stroke-width]="dotStrokeWidth() || null"
|
|
167
|
+
[attr.aria-label]="cx.pointAriaLabel(p)"
|
|
168
|
+
role="img"
|
|
169
|
+
tabindex="0"
|
|
170
|
+
(focus)="cx.setActivePoint($event, p)"
|
|
171
|
+
(blur)="cx.clearActivePoint()"
|
|
172
|
+
(click)="cx.emitClick(p)"
|
|
173
|
+
(keydown.enter)="cx.emitClick(p)"
|
|
174
|
+
(keydown.space)="cx.emitClick(p); $event.preventDefault()"
|
|
175
|
+
/>
|
|
176
|
+
@if (showValueLabels()) {
|
|
177
|
+
<svg:text
|
|
178
|
+
class="chart-line-value pointer-events-none fill-muted-foreground text-2xs"
|
|
179
|
+
[attr.x]="labelX(p)"
|
|
180
|
+
[attr.y]="labelY(p)"
|
|
181
|
+
[attr.text-anchor]="labelAnchor()"
|
|
182
|
+
dominant-baseline="middle"
|
|
183
|
+
>
|
|
184
|
+
{{ formatValueLabel(p) }}
|
|
185
|
+
</svg:text>
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
</svg:g>
|
|
191
|
+
<ng-content select="svg\\:g[ChartAxisX]" />
|
|
192
|
+
<ng-content select="svg\\:g[ChartAxisY]" />
|
|
193
|
+
<ng-content select="svg\\:g[ChartCrosshair]" />
|
|
194
|
+
</svg:g>
|
|
195
|
+
</svg:svg>
|
|
196
|
+
<ng-content select="ChartTooltip" />
|
|
197
|
+
<ng-content select="ChartLegend" />
|
|
198
|
+
<ng-content select="ChartZoomControls" />
|
|
199
|
+
<ChartDataTable
|
|
200
|
+
[data]="cx.visibleData()"
|
|
201
|
+
[columns]="dataColumns()"
|
|
202
|
+
[rowHeaderKey]="xKey()"
|
|
203
|
+
[label]="ariaSummary()"
|
|
204
|
+
/>
|
|
205
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: ChartPointerTracker, selector: "svg:svg[ChartPointerTracker]" }, { kind: "directive", type: ChartRovingFocus, selector: "svg[ChartRovingFocus]" }, { kind: "directive", type: ChartMarkFocus, selector: "[ChartMarkFocus]" }, { kind: "component", type: ChartDataTable, selector: "ChartDataTable", inputs: ["data", "columns", "label", "rowHeaderKey"] }] });
|
|
206
|
+
}
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: LineChart, decorators: [{
|
|
208
|
+
type: Component,
|
|
209
|
+
args: [{
|
|
210
|
+
selector: 'ChartLine',
|
|
211
|
+
providers: [CartesianContext, CategoricalViewportContext],
|
|
212
|
+
imports: [ChartPointerTracker, ChartRovingFocus, ChartMarkFocus, ChartDataTable],
|
|
213
|
+
host: { class: 'relative block h-full w-full', '[attr.data-style]': 'chartStyle()' },
|
|
214
|
+
template: `
|
|
215
|
+
<svg:svg
|
|
216
|
+
ChartPointerTracker
|
|
217
|
+
ChartRovingFocus
|
|
218
|
+
class="block h-full w-full overflow-visible"
|
|
219
|
+
[attr.viewBox]="cx.viewBox()"
|
|
220
|
+
preserveAspectRatio="none"
|
|
221
|
+
role="img"
|
|
222
|
+
[attr.aria-label]="ariaSummary()"
|
|
223
|
+
>
|
|
224
|
+
<svg:g [attr.transform]="cx.innerTransform()">
|
|
225
|
+
<!-- The brush hitbox is slotted first so it sits UNDER the marks: it is
|
|
226
|
+
a hit-testable rect, and on top it swallowed every click, hover and
|
|
227
|
+
cursor affordance the dots publish. -->
|
|
228
|
+
<ng-content select="svg:g[ChartBrush]" />
|
|
229
|
+
<ng-content select="svg\\:g[ChartGrid]" />
|
|
230
|
+
<svg:g class="chart-lines">
|
|
231
|
+
@for (s of series(); track s.seriesKey) {
|
|
232
|
+
<svg:path
|
|
233
|
+
class="chart-line"
|
|
234
|
+
fill="none"
|
|
235
|
+
stroke-linecap="round"
|
|
236
|
+
stroke-linejoin="round"
|
|
237
|
+
[attr.stroke]="s.color"
|
|
238
|
+
[attr.stroke-width]="strokeWidth()"
|
|
239
|
+
[attr.d]="s.linePath"
|
|
240
|
+
/>
|
|
241
|
+
@if (showDots()) {
|
|
242
|
+
@for (p of s.points; track p.datumIndex) {
|
|
243
|
+
<svg:circle
|
|
244
|
+
ChartMarkFocus
|
|
245
|
+
class="chart-dot cursor-pointer"
|
|
246
|
+
[attr.cx]="p.x"
|
|
247
|
+
[attr.cy]="p.y"
|
|
248
|
+
[attr.r]="dotRadius()"
|
|
249
|
+
[attr.fill]="dotFill(p, s.color)"
|
|
250
|
+
[attr.stroke]="dotStrokeColor()"
|
|
251
|
+
[attr.stroke-width]="dotStrokeWidth() || null"
|
|
252
|
+
[attr.aria-label]="cx.pointAriaLabel(p)"
|
|
253
|
+
role="img"
|
|
254
|
+
tabindex="0"
|
|
255
|
+
(focus)="cx.setActivePoint($event, p)"
|
|
256
|
+
(blur)="cx.clearActivePoint()"
|
|
257
|
+
(click)="cx.emitClick(p)"
|
|
258
|
+
(keydown.enter)="cx.emitClick(p)"
|
|
259
|
+
(keydown.space)="cx.emitClick(p); $event.preventDefault()"
|
|
260
|
+
/>
|
|
261
|
+
@if (showValueLabels()) {
|
|
262
|
+
<svg:text
|
|
263
|
+
class="chart-line-value pointer-events-none fill-muted-foreground text-2xs"
|
|
264
|
+
[attr.x]="labelX(p)"
|
|
265
|
+
[attr.y]="labelY(p)"
|
|
266
|
+
[attr.text-anchor]="labelAnchor()"
|
|
267
|
+
dominant-baseline="middle"
|
|
268
|
+
>
|
|
269
|
+
{{ formatValueLabel(p) }}
|
|
270
|
+
</svg:text>
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
</svg:g>
|
|
276
|
+
<ng-content select="svg\\:g[ChartAxisX]" />
|
|
277
|
+
<ng-content select="svg\\:g[ChartAxisY]" />
|
|
278
|
+
<ng-content select="svg\\:g[ChartCrosshair]" />
|
|
279
|
+
</svg:g>
|
|
280
|
+
</svg:svg>
|
|
281
|
+
<ng-content select="ChartTooltip" />
|
|
282
|
+
<ng-content select="ChartLegend" />
|
|
283
|
+
<ng-content select="ChartZoomControls" />
|
|
284
|
+
<ChartDataTable
|
|
285
|
+
[data]="cx.visibleData()"
|
|
286
|
+
[columns]="dataColumns()"
|
|
287
|
+
[rowHeaderKey]="xKey()"
|
|
288
|
+
[label]="ariaSummary()"
|
|
289
|
+
/>
|
|
290
|
+
`,
|
|
291
|
+
}]
|
|
292
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], xKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "xKey", required: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], styleVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleVariant", required: false }] }], styles: [{ type: i0.Input, args: [{ isSignal: true, alias: "styles", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], showDots: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDots", required: false }] }], dotRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotRadius", required: false }] }], dotColorKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotColorKey", required: false }] }], dotStrokeColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotStrokeColor", required: false }] }], dotStrokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotStrokeWidth", required: false }] }], showValueLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValueLabels", required: false }] }], valueLabelFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueLabelFormat", required: false }] }], pointClick: [{ type: i0.Output, args: ["pointClick"] }] } });
|
|
4
293
|
|
|
5
294
|
/**
|
|
6
295
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
export { LineChart };
|
|
@@ -1,7 +1,295 @@
|
|
|
1
|
-
|
|
1
|
+
import { pie, arc } from 'd3-shape';
|
|
2
|
+
import { readNumber, seriesColorVar, ChartContext, resolveChartStyle, ChartThemeRadius, ChartThemeSpace, resolveChartMargin, DEFAULT_POLAR_MARGIN_UNITS, setupPolarChart, ChartRovingFocus, ChartMarkFocus, ChartDataTable } from '@ojiepermana/angular/chart/core';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, input, computed, output, Component } from '@angular/core';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
function computePieLayout(input) {
|
|
7
|
+
const { data, valueKey, nameKey, seriesKeys, hiddenSeriesKeys, innerWidth, innerHeight, innerRadius, padAngle, cornerRadius, startAngle, endAngle, activeIndex, activeOffset = 12, } = input;
|
|
8
|
+
const outerRadius = Math.max(0, Math.min(innerWidth, innerHeight) / 2);
|
|
9
|
+
const centerX = innerWidth / 2;
|
|
10
|
+
const centerY = innerHeight / 2;
|
|
11
|
+
// `datumIndex` is carried through the filter, so a slice keeps addressing the
|
|
12
|
+
// row it came from however many siblings the legend has hidden.
|
|
13
|
+
const entries = data
|
|
14
|
+
.map((datum, datumIndex) => ({
|
|
15
|
+
datum,
|
|
16
|
+
datumIndex,
|
|
17
|
+
seriesKey: seriesKeys?.[datumIndex] ?? String(datum[nameKey] ?? datumIndex),
|
|
18
|
+
}))
|
|
19
|
+
.filter((entry) => !hiddenSeriesKeys?.has(entry.seriesKey));
|
|
20
|
+
if (entries.length === 0 || outerRadius === 0) {
|
|
21
|
+
return { slices: [], centerX, centerY, outerRadius };
|
|
22
|
+
}
|
|
23
|
+
const pieGen = pie()
|
|
24
|
+
.value((entry) => readNumber(entry.datum, valueKey))
|
|
25
|
+
.sort(null)
|
|
26
|
+
.padAngle(padAngle)
|
|
27
|
+
.startAngle(startAngle)
|
|
28
|
+
.endAngle(endAngle);
|
|
29
|
+
const arcGen = arc()
|
|
30
|
+
.innerRadius(innerRadius)
|
|
31
|
+
.outerRadius(outerRadius)
|
|
32
|
+
.cornerRadius(cornerRadius);
|
|
33
|
+
const arcs = pieGen(entries);
|
|
34
|
+
const slices = arcs.map((a) => {
|
|
35
|
+
const { datum: d, datumIndex, seriesKey: key } = a.data;
|
|
36
|
+
const centroid = arcGen.centroid(a);
|
|
37
|
+
const magnitude = Math.hypot(centroid[0], centroid[1]) || 1;
|
|
38
|
+
const isActive = datumIndex === activeIndex;
|
|
39
|
+
return {
|
|
40
|
+
seriesKey: key,
|
|
41
|
+
name: String(d[nameKey] ?? key),
|
|
42
|
+
value: readNumber(d, valueKey),
|
|
43
|
+
datumIndex,
|
|
44
|
+
color: seriesColorVar(key),
|
|
45
|
+
arcPath: arcGen(a) ?? '',
|
|
46
|
+
centroid,
|
|
47
|
+
startAngle: a.startAngle,
|
|
48
|
+
endAngle: a.endAngle,
|
|
49
|
+
translateX: isActive ? (centroid[0] / magnitude) * activeOffset : 0,
|
|
50
|
+
translateY: isActive ? (centroid[1] / magnitude) * activeOffset : 0,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return { slices, centerX, centerY, outerRadius };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class PieChart {
|
|
57
|
+
root = inject(ChartContext);
|
|
58
|
+
data = input.required(/* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
60
|
+
valueKey = input.required(/* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "valueKey" }] : /* istanbul ignore next */ []));
|
|
62
|
+
nameKey = input.required(/* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "nameKey" }] : /* istanbul ignore next */ []));
|
|
64
|
+
seriesKeys = input(undefined, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "seriesKeys" }] : /* istanbul ignore next */ []));
|
|
66
|
+
/**
|
|
67
|
+
* Presentational style of the chart.
|
|
68
|
+
*
|
|
69
|
+
* Replaces `styles`, which read like a CSS styles bag rather than a single
|
|
70
|
+
* variant. Named `styleVariant` and not `variant` because `ChartBar` already
|
|
71
|
+
* publishes a `variant` input for its grouped versus stacked axis, and one
|
|
72
|
+
* name cannot mean two things across the family.
|
|
73
|
+
*/
|
|
74
|
+
styleVariant = input(undefined, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "styleVariant" }] : /* istanbul ignore next */ []));
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use `styleVariant`. Still fully supported; when both are bound,
|
|
78
|
+
* `styleVariant` wins. Due for removal in the next major.
|
|
79
|
+
*/
|
|
80
|
+
styles = input('base', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/** The style actually in effect. Bind this, never `styles()`. */
|
|
83
|
+
chartStyle = resolveChartStyle(this.styleVariant, this.styles);
|
|
84
|
+
themeRadius = inject(ChartThemeRadius);
|
|
85
|
+
themeSpace = inject(ChartThemeSpace);
|
|
86
|
+
/**
|
|
87
|
+
* Plot gutters. Leave it unset and they follow the theme-space density
|
|
88
|
+
* axis; set it and your numbers win, unchanged, whatever the axis says.
|
|
89
|
+
*/
|
|
90
|
+
margin = input(null, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "margin" }] : /* istanbul ignore next */ []));
|
|
92
|
+
/** The margin actually in effect. Bind this, never `margin()`. */
|
|
93
|
+
plotMargin = resolveChartMargin(this.margin, DEFAULT_POLAR_MARGIN_UNITS, this.themeSpace);
|
|
94
|
+
innerRadius = input(0, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "innerRadius" }] : /* istanbul ignore next */ []));
|
|
96
|
+
padAngle = input(0.01, /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "padAngle" }] : /* istanbul ignore next */ []));
|
|
98
|
+
/**
|
|
99
|
+
* Slice corner radius. Unset now means "follow the theme-radius axis", the
|
|
100
|
+
* same contract `ChartBar` already offers, so a pie picks up the app's shape
|
|
101
|
+
* language instead of being the one chart that stays sharp.
|
|
102
|
+
*
|
|
103
|
+
* Zero is still available, and still means square corners: it is a real value,
|
|
104
|
+
* not the absence of one, which is why the default moved to `null`.
|
|
105
|
+
*/
|
|
106
|
+
cornerRadius = input(null, /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "cornerRadius" }] : /* istanbul ignore next */ []));
|
|
108
|
+
/** The slice corner radius actually in effect. */
|
|
109
|
+
sliceCornerRadius = computed(() => this.cornerRadius() ?? this.themeRadius.px(), /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "sliceCornerRadius" }] : /* istanbul ignore next */ []));
|
|
111
|
+
startAngle = input(-Math.PI / 2, /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "startAngle" }] : /* istanbul ignore next */ []));
|
|
113
|
+
endAngle = input((3 * Math.PI) / 2, /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "endAngle" }] : /* istanbul ignore next */ []));
|
|
115
|
+
showLabels = input(false, /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "showLabels" }] : /* istanbul ignore next */ []));
|
|
117
|
+
activeIndex = input(undefined, /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
119
|
+
activeOffset = input(12, /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "activeOffset" }] : /* istanbul ignore next */ []));
|
|
121
|
+
sliceClick = output();
|
|
122
|
+
polar = setupPolarChart({ margin: () => this.plotMargin() });
|
|
123
|
+
layout = computed(() => computePieLayout({
|
|
124
|
+
data: this.data(),
|
|
125
|
+
valueKey: this.valueKey(),
|
|
126
|
+
nameKey: this.nameKey(),
|
|
127
|
+
seriesKeys: this.seriesKeys(),
|
|
128
|
+
hiddenSeriesKeys: this.root.hiddenSeries(),
|
|
129
|
+
innerWidth: this.polar.innerWidth(),
|
|
130
|
+
innerHeight: this.polar.innerHeight(),
|
|
131
|
+
innerRadius: this.innerRadius(),
|
|
132
|
+
padAngle: this.padAngle(),
|
|
133
|
+
cornerRadius: this.sliceCornerRadius(),
|
|
134
|
+
startAngle: this.startAngle(),
|
|
135
|
+
endAngle: this.endAngle(),
|
|
136
|
+
activeIndex: this.activeIndex(),
|
|
137
|
+
activeOffset: this.activeOffset(),
|
|
138
|
+
}), /* @ts-ignore */
|
|
139
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
140
|
+
ariaSummary = computed(() => `Pie chart, ${this.layout().slices.length} slices.`, /* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [{ debugName: "ariaSummary" }] : /* istanbul ignore next */ []));
|
|
142
|
+
dataColumns = computed(() => [this.nameKey(), this.valueKey()], /* @ts-ignore */
|
|
143
|
+
...(ngDevMode ? [{ debugName: "dataColumns" }] : /* istanbul ignore next */ []));
|
|
144
|
+
sliceAriaLabel(s) {
|
|
145
|
+
return `${s.name}: ${s.value}`;
|
|
146
|
+
}
|
|
147
|
+
sliceTransform(s) {
|
|
148
|
+
return s.translateX || s.translateY ? `translate(${s.translateX}, ${s.translateY})` : null;
|
|
149
|
+
}
|
|
150
|
+
emitClick(s) {
|
|
151
|
+
this.sliceClick.emit({
|
|
152
|
+
seriesKey: s.seriesKey,
|
|
153
|
+
datumIndex: s.datumIndex,
|
|
154
|
+
// `category` is the shared name for what this family calls `name`; both are
|
|
155
|
+
// emitted so a handler written against either shape works.
|
|
156
|
+
category: s.name,
|
|
157
|
+
name: s.name,
|
|
158
|
+
value: s.value,
|
|
159
|
+
datum: this.data()[s.datumIndex],
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PieChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: PieChart, isStandalone: true, selector: "ChartPie", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, valueKey: { classPropertyName: "valueKey", publicName: "valueKey", isSignal: true, isRequired: true, transformFunction: null }, nameKey: { classPropertyName: "nameKey", publicName: "nameKey", isSignal: true, isRequired: true, transformFunction: null }, seriesKeys: { classPropertyName: "seriesKeys", publicName: "seriesKeys", isSignal: true, isRequired: false, transformFunction: null }, styleVariant: { classPropertyName: "styleVariant", publicName: "styleVariant", isSignal: true, isRequired: false, transformFunction: null }, styles: { classPropertyName: "styles", publicName: "styles", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, innerRadius: { classPropertyName: "innerRadius", publicName: "innerRadius", isSignal: true, isRequired: false, transformFunction: null }, padAngle: { classPropertyName: "padAngle", publicName: "padAngle", isSignal: true, isRequired: false, transformFunction: null }, cornerRadius: { classPropertyName: "cornerRadius", publicName: "cornerRadius", isSignal: true, isRequired: false, transformFunction: null }, startAngle: { classPropertyName: "startAngle", publicName: "startAngle", isSignal: true, isRequired: false, transformFunction: null }, endAngle: { classPropertyName: "endAngle", publicName: "endAngle", isSignal: true, isRequired: false, transformFunction: null }, showLabels: { classPropertyName: "showLabels", publicName: "showLabels", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, activeOffset: { classPropertyName: "activeOffset", publicName: "activeOffset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sliceClick: "sliceClick" }, host: { properties: { "attr.data-style": "chartStyle()" }, classAttribute: "relative block h-full w-full" }, ngImport: i0, template: `
|
|
164
|
+
<svg:svg
|
|
165
|
+
ChartRovingFocus
|
|
166
|
+
class="block h-full w-full overflow-visible"
|
|
167
|
+
[attr.viewBox]="polar.viewBox()"
|
|
168
|
+
preserveAspectRatio="xMidYMid meet"
|
|
169
|
+
role="img"
|
|
170
|
+
[attr.aria-label]="ariaSummary()"
|
|
171
|
+
>
|
|
172
|
+
<svg:g [attr.transform]="polar.innerTransform()">
|
|
173
|
+
<svg:g [attr.transform]="'translate(' + layout().centerX + ',' + layout().centerY + ')'">
|
|
174
|
+
@for (s of layout().slices; track s.seriesKey) {
|
|
175
|
+
<svg:path
|
|
176
|
+
ChartMarkFocus
|
|
177
|
+
class="chart-slice cursor-pointer transition-opacity hover:opacity-80"
|
|
178
|
+
[attr.d]="s.arcPath"
|
|
179
|
+
[attr.fill]="s.color"
|
|
180
|
+
[attr.transform]="sliceTransform(s)"
|
|
181
|
+
[attr.aria-label]="sliceAriaLabel(s)"
|
|
182
|
+
role="img"
|
|
183
|
+
tabindex="0"
|
|
184
|
+
(click)="emitClick(s)"
|
|
185
|
+
(keydown.enter)="emitClick(s)"
|
|
186
|
+
(keydown.space)="emitClick(s); $event.preventDefault()"
|
|
187
|
+
(pointerenter)="polar.setActivePoint($event, s)"
|
|
188
|
+
(pointermove)="polar.setActivePoint($event, s)"
|
|
189
|
+
(pointerleave)="polar.clearActivePoint()"
|
|
190
|
+
(focus)="polar.setActivePoint($event, s)"
|
|
191
|
+
(blur)="polar.clearActivePoint()"
|
|
192
|
+
/>
|
|
193
|
+
}
|
|
194
|
+
@if (showLabels()) {
|
|
195
|
+
@for (s of layout().slices; track s.seriesKey) {
|
|
196
|
+
<svg:text
|
|
197
|
+
class="chart-slice-label fill-foreground text-2xs"
|
|
198
|
+
text-anchor="middle"
|
|
199
|
+
dominant-baseline="middle"
|
|
200
|
+
[attr.x]="s.centroid[0] + s.translateX"
|
|
201
|
+
[attr.y]="s.centroid[1] + s.translateY"
|
|
202
|
+
>
|
|
203
|
+
{{ s.value }}
|
|
204
|
+
</svg:text>
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
</svg:g>
|
|
208
|
+
</svg:g>
|
|
209
|
+
</svg:svg>
|
|
210
|
+
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
211
|
+
<ng-content select="ChartPieCenter" />
|
|
212
|
+
</div>
|
|
213
|
+
<ng-content select="ChartTooltip" />
|
|
214
|
+
<ng-content select="ChartLegend" />
|
|
215
|
+
<ChartDataTable
|
|
216
|
+
[data]="data()"
|
|
217
|
+
[columns]="dataColumns()"
|
|
218
|
+
[rowHeaderKey]="nameKey()"
|
|
219
|
+
[label]="ariaSummary()"
|
|
220
|
+
/>
|
|
221
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: ChartRovingFocus, selector: "svg[ChartRovingFocus]" }, { kind: "directive", type: ChartMarkFocus, selector: "[ChartMarkFocus]" }, { kind: "component", type: ChartDataTable, selector: "ChartDataTable", inputs: ["data", "columns", "label", "rowHeaderKey"] }] });
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PieChart, decorators: [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{
|
|
226
|
+
selector: 'ChartPie',
|
|
227
|
+
imports: [ChartRovingFocus, ChartMarkFocus, ChartDataTable],
|
|
228
|
+
host: { class: 'relative block h-full w-full', '[attr.data-style]': 'chartStyle()' },
|
|
229
|
+
template: `
|
|
230
|
+
<svg:svg
|
|
231
|
+
ChartRovingFocus
|
|
232
|
+
class="block h-full w-full overflow-visible"
|
|
233
|
+
[attr.viewBox]="polar.viewBox()"
|
|
234
|
+
preserveAspectRatio="xMidYMid meet"
|
|
235
|
+
role="img"
|
|
236
|
+
[attr.aria-label]="ariaSummary()"
|
|
237
|
+
>
|
|
238
|
+
<svg:g [attr.transform]="polar.innerTransform()">
|
|
239
|
+
<svg:g [attr.transform]="'translate(' + layout().centerX + ',' + layout().centerY + ')'">
|
|
240
|
+
@for (s of layout().slices; track s.seriesKey) {
|
|
241
|
+
<svg:path
|
|
242
|
+
ChartMarkFocus
|
|
243
|
+
class="chart-slice cursor-pointer transition-opacity hover:opacity-80"
|
|
244
|
+
[attr.d]="s.arcPath"
|
|
245
|
+
[attr.fill]="s.color"
|
|
246
|
+
[attr.transform]="sliceTransform(s)"
|
|
247
|
+
[attr.aria-label]="sliceAriaLabel(s)"
|
|
248
|
+
role="img"
|
|
249
|
+
tabindex="0"
|
|
250
|
+
(click)="emitClick(s)"
|
|
251
|
+
(keydown.enter)="emitClick(s)"
|
|
252
|
+
(keydown.space)="emitClick(s); $event.preventDefault()"
|
|
253
|
+
(pointerenter)="polar.setActivePoint($event, s)"
|
|
254
|
+
(pointermove)="polar.setActivePoint($event, s)"
|
|
255
|
+
(pointerleave)="polar.clearActivePoint()"
|
|
256
|
+
(focus)="polar.setActivePoint($event, s)"
|
|
257
|
+
(blur)="polar.clearActivePoint()"
|
|
258
|
+
/>
|
|
259
|
+
}
|
|
260
|
+
@if (showLabels()) {
|
|
261
|
+
@for (s of layout().slices; track s.seriesKey) {
|
|
262
|
+
<svg:text
|
|
263
|
+
class="chart-slice-label fill-foreground text-2xs"
|
|
264
|
+
text-anchor="middle"
|
|
265
|
+
dominant-baseline="middle"
|
|
266
|
+
[attr.x]="s.centroid[0] + s.translateX"
|
|
267
|
+
[attr.y]="s.centroid[1] + s.translateY"
|
|
268
|
+
>
|
|
269
|
+
{{ s.value }}
|
|
270
|
+
</svg:text>
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
</svg:g>
|
|
274
|
+
</svg:g>
|
|
275
|
+
</svg:svg>
|
|
276
|
+
<div class="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
277
|
+
<ng-content select="ChartPieCenter" />
|
|
278
|
+
</div>
|
|
279
|
+
<ng-content select="ChartTooltip" />
|
|
280
|
+
<ng-content select="ChartLegend" />
|
|
281
|
+
<ChartDataTable
|
|
282
|
+
[data]="data()"
|
|
283
|
+
[columns]="dataColumns()"
|
|
284
|
+
[rowHeaderKey]="nameKey()"
|
|
285
|
+
[label]="ariaSummary()"
|
|
286
|
+
/>
|
|
287
|
+
`,
|
|
288
|
+
}]
|
|
289
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], valueKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueKey", required: true }] }], nameKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "nameKey", required: true }] }], seriesKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "seriesKeys", required: false }] }], styleVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleVariant", required: false }] }], styles: [{ type: i0.Input, args: [{ isSignal: true, alias: "styles", required: false }] }], margin: [{ type: i0.Input, args: [{ isSignal: true, alias: "margin", required: false }] }], innerRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "innerRadius", required: false }] }], padAngle: [{ type: i0.Input, args: [{ isSignal: true, alias: "padAngle", required: false }] }], cornerRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "cornerRadius", required: false }] }], startAngle: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAngle", required: false }] }], endAngle: [{ type: i0.Input, args: [{ isSignal: true, alias: "endAngle", required: false }] }], showLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabels", required: false }] }], activeIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeIndex", required: false }] }], activeOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeOffset", required: false }] }], sliceClick: [{ type: i0.Output, args: ["sliceClick"] }] } });
|
|
4
290
|
|
|
5
291
|
/**
|
|
6
292
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
export { PieChart, computePieLayout };
|