@testgorilla/tgo-ui 11.22.3 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs +335 -229
- package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs +547 -465
- package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs +160 -75
- package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs +678 -278
- package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs +337 -274
- package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs +351 -192
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs +1950 -960
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs +1206 -1044
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs +328 -182
- package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-badge.mjs +383 -203
- package/fesm2022/testgorilla-tgo-ui-components-badge.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs +553 -261
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-button.mjs +709 -739
- package/fesm2022/testgorilla-tgo-ui-components-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-card.mjs +219 -184
- package/fesm2022/testgorilla-tgo-ui-components-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs +515 -458
- package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs +423 -162
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs +10784 -10996
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs +810 -533
- package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs +473 -116
- package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs +1149 -540
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-divider.mjs +148 -84
- package/fesm2022/testgorilla-tgo-ui-components-divider.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs +239 -142
- package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs +599 -467
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs +126 -70
- package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs +324 -329
- package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs +969 -648
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs +553 -419
- package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs +847 -452
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs +398 -302
- package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs +162 -95
- package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-icon.mjs +1825 -1795
- package/fesm2022/testgorilla-tgo-ui-components-icon.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs +1018 -672
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs +758 -368
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-logo.mjs +204 -212
- package/fesm2022/testgorilla-tgo-ui-components-logo.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs +183 -48
- package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs +243 -79
- package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs +751 -361
- package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs +1122 -385
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs +689 -413
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs +227 -92
- package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs +174 -113
- package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs +367 -165
- package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs +253 -118
- package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs +730 -444
- package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs +533 -221
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs +274 -76
- package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs +184 -124
- package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs +1223 -574
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs +249 -160
- package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs +447 -439
- package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-rating.mjs +226 -150
- package/fesm2022/testgorilla-tgo-ui-components-rating.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs +255 -67
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs +205 -162
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs +245 -153
- package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs +274 -140
- package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs +319 -147
- package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs +286 -84
- package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs +660 -208
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs +579 -320
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs +419 -200
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs +132 -80
- package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs +741 -390
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs +455 -329
- package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs +543 -514
- package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs +193 -104
- package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs +760 -524
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-table.mjs +714 -415
- package/fesm2022/testgorilla-tgo-ui-components-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs +847 -438
- package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-tag.mjs +535 -275
- package/fesm2022/testgorilla-tgo-ui-components-tag.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs +316 -246
- package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs +404 -284
- package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs +664 -383
- package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs +201 -112
- package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs +1014 -458
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui.mjs +147 -155
- package/fesm2022/testgorilla-tgo-ui.mjs.map +1 -1
- package/mcp/catalog.json +1 -1
- package/package.json +16 -17
- package/projects/tgo-canopy-ui/theme/_palette.scss +23 -18
- package/types/testgorilla-tgo-ui-components-accordion.d.ts +214 -158
- package/types/testgorilla-tgo-ui-components-ai-audio-circle.d.ts +93 -69
- package/types/testgorilla-tgo-ui-components-ai-caveat.d.ts +37 -34
- package/types/testgorilla-tgo-ui-components-ai-feedback.d.ts +126 -86
- package/types/testgorilla-tgo-ui-components-alert-banner.d.ts +260 -185
- package/types/testgorilla-tgo-ui-components-audio-waveform.d.ts +96 -67
- package/types/testgorilla-tgo-ui-components-autocomplete-v2.d.ts +455 -256
- package/types/testgorilla-tgo-ui-components-autocomplete.d.ts +545 -390
- package/types/testgorilla-tgo-ui-components-avatar.d.ts +128 -102
- package/types/testgorilla-tgo-ui-components-badge.d.ts +191 -139
- package/types/testgorilla-tgo-ui-components-breadcrumb.d.ts +100 -62
- package/types/testgorilla-tgo-ui-components-button.d.ts +479 -340
- package/types/testgorilla-tgo-ui-components-card.d.ts +153 -114
- package/types/testgorilla-tgo-ui-components-checkbox.d.ts +299 -223
- package/types/testgorilla-tgo-ui-components-checklist.d.ts +149 -97
- package/types/testgorilla-tgo-ui-components-core.d.ts +307 -295
- package/types/testgorilla-tgo-ui-components-datepicker.d.ts +404 -299
- package/types/testgorilla-tgo-ui-components-device-control.d.ts +151 -81
- package/types/testgorilla-tgo-ui-components-dialog.d.ts +442 -329
- package/types/testgorilla-tgo-ui-components-divider.d.ts +64 -51
- package/types/testgorilla-tgo-ui-components-donut-chart.d.ts +41 -37
- package/types/testgorilla-tgo-ui-components-dropdown.d.ts +335 -241
- package/types/testgorilla-tgo-ui-components-elevation-shadow.d.ts +48 -43
- package/types/testgorilla-tgo-ui-components-empty-state.d.ts +317 -215
- package/types/testgorilla-tgo-ui-components-field.d.ts +559 -388
- package/types/testgorilla-tgo-ui-components-file-upload.d.ts +230 -168
- package/types/testgorilla-tgo-ui-components-filter-button.d.ts +263 -206
- package/types/testgorilla-tgo-ui-components-gaussian-chart.d.ts +107 -94
- package/types/testgorilla-tgo-ui-components-icon-label.d.ts +84 -61
- package/types/testgorilla-tgo-ui-components-icon.d.ts +137 -110
- package/types/testgorilla-tgo-ui-components-infinite-scroll-table.d.ts +429 -303
- package/types/testgorilla-tgo-ui-components-inline-field.d.ts +338 -254
- package/types/testgorilla-tgo-ui-components-logo.d.ts +119 -101
- package/types/testgorilla-tgo-ui-components-media-card.d.ts +51 -35
- package/types/testgorilla-tgo-ui-components-media-dialog.d.ts +40 -45
- package/types/testgorilla-tgo-ui-components-multi-input.d.ts +283 -194
- package/types/testgorilla-tgo-ui-components-navbar.d.ts +326 -208
- package/types/testgorilla-tgo-ui-components-overflow-menu.d.ts +276 -204
- package/types/testgorilla-tgo-ui-components-page-header.d.ts +67 -50
- package/types/testgorilla-tgo-ui-components-paginator.d.ts +103 -70
- package/types/testgorilla-tgo-ui-components-password-criteria.d.ts +67 -58
- package/types/testgorilla-tgo-ui-components-password-strength.d.ts +66 -57
- package/types/testgorilla-tgo-ui-components-phone-input.d.ts +217 -175
- package/types/testgorilla-tgo-ui-components-popover.d.ts +94 -53
- package/types/testgorilla-tgo-ui-components-popup-tip.d.ts +81 -44
- package/types/testgorilla-tgo-ui-components-progress-bar.d.ts +115 -84
- package/types/testgorilla-tgo-ui-components-prompt.d.ts +315 -219
- package/types/testgorilla-tgo-ui-components-radial-progress.d.ts +146 -107
- package/types/testgorilla-tgo-ui-components-radio-button.d.ts +296 -219
- package/types/testgorilla-tgo-ui-components-rating.d.ts +134 -95
- package/types/testgorilla-tgo-ui-components-scale-table.d.ts +67 -47
- package/types/testgorilla-tgo-ui-components-scale.d.ts +91 -66
- package/types/testgorilla-tgo-ui-components-segmented-bar.d.ts +118 -89
- package/types/testgorilla-tgo-ui-components-segmented-button.d.ts +107 -80
- package/types/testgorilla-tgo-ui-components-segmented-toggle.d.ts +138 -105
- package/types/testgorilla-tgo-ui-components-selectable-card.d.ts +90 -56
- package/types/testgorilla-tgo-ui-components-side-navigation.d.ts +183 -107
- package/types/testgorilla-tgo-ui-components-side-panel.d.ts +156 -145
- package/types/testgorilla-tgo-ui-components-side-sheet.d.ts +98 -89
- package/types/testgorilla-tgo-ui-components-skeleton.d.ts +50 -33
- package/types/testgorilla-tgo-ui-components-slider.d.ts +278 -198
- package/types/testgorilla-tgo-ui-components-snackbar.d.ts +211 -159
- package/types/testgorilla-tgo-ui-components-spider-chart.d.ts +140 -121
- package/types/testgorilla-tgo-ui-components-spinner.d.ts +93 -72
- package/types/testgorilla-tgo-ui-components-stepper.d.ts +480 -338
- package/types/testgorilla-tgo-ui-components-table.d.ts +280 -233
- package/types/testgorilla-tgo-ui-components-tabs.d.ts +282 -183
- package/types/testgorilla-tgo-ui-components-tag.d.ts +266 -193
- package/types/testgorilla-tgo-ui-components-toggle.d.ts +180 -132
- package/types/testgorilla-tgo-ui-components-tooltip.d.ts +142 -105
- package/types/testgorilla-tgo-ui-components-universal-skills.d.ts +165 -144
- package/types/testgorilla-tgo-ui-components-validation-error.d.ts +70 -51
- package/types/testgorilla-tgo-ui-components-write-with-ai.d.ts +210 -133
- package/types/testgorilla-tgo-ui.d.ts +52 -45
|
@@ -1,144 +1,241 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import DataLabelsPlugin from
|
|
4
|
-
import { BaseChartDirective } from
|
|
5
|
-
import { Chart, registerables } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, NgModule, computed, input } from "@angular/core";
|
|
3
|
+
import DataLabelsPlugin from "chartjs-plugin-datalabels";
|
|
4
|
+
import { BaseChartDirective } from "ng2-charts";
|
|
5
|
+
import { Chart, registerables } from "chart.js";
|
|
6
|
+
var DonutChartComponent = class DonutChartComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.donutChartData = input(...ngDevMode ? [void 0, { debugName: "donutChartData" }] : /* istanbul ignore next */ []);
|
|
9
|
+
this.applicationTheme = input("light", ...ngDevMode ? [{ debugName: "applicationTheme" }] : /* istanbul ignore next */ []);
|
|
10
|
+
this.chartData = computed(() => {
|
|
11
|
+
const data = this.donutChartData();
|
|
12
|
+
return data ? {
|
|
13
|
+
labels: data.labels,
|
|
14
|
+
datasets: [{
|
|
15
|
+
data: data.data,
|
|
16
|
+
backgroundColor: data.backgroundColor,
|
|
17
|
+
borderWidth: 0
|
|
18
|
+
}]
|
|
19
|
+
} : {
|
|
20
|
+
labels: [],
|
|
21
|
+
datasets: []
|
|
22
|
+
};
|
|
23
|
+
}, ...ngDevMode ? [{ debugName: "chartData" }] : /* istanbul ignore next */ []);
|
|
24
|
+
this.centerTextPlugin = {
|
|
25
|
+
id: "centerText",
|
|
26
|
+
beforeDraw: (chart) => {
|
|
27
|
+
const { ctx, chartArea: { width, height } } = chart;
|
|
28
|
+
const total = chart.data.datasets[0].data.reduce((a, b) => a + b, 0);
|
|
29
|
+
const padding = 32;
|
|
30
|
+
ctx.save();
|
|
31
|
+
ctx.font = "bold 14px ModernGothic";
|
|
32
|
+
ctx.fillStyle = "#242424";
|
|
33
|
+
ctx.textAlign = "center";
|
|
34
|
+
ctx.textBaseline = "middle";
|
|
35
|
+
ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);
|
|
36
|
+
ctx.restore();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
this.labelLinePlugin = {
|
|
40
|
+
id: "labelLinePlugin",
|
|
41
|
+
afterDatasetDraw: (chart) => {
|
|
42
|
+
const { ctx, data } = chart;
|
|
43
|
+
const meta = chart.getDatasetMeta(0);
|
|
44
|
+
const radialOffset = 10;
|
|
45
|
+
const horizontalLength = 20;
|
|
46
|
+
const fontSize = 14;
|
|
47
|
+
ctx.save();
|
|
48
|
+
ctx.strokeStyle = "#666";
|
|
49
|
+
ctx.lineWidth = 1;
|
|
50
|
+
ctx.font = `${fontSize}px ModernGothic`;
|
|
51
|
+
ctx.fillStyle = "#242424";
|
|
52
|
+
meta.data.forEach((arc, index) => {
|
|
53
|
+
const angle = (arc.startAngle + arc.endAngle) / 2;
|
|
54
|
+
const radius = arc.outerRadius;
|
|
55
|
+
const centerX = arc.x;
|
|
56
|
+
const centerY = arc.y;
|
|
57
|
+
const startX = centerX + Math.cos(angle) * radius;
|
|
58
|
+
const startY = centerY + Math.sin(angle) * radius;
|
|
59
|
+
const midX = centerX + Math.cos(angle) * (radius + radialOffset);
|
|
60
|
+
const midY = centerY + Math.sin(angle) * (radius + radialOffset);
|
|
61
|
+
const direction = Math.cos(angle) >= 0 ? 1 : -1;
|
|
62
|
+
const endX = midX + direction * horizontalLength;
|
|
63
|
+
const endY = midY;
|
|
64
|
+
ctx.beginPath();
|
|
65
|
+
ctx.moveTo(startX, startY);
|
|
66
|
+
ctx.lineTo(midX, midY);
|
|
67
|
+
ctx.lineTo(endX, endY);
|
|
68
|
+
ctx.stroke();
|
|
69
|
+
const value = data.datasets[0].data?.[index] ?? "";
|
|
70
|
+
const textX = endX + direction * 5;
|
|
71
|
+
ctx.textAlign = direction > 0 ? "left" : "right";
|
|
72
|
+
ctx.textBaseline = "middle";
|
|
73
|
+
ctx.fillText(String(value), textX, endY);
|
|
74
|
+
});
|
|
75
|
+
ctx.restore();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.donutChartPlugins = [
|
|
79
|
+
DataLabelsPlugin,
|
|
80
|
+
this.centerTextPlugin,
|
|
81
|
+
this.labelLinePlugin
|
|
82
|
+
];
|
|
83
|
+
this.donutChartOptions = {
|
|
84
|
+
responsive: true,
|
|
85
|
+
cutout: "65%",
|
|
86
|
+
aspectRatio: 2,
|
|
87
|
+
layout: { padding: 16 },
|
|
88
|
+
plugins: {
|
|
89
|
+
legend: {
|
|
90
|
+
onClick: () => null,
|
|
91
|
+
position: "right",
|
|
92
|
+
labels: {
|
|
93
|
+
font: {
|
|
94
|
+
family: "ModernGothic",
|
|
95
|
+
size: 14
|
|
96
|
+
},
|
|
97
|
+
boxWidth: 14,
|
|
98
|
+
padding: 20
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
tooltip: { enabled: false },
|
|
102
|
+
datalabels: { display: false }
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
static {
|
|
107
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
108
|
+
minVersion: "12.0.0",
|
|
109
|
+
version: "22.2.4",
|
|
110
|
+
ngImport: i0,
|
|
111
|
+
type: DonutChartComponent,
|
|
112
|
+
deps: [],
|
|
113
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
static {
|
|
117
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
118
|
+
minVersion: "17.1.0",
|
|
119
|
+
version: "22.2.4",
|
|
120
|
+
type: DonutChartComponent,
|
|
121
|
+
isStandalone: true,
|
|
122
|
+
selector: "ui-donut-chart",
|
|
123
|
+
inputs: {
|
|
124
|
+
donutChartData: {
|
|
125
|
+
classPropertyName: "donutChartData",
|
|
126
|
+
publicName: "donutChartData",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
},
|
|
131
|
+
applicationTheme: {
|
|
132
|
+
classPropertyName: "applicationTheme",
|
|
133
|
+
publicName: "applicationTheme",
|
|
134
|
+
isSignal: true,
|
|
135
|
+
isRequired: false,
|
|
136
|
+
transformFunction: null
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
ngImport: i0,
|
|
140
|
+
template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n",
|
|
141
|
+
styles: [""],
|
|
142
|
+
dependencies: [{
|
|
143
|
+
kind: "directive",
|
|
144
|
+
type: BaseChartDirective,
|
|
145
|
+
selector: "canvas[baseChart]",
|
|
146
|
+
inputs: [
|
|
147
|
+
"type",
|
|
148
|
+
"legend",
|
|
149
|
+
"data",
|
|
150
|
+
"options",
|
|
151
|
+
"plugins",
|
|
152
|
+
"labels",
|
|
153
|
+
"datasets"
|
|
154
|
+
],
|
|
155
|
+
outputs: ["chartClick", "chartHover"],
|
|
156
|
+
exportAs: ["base-chart"]
|
|
157
|
+
}],
|
|
158
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
163
|
+
minVersion: "12.0.0",
|
|
164
|
+
version: "22.2.4",
|
|
165
|
+
ngImport: i0,
|
|
166
|
+
type: DonutChartComponent,
|
|
167
|
+
decorators: [{
|
|
168
|
+
type: Component,
|
|
169
|
+
args: [{
|
|
170
|
+
selector: "ui-donut-chart",
|
|
171
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
172
|
+
imports: [BaseChartDirective],
|
|
173
|
+
template: "<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n"
|
|
174
|
+
}]
|
|
175
|
+
}],
|
|
176
|
+
propDecorators: {
|
|
177
|
+
donutChartData: [{
|
|
178
|
+
type: i0.Input,
|
|
179
|
+
args: [{
|
|
180
|
+
isSignal: true,
|
|
181
|
+
alias: "donutChartData",
|
|
182
|
+
required: false
|
|
183
|
+
}]
|
|
184
|
+
}],
|
|
185
|
+
applicationTheme: [{
|
|
186
|
+
type: i0.Input,
|
|
187
|
+
args: [{
|
|
188
|
+
isSignal: true,
|
|
189
|
+
alias: "applicationTheme",
|
|
190
|
+
required: false
|
|
191
|
+
}]
|
|
192
|
+
}]
|
|
193
|
+
}
|
|
194
|
+
});
|
|
125
195
|
Chart.register(...registerables);
|
|
126
|
-
class DonutChartComponentModule {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
196
|
+
var DonutChartComponentModule = class DonutChartComponentModule {
|
|
197
|
+
static {
|
|
198
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
199
|
+
minVersion: "12.0.0",
|
|
200
|
+
version: "22.2.4",
|
|
201
|
+
ngImport: i0,
|
|
202
|
+
type: DonutChartComponentModule,
|
|
203
|
+
deps: [],
|
|
204
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
static {
|
|
208
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
209
|
+
minVersion: "14.0.0",
|
|
210
|
+
version: "22.2.4",
|
|
211
|
+
ngImport: i0,
|
|
212
|
+
type: DonutChartComponentModule,
|
|
213
|
+
imports: [BaseChartDirective, DonutChartComponent],
|
|
214
|
+
exports: [DonutChartComponent]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
static {
|
|
218
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
219
|
+
minVersion: "12.0.0",
|
|
220
|
+
version: "22.2.4",
|
|
221
|
+
ngImport: i0,
|
|
222
|
+
type: DonutChartComponentModule
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
227
|
+
minVersion: "12.0.0",
|
|
228
|
+
version: "22.2.4",
|
|
229
|
+
ngImport: i0,
|
|
230
|
+
type: DonutChartComponentModule,
|
|
231
|
+
decorators: [{
|
|
232
|
+
type: NgModule,
|
|
233
|
+
args: [{
|
|
234
|
+
exports: [DonutChartComponent],
|
|
235
|
+
imports: [BaseChartDirective, DonutChartComponent]
|
|
236
|
+
}]
|
|
237
|
+
}]
|
|
238
|
+
});
|
|
143
239
|
export { DonutChartComponent, DonutChartComponentModule };
|
|
144
|
-
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=testgorilla-tgo-ui-components-donut-chart.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testgorilla-tgo-ui-components-donut-chart.mjs","sources":["../../../components/donut-chart/donut-chart.component.ts","../../../components/donut-chart/donut-chart.component.html","../../../components/donut-chart/donut-chart.component.module.ts","../../../components/donut-chart/testgorilla-tgo-ui-components-donut-chart.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { ArcElement, ChartOptions, Plugin } from 'chart.js';\nimport DataLabelsPlugin from 'chartjs-plugin-datalabels';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nimport { DonutChartData } from './donut-chart.component.model';\n\n@Component({\n selector: 'ui-donut-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './donut-chart.component.html',\n styleUrls: ['./donut-chart.component.scss'],\n imports: [BaseChartDirective],\n})\nexport class DonutChartComponent {\n donutChartData = input<DonutChartData>();\n applicationTheme = input<ApplicationTheme>('light');\n\n readonly chartData = computed(() => {\n const data = this.donutChartData();\n return data\n ? {\n labels: data.labels,\n datasets: [\n {\n data: data.data,\n backgroundColor: data.backgroundColor,\n borderWidth: 0,\n },\n ],\n }\n : { labels: [], datasets: [] };\n });\n\n // Plugin to display the total in the center\n centerTextPlugin: Plugin<'doughnut'> = {\n id: 'centerText',\n beforeDraw: chart => {\n const {\n ctx,\n chartArea: { width, height },\n } = chart;\n const total = chart.data.datasets[0].data.reduce((a: number, b: number) => a + b, 0);\n const padding = 32;\n ctx.save();\n ctx.font = 'bold 14px ModernGothic';\n ctx.fillStyle = '#242424';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);\n ctx.restore();\n },\n };\n\n // Plugin to draw lines from the donut segments to the labels\n labelLinePlugin: Plugin<'doughnut'> = {\n id: 'labelLinePlugin',\n afterDatasetDraw: chart => {\n const { ctx, data } = chart;\n const meta = chart.getDatasetMeta(0);\n const radialOffset = 10; // length of the radial segment (elbow)\n const horizontalLength = 20; // new length of the horizontal segment\n const fontSize = 14;\n\n ctx.save();\n ctx.strokeStyle = '#666';\n ctx.lineWidth = 1;\n ctx.font = `${fontSize}px ModernGothic`;\n ctx.fillStyle = '#242424';\n\n (meta.data as ArcElement[]).forEach((arc, index) => {\n const angle = (arc.startAngle + arc.endAngle) / 2;\n const radius = arc.outerRadius;\n const centerX = arc.x;\n const centerY = arc.y;\n\n // Start point: outer edge of the arc\n const startX = centerX + Math.cos(angle) * radius;\n const startY = centerY + Math.sin(angle) * radius;\n\n // Elbow: short line outward\n const midX = centerX + Math.cos(angle) * (radius + radialOffset);\n const midY = centerY + Math.sin(angle) * (radius + radialOffset);\n\n // Extended horizontal line\n const direction = Math.cos(angle) >= 0 ? 1 : -1;\n const endX = midX + direction * horizontalLength;\n const endY = midY;\n\n // Draw line with elbow\n ctx.beginPath();\n ctx.moveTo(startX, startY);\n ctx.lineTo(midX, midY);\n ctx.lineTo(endX, endY);\n ctx.stroke();\n\n // Draw value at the end\n const value = data.datasets[0].data?.[index] ?? '';\n const textX = endX + direction * 5;\n ctx.textAlign = direction > 0 ? 'left' : 'right';\n ctx.textBaseline = 'middle';\n ctx.fillText(String(value), textX, endY);\n });\n\n ctx.restore();\n },\n };\n\n public donutChartPlugins: Plugin<'doughnut'>[] = [DataLabelsPlugin, this.centerTextPlugin, this.labelLinePlugin];\n\n public donutChartOptions: ChartOptions<'doughnut'> = {\n responsive: true,\n cutout: '65%',\n aspectRatio: 2,\n layout: {\n padding: 16,\n },\n plugins: {\n legend: {\n onClick: () => null, // Disable legend click events\n position: 'right',\n labels: {\n font: {\n family: 'ModernGothic',\n size: 14,\n },\n boxWidth: 14,\n padding: 20,\n },\n },\n tooltip: {\n enabled: false,\n },\n datalabels: {\n display: false,\n },\n },\n };\n}\n","<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n","import { NgModule } from '@angular/core';\nimport { Chart, registerables } from 'chart.js';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { DonutChartComponent } from './donut-chart.component';\n\nChart.register(...registerables);\n\n@NgModule({\n exports: [DonutChartComponent],\n imports: [BaseChartDirective, DonutChartComponent],\n})\nexport class DonutChartComponentModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAgBa,mBAAmB,CAAA;AAPhC,IAAA,WAAA,GAAA;QAQE,IAAA,CAAA,cAAc,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,gBAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAkB;AACxC,QAAA,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAmB,OAAO,uFAAC;AAE1C,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAK;AACjC,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE;AAClC,YAAA,OAAO;AACL,kBAAE;oBACE,MAAM,EAAE,IAAI,CAAC,MAAM;AACnB,oBAAA,QAAQ,EAAE;AACR,wBAAA;4BACE,IAAI,EAAE,IAAI,CAAC,IAAI;4BACf,eAAe,EAAE,IAAI,CAAC,eAAe;AACrC,4BAAA,WAAW,EAAE,CAAC;AACf,yBAAA;AACF,qBAAA;AACF;kBACD,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;AAClC,QAAA,CAAC,gFAAC;;AAGF,QAAA,IAAA,CAAA,gBAAgB,GAAuB;AACrC,YAAA,EAAE,EAAE,YAAY;YAChB,UAAU,EAAE,KAAK,IAAG;AAClB,gBAAA,MAAM,EACJ,GAAG,EACH,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAC7B,GAAG,KAAK;AACT,gBAAA,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC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A,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,EAAA,OAAA,EAAA,CAF1B,kBAAkB,EAAE,mBAAmB,aADvC,mBAAmB,CAAA,EAAA,CAAA,CAAA;gHAGlB,yBAAyB,EAAA,CAAA,CAAA;;4FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAJrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC9B,oBAAA,OAAO,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;AACnD,iBAAA;;;ACXD;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"testgorilla-tgo-ui-components-donut-chart.mjs","names":[],"sources":["../../../components/donut-chart/donut-chart.component.ts","../../../components/donut-chart/donut-chart.component.html","../../../components/donut-chart/donut-chart.component.module.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { ArcElement, ChartOptions, Plugin } from 'chart.js';\nimport DataLabelsPlugin from 'chartjs-plugin-datalabels';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nimport { DonutChartData } from './donut-chart.component.model';\n\n@Component({\n selector: 'ui-donut-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './donut-chart.component.html',\n styleUrls: ['./donut-chart.component.scss'],\n imports: [BaseChartDirective],\n})\nexport class DonutChartComponent {\n donutChartData = input<DonutChartData>();\n applicationTheme = input<ApplicationTheme>('light');\n\n readonly chartData = computed(() => {\n const data = this.donutChartData();\n return data\n ? {\n labels: data.labels,\n datasets: [\n {\n data: data.data,\n backgroundColor: data.backgroundColor,\n borderWidth: 0,\n },\n ],\n }\n : { labels: [], datasets: [] };\n });\n\n // Plugin to display the total in the center\n centerTextPlugin: Plugin<'doughnut'> = {\n id: 'centerText',\n beforeDraw: chart => {\n const {\n ctx,\n chartArea: { width, height },\n } = chart;\n const total = chart.data.datasets[0].data.reduce((a: number, b: number) => a + b, 0);\n const padding = 32;\n ctx.save();\n ctx.font = 'bold 14px ModernGothic';\n ctx.fillStyle = '#242424';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(total.toString(), (width + padding) / 2, (height + padding) / 2);\n ctx.restore();\n },\n };\n\n // Plugin to draw lines from the donut segments to the labels\n labelLinePlugin: Plugin<'doughnut'> = {\n id: 'labelLinePlugin',\n afterDatasetDraw: chart => {\n const { ctx, data } = chart;\n const meta = chart.getDatasetMeta(0);\n const radialOffset = 10; // length of the radial segment (elbow)\n const horizontalLength = 20; // new length of the horizontal segment\n const fontSize = 14;\n\n ctx.save();\n ctx.strokeStyle = '#666';\n ctx.lineWidth = 1;\n ctx.font = `${fontSize}px ModernGothic`;\n ctx.fillStyle = '#242424';\n\n (meta.data as ArcElement[]).forEach((arc, index) => {\n const angle = (arc.startAngle + arc.endAngle) / 2;\n const radius = arc.outerRadius;\n const centerX = arc.x;\n const centerY = arc.y;\n\n // Start point: outer edge of the arc\n const startX = centerX + Math.cos(angle) * radius;\n const startY = centerY + Math.sin(angle) * radius;\n\n // Elbow: short line outward\n const midX = centerX + Math.cos(angle) * (radius + radialOffset);\n const midY = centerY + Math.sin(angle) * (radius + radialOffset);\n\n // Extended horizontal line\n const direction = Math.cos(angle) >= 0 ? 1 : -1;\n const endX = midX + direction * horizontalLength;\n const endY = midY;\n\n // Draw line with elbow\n ctx.beginPath();\n ctx.moveTo(startX, startY);\n ctx.lineTo(midX, midY);\n ctx.lineTo(endX, endY);\n ctx.stroke();\n\n // Draw value at the end\n const value = data.datasets[0].data?.[index] ?? '';\n const textX = endX + direction * 5;\n ctx.textAlign = direction > 0 ? 'left' : 'right';\n ctx.textBaseline = 'middle';\n ctx.fillText(String(value), textX, endY);\n });\n\n ctx.restore();\n },\n };\n\n public donutChartPlugins: Plugin<'doughnut'>[] = [DataLabelsPlugin, this.centerTextPlugin, this.labelLinePlugin];\n\n public donutChartOptions: ChartOptions<'doughnut'> = {\n responsive: true,\n cutout: '65%',\n aspectRatio: 2,\n layout: {\n padding: 16,\n },\n plugins: {\n legend: {\n onClick: () => null, // Disable legend click events\n position: 'right',\n labels: {\n font: {\n family: 'ModernGothic',\n size: 14,\n },\n boxWidth: 14,\n padding: 20,\n },\n },\n tooltip: {\n enabled: false,\n },\n datalabels: {\n display: false,\n },\n },\n };\n}\n","<div style=\"height: 200px\">\n <canvas baseChart [data]=\"chartData()\" type=\"doughnut\" [options]=\"donutChartOptions\" [plugins]=\"donutChartPlugins\">\n </canvas>\n</div>\n","import { NgModule } from '@angular/core';\nimport { Chart, registerables } from 'chart.js';\nimport { BaseChartDirective } from 'ng2-charts';\n\nimport { DonutChartComponent } from './donut-chart.component';\n\nChart.register(...registerables);\n\n@NgModule({\n exports: [DonutChartComponent],\n imports: [BaseChartDirective, DonutChartComponent],\n})\nexport class DonutChartComponentModule {}\n"],"mappings":";;;;;AAgBA,IAAa,sBAAb,MAAa,oBAAmB;CAPhC,cAAA;EAQE,KAAA,iBAAiB,MAAuB,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;EACxC,KAAA,mBAAmB,MAAwB,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;EAE1C,KAAA,YAAY,eAAc;GACjC,MAAM,OAAO,KAAK,eAAc;GAChC,OAAO,OACH;IACE,QAAQ,KAAK;IACb,UAAU,CACR;KACE,MAAM,KAAK;KACX,iBAAiB,KAAK;KACtB,aAAa;IACd,CACF;GACF,IACD;IAAE,QAAQ,CAAA;IAAI,UAAU,CAAA;GAAE;EAChC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAGF,KAAA,mBAAuC;GAC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