origam 2.38.0 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +8 -8
|
@@ -157,10 +157,7 @@
|
|
|
157
157
|
|
|
158
158
|
<script lang="ts" setup>
|
|
159
159
|
import { CHART_ASPECT_RATIO, CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
160
|
-
import {
|
|
161
|
-
computed,
|
|
162
|
-
ref
|
|
163
|
-
} from "vue";
|
|
160
|
+
import { computed, ref } from "vue";
|
|
164
161
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
165
162
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
166
163
|
import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
|
|
@@ -176,75 +173,443 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
176
173
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
177
174
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
178
175
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
/*********************************************************
|
|
177
|
+
* Global
|
|
178
|
+
*
|
|
179
|
+
* @description
|
|
180
|
+
* Polar bar (nightingale-rose) chart. Renders a single series of
|
|
181
|
+
* N data points as N wedge-shaped arcs arranged radially.
|
|
182
|
+
*
|
|
183
|
+
* Each wedge occupies an equal angular slot; its outer radius is
|
|
184
|
+
* proportional to `value / maxValue`. The inner radius is fixed
|
|
185
|
+
* (controlled by `innerRadius` — a fraction of totalR).
|
|
186
|
+
*
|
|
187
|
+
* Arc path: outer-START → outer-END (CW arc) → inner-END → inner-START
|
|
188
|
+
* (CCW arc) → Z. This is the canonical sunburst arc shape reused here.
|
|
189
|
+
*
|
|
190
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
191
|
+
********************************************************/
|
|
192
|
+
defineOptions({ name: "OrigamChartPolarBar" });
|
|
182
193
|
const props = defineProps({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
194
|
+
innerRadius: {
|
|
195
|
+
type: Number,
|
|
196
|
+
required: false,
|
|
197
|
+
default: .1
|
|
198
|
+
},
|
|
199
|
+
startAngle: {
|
|
200
|
+
type: Number,
|
|
201
|
+
required: false,
|
|
202
|
+
default: 0
|
|
203
|
+
},
|
|
204
|
+
gap: {
|
|
205
|
+
type: Number,
|
|
206
|
+
required: false,
|
|
207
|
+
default: .02
|
|
208
|
+
},
|
|
209
|
+
maxValue: {
|
|
210
|
+
type: Number,
|
|
211
|
+
required: false,
|
|
212
|
+
default: undefined
|
|
213
|
+
},
|
|
214
|
+
showLabel: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false,
|
|
217
|
+
default: true
|
|
218
|
+
},
|
|
219
|
+
showValue: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
required: false,
|
|
222
|
+
default: false
|
|
223
|
+
},
|
|
224
|
+
xAxisFormat: {
|
|
225
|
+
type: Function,
|
|
226
|
+
required: false,
|
|
227
|
+
default: undefined
|
|
228
|
+
},
|
|
229
|
+
yAxisFormat: {
|
|
230
|
+
type: Function,
|
|
231
|
+
required: false,
|
|
232
|
+
default: undefined
|
|
233
|
+
},
|
|
234
|
+
series: {
|
|
235
|
+
type: Array,
|
|
236
|
+
required: true
|
|
237
|
+
},
|
|
238
|
+
categories: {
|
|
239
|
+
type: Array,
|
|
240
|
+
required: false,
|
|
241
|
+
default: () => []
|
|
242
|
+
},
|
|
243
|
+
title: {
|
|
244
|
+
type: String,
|
|
245
|
+
required: false,
|
|
246
|
+
default: undefined
|
|
247
|
+
},
|
|
248
|
+
subtitle: {
|
|
249
|
+
type: String,
|
|
250
|
+
required: false,
|
|
251
|
+
default: undefined
|
|
252
|
+
},
|
|
253
|
+
showLegend: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
required: false,
|
|
256
|
+
default: true
|
|
257
|
+
},
|
|
258
|
+
legendPosition: {
|
|
259
|
+
type: null,
|
|
260
|
+
required: false,
|
|
261
|
+
default: "bottom"
|
|
262
|
+
},
|
|
263
|
+
showTooltip: {
|
|
264
|
+
type: Boolean,
|
|
265
|
+
required: false,
|
|
266
|
+
default: true
|
|
267
|
+
},
|
|
268
|
+
animated: {
|
|
269
|
+
type: Boolean,
|
|
270
|
+
required: false,
|
|
271
|
+
default: true
|
|
272
|
+
},
|
|
273
|
+
animationDuration: {
|
|
274
|
+
type: Number,
|
|
275
|
+
required: false,
|
|
276
|
+
default: 600
|
|
277
|
+
},
|
|
278
|
+
colorScheme: {
|
|
279
|
+
type: Array,
|
|
280
|
+
required: false,
|
|
281
|
+
default: () => []
|
|
282
|
+
},
|
|
283
|
+
aspectRatio: {
|
|
284
|
+
type: String,
|
|
285
|
+
required: false,
|
|
286
|
+
default: undefined
|
|
287
|
+
},
|
|
288
|
+
id: {
|
|
289
|
+
type: String,
|
|
290
|
+
required: false
|
|
291
|
+
},
|
|
292
|
+
class: {
|
|
293
|
+
type: [
|
|
294
|
+
String,
|
|
295
|
+
Array,
|
|
296
|
+
Object
|
|
297
|
+
],
|
|
298
|
+
required: false
|
|
299
|
+
},
|
|
300
|
+
style: {
|
|
301
|
+
type: [
|
|
302
|
+
String,
|
|
303
|
+
Array,
|
|
304
|
+
Object,
|
|
305
|
+
Boolean,
|
|
306
|
+
null
|
|
307
|
+
],
|
|
308
|
+
required: false,
|
|
309
|
+
skipCheck: true
|
|
310
|
+
},
|
|
311
|
+
height: {
|
|
312
|
+
type: [Number, String],
|
|
313
|
+
required: false
|
|
314
|
+
},
|
|
315
|
+
maxHeight: {
|
|
316
|
+
type: [Number, String],
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
maxWidth: {
|
|
320
|
+
type: [Number, String],
|
|
321
|
+
required: false
|
|
322
|
+
},
|
|
323
|
+
minHeight: {
|
|
324
|
+
type: [Number, String],
|
|
325
|
+
required: false
|
|
326
|
+
},
|
|
327
|
+
minWidth: {
|
|
328
|
+
type: [Number, String],
|
|
329
|
+
required: false
|
|
330
|
+
},
|
|
331
|
+
width: {
|
|
332
|
+
type: [Number, String],
|
|
333
|
+
required: false
|
|
334
|
+
},
|
|
335
|
+
margin: {
|
|
336
|
+
type: [
|
|
337
|
+
Boolean,
|
|
338
|
+
Number,
|
|
339
|
+
String
|
|
340
|
+
],
|
|
341
|
+
required: false
|
|
342
|
+
},
|
|
343
|
+
marginTop: {
|
|
344
|
+
type: [
|
|
345
|
+
Boolean,
|
|
346
|
+
Number,
|
|
347
|
+
String
|
|
348
|
+
],
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
marginLeft: {
|
|
352
|
+
type: [
|
|
353
|
+
Boolean,
|
|
354
|
+
Number,
|
|
355
|
+
String
|
|
356
|
+
],
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
marginBottom: {
|
|
360
|
+
type: [
|
|
361
|
+
Boolean,
|
|
362
|
+
Number,
|
|
363
|
+
String
|
|
364
|
+
],
|
|
365
|
+
required: false
|
|
366
|
+
},
|
|
367
|
+
marginRight: {
|
|
368
|
+
type: [
|
|
369
|
+
Boolean,
|
|
370
|
+
Number,
|
|
371
|
+
String
|
|
372
|
+
],
|
|
373
|
+
required: false
|
|
374
|
+
},
|
|
375
|
+
marginBlock: {
|
|
376
|
+
type: [
|
|
377
|
+
Boolean,
|
|
378
|
+
Number,
|
|
379
|
+
String
|
|
380
|
+
],
|
|
381
|
+
required: false
|
|
382
|
+
},
|
|
383
|
+
marginInline: {
|
|
384
|
+
type: [
|
|
385
|
+
Boolean,
|
|
386
|
+
Number,
|
|
387
|
+
String
|
|
388
|
+
],
|
|
389
|
+
required: false
|
|
390
|
+
},
|
|
391
|
+
marginInlineStart: {
|
|
392
|
+
type: [
|
|
393
|
+
Boolean,
|
|
394
|
+
Number,
|
|
395
|
+
String
|
|
396
|
+
],
|
|
397
|
+
required: false
|
|
398
|
+
},
|
|
399
|
+
marginInlineEnd: {
|
|
400
|
+
type: [
|
|
401
|
+
Boolean,
|
|
402
|
+
Number,
|
|
403
|
+
String
|
|
404
|
+
],
|
|
405
|
+
required: false
|
|
406
|
+
},
|
|
407
|
+
marginBlockStart: {
|
|
408
|
+
type: [
|
|
409
|
+
Boolean,
|
|
410
|
+
Number,
|
|
411
|
+
String
|
|
412
|
+
],
|
|
413
|
+
required: false
|
|
414
|
+
},
|
|
415
|
+
marginBlockEnd: {
|
|
416
|
+
type: [
|
|
417
|
+
Boolean,
|
|
418
|
+
Number,
|
|
419
|
+
String
|
|
420
|
+
],
|
|
421
|
+
required: false
|
|
422
|
+
},
|
|
423
|
+
padding: {
|
|
424
|
+
type: [
|
|
425
|
+
Boolean,
|
|
426
|
+
Number,
|
|
427
|
+
String
|
|
428
|
+
],
|
|
429
|
+
required: false
|
|
430
|
+
},
|
|
431
|
+
paddingTop: {
|
|
432
|
+
type: [
|
|
433
|
+
Boolean,
|
|
434
|
+
Number,
|
|
435
|
+
String
|
|
436
|
+
],
|
|
437
|
+
required: false
|
|
438
|
+
},
|
|
439
|
+
paddingLeft: {
|
|
440
|
+
type: [
|
|
441
|
+
Boolean,
|
|
442
|
+
Number,
|
|
443
|
+
String
|
|
444
|
+
],
|
|
445
|
+
required: false
|
|
446
|
+
},
|
|
447
|
+
paddingBottom: {
|
|
448
|
+
type: [
|
|
449
|
+
Boolean,
|
|
450
|
+
Number,
|
|
451
|
+
String
|
|
452
|
+
],
|
|
453
|
+
required: false
|
|
454
|
+
},
|
|
455
|
+
paddingRight: {
|
|
456
|
+
type: [
|
|
457
|
+
Boolean,
|
|
458
|
+
Number,
|
|
459
|
+
String
|
|
460
|
+
],
|
|
461
|
+
required: false
|
|
462
|
+
},
|
|
463
|
+
paddingBlock: {
|
|
464
|
+
type: [
|
|
465
|
+
Boolean,
|
|
466
|
+
Number,
|
|
467
|
+
String
|
|
468
|
+
],
|
|
469
|
+
required: false
|
|
470
|
+
},
|
|
471
|
+
paddingInline: {
|
|
472
|
+
type: [
|
|
473
|
+
Boolean,
|
|
474
|
+
Number,
|
|
475
|
+
String
|
|
476
|
+
],
|
|
477
|
+
required: false
|
|
478
|
+
},
|
|
479
|
+
paddingInlineStart: {
|
|
480
|
+
type: [
|
|
481
|
+
Boolean,
|
|
482
|
+
Number,
|
|
483
|
+
String
|
|
484
|
+
],
|
|
485
|
+
required: false
|
|
486
|
+
},
|
|
487
|
+
paddingInlineEnd: {
|
|
488
|
+
type: [
|
|
489
|
+
Boolean,
|
|
490
|
+
Number,
|
|
491
|
+
String
|
|
492
|
+
],
|
|
493
|
+
required: false
|
|
494
|
+
},
|
|
495
|
+
paddingBlockStart: {
|
|
496
|
+
type: [
|
|
497
|
+
Boolean,
|
|
498
|
+
Number,
|
|
499
|
+
String
|
|
500
|
+
],
|
|
501
|
+
required: false
|
|
502
|
+
},
|
|
503
|
+
paddingBlockEnd: {
|
|
504
|
+
type: [
|
|
505
|
+
Boolean,
|
|
506
|
+
Number,
|
|
507
|
+
String
|
|
508
|
+
],
|
|
509
|
+
required: false
|
|
510
|
+
},
|
|
511
|
+
rounded: {
|
|
512
|
+
type: [
|
|
513
|
+
Boolean,
|
|
514
|
+
Number,
|
|
515
|
+
String,
|
|
516
|
+
null
|
|
517
|
+
],
|
|
518
|
+
required: false,
|
|
519
|
+
skipCheck: true
|
|
520
|
+
},
|
|
521
|
+
roundedTopRight: {
|
|
522
|
+
type: [
|
|
523
|
+
Boolean,
|
|
524
|
+
Number,
|
|
525
|
+
String
|
|
526
|
+
],
|
|
527
|
+
required: false
|
|
528
|
+
},
|
|
529
|
+
roundedTopLeft: {
|
|
530
|
+
type: [
|
|
531
|
+
Boolean,
|
|
532
|
+
Number,
|
|
533
|
+
String
|
|
534
|
+
],
|
|
535
|
+
required: false
|
|
536
|
+
},
|
|
537
|
+
roundedBottomLeft: {
|
|
538
|
+
type: [
|
|
539
|
+
Boolean,
|
|
540
|
+
Number,
|
|
541
|
+
String
|
|
542
|
+
],
|
|
543
|
+
required: false
|
|
544
|
+
},
|
|
545
|
+
roundedBottomRight: {
|
|
546
|
+
type: [
|
|
547
|
+
Boolean,
|
|
548
|
+
Number,
|
|
549
|
+
String
|
|
550
|
+
],
|
|
551
|
+
required: false
|
|
552
|
+
},
|
|
553
|
+
roundedStartStart: {
|
|
554
|
+
type: [
|
|
555
|
+
Boolean,
|
|
556
|
+
Number,
|
|
557
|
+
String
|
|
558
|
+
],
|
|
559
|
+
required: false
|
|
560
|
+
},
|
|
561
|
+
roundedStartEnd: {
|
|
562
|
+
type: [
|
|
563
|
+
Boolean,
|
|
564
|
+
Number,
|
|
565
|
+
String
|
|
566
|
+
],
|
|
567
|
+
required: false
|
|
568
|
+
},
|
|
569
|
+
roundedEndStart: {
|
|
570
|
+
type: [
|
|
571
|
+
Boolean,
|
|
572
|
+
Number,
|
|
573
|
+
String
|
|
574
|
+
],
|
|
575
|
+
required: false
|
|
576
|
+
},
|
|
577
|
+
roundedEndEnd: {
|
|
578
|
+
type: [
|
|
579
|
+
Boolean,
|
|
580
|
+
Number,
|
|
581
|
+
String
|
|
582
|
+
],
|
|
583
|
+
required: false
|
|
584
|
+
},
|
|
585
|
+
elevation: {
|
|
586
|
+
type: [Number, String],
|
|
587
|
+
required: false
|
|
588
|
+
},
|
|
589
|
+
bgColor: {
|
|
590
|
+
type: [
|
|
591
|
+
String,
|
|
592
|
+
Object,
|
|
593
|
+
Boolean,
|
|
594
|
+
null
|
|
595
|
+
],
|
|
596
|
+
required: false,
|
|
597
|
+
skipCheck: true
|
|
598
|
+
},
|
|
599
|
+
fontSize: {
|
|
600
|
+
type: null,
|
|
601
|
+
required: false
|
|
602
|
+
},
|
|
603
|
+
fontWeight: {
|
|
604
|
+
type: null,
|
|
605
|
+
required: false
|
|
606
|
+
}
|
|
246
607
|
});
|
|
247
|
-
const emit = defineEmits([
|
|
608
|
+
const emit = defineEmits([
|
|
609
|
+
"point-click",
|
|
610
|
+
"legend-click",
|
|
611
|
+
"series-toggle"
|
|
612
|
+
]);
|
|
248
613
|
defineSlots();
|
|
249
614
|
const { t } = useLocale();
|
|
250
615
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -254,256 +619,294 @@ const { marginClasses, marginStyles } = useMargin(props);
|
|
|
254
619
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
255
620
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
256
621
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
622
|
+
/*********************************************************
|
|
623
|
+
* Props heritees sans effet ici (#426)
|
|
624
|
+
*
|
|
625
|
+
* @description
|
|
626
|
+
* ⛔ Ces props sont declarees par `IChartBaseProps` et n'ont aucun
|
|
627
|
+
* effet sur ce composant. Elles ne sont ni retirees ni cablees a un
|
|
628
|
+
* comportement fictif : elles avertissent une fois, en dev, avec la
|
|
629
|
+
* raison exacte. Meme traitement que `OrigamChartGauge`.
|
|
630
|
+
********************************************************/
|
|
631
|
+
useUnsupportedProp("OrigamChartPolarBar", "xAxisFormat", "only `yAxisFormat` is forwarded to the axis and applied in `labelFor`.", () => props.xAxisFormat !== undefined);
|
|
263
632
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
633
|
+
/*********************************************************
|
|
634
|
+
* Static SVG box — square coordinate space; CSS scales it.
|
|
635
|
+
* Polar charts benefit from a square canvas; the `g` element
|
|
636
|
+
* is translated to the centre so all geometry uses origin-centred
|
|
637
|
+
* polar coordinates.
|
|
638
|
+
********************************************************/
|
|
264
639
|
const { resizeRef: svgRef, width: svgWidth } = useChartSize(CHART_SIZE_FALLBACK.polarBar, { aspectRatio: CHART_ASPECT_RATIO.radial });
|
|
265
640
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
266
641
|
const center = computed(() => svgWidth.value / 2);
|
|
642
|
+
/** Radial clearance between outermost wedge and the SVG edge for labels. */
|
|
267
643
|
const LABEL_RADIAL_OFFSET = 14;
|
|
268
|
-
|
|
644
|
+
/** Minimum angular span (radians) for an in-wedge value label to be shown. */
|
|
645
|
+
const VALUE_LABEL_MIN_ANGLE = .25;
|
|
646
|
+
/*********************************************************
|
|
647
|
+
* Default colour palette — mirrors the DS intent cycle
|
|
648
|
+
********************************************************/
|
|
269
649
|
const DEFAULT_PALETTE = [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
650
|
+
"primary",
|
|
651
|
+
"success",
|
|
652
|
+
"warning",
|
|
653
|
+
"danger",
|
|
654
|
+
"info",
|
|
655
|
+
"secondary",
|
|
656
|
+
"ghost",
|
|
657
|
+
"neutral"
|
|
278
658
|
];
|
|
279
659
|
const resolveColor = (raw) => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
660
|
+
if (!raw) return "currentColor";
|
|
661
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
662
|
+
return raw;
|
|
663
|
+
}
|
|
664
|
+
if (isIntent(raw)) {
|
|
665
|
+
return intentBgExpr(raw, "default");
|
|
666
|
+
}
|
|
667
|
+
return "currentColor";
|
|
288
668
|
};
|
|
289
669
|
const colorFor = (dataIndex) => {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
670
|
+
const series = props.series?.[0];
|
|
671
|
+
if (series?.color) return resolveColor(series.color);
|
|
672
|
+
const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
|
|
673
|
+
return resolveColor(scheme[dataIndex % scheme.length]);
|
|
294
674
|
};
|
|
675
|
+
/*********************************************************
|
|
676
|
+
* Arc path generator — canonical sunburst shape, reused verbatim.
|
|
677
|
+
*
|
|
678
|
+
* Donut wedge: start at outer-START, sweep CW to outer-END (sweep=1),
|
|
679
|
+
* radial line to inner-END, then sweep CCW back to inner-START
|
|
680
|
+
* (sweep=0) → Z.
|
|
681
|
+
********************************************************/
|
|
295
682
|
const arcPath = (innerR, outerR, startAngle, endAngle) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
683
|
+
const sweep = endAngle - startAngle;
|
|
684
|
+
if (sweep <= 0) return "";
|
|
685
|
+
const cos0 = Math.cos(startAngle);
|
|
686
|
+
const sin0 = Math.sin(startAngle);
|
|
687
|
+
const cos1 = Math.cos(endAngle);
|
|
688
|
+
const sin1 = Math.sin(endAngle);
|
|
689
|
+
const largeArc = sweep > Math.PI ? 1 : 0;
|
|
690
|
+
const ox0 = outerR * cos0;
|
|
691
|
+
const oy0 = outerR * sin0;
|
|
692
|
+
const ox1 = outerR * cos1;
|
|
693
|
+
const oy1 = outerR * sin1;
|
|
694
|
+
const ix0 = innerR * cos0;
|
|
695
|
+
const iy0 = innerR * sin0;
|
|
696
|
+
const ix1 = innerR * cos1;
|
|
697
|
+
const iy1 = innerR * sin1;
|
|
698
|
+
if (innerR < .001) {
|
|
699
|
+
return [
|
|
700
|
+
`M 0,0`,
|
|
701
|
+
`L ${ox0},${oy0}`,
|
|
702
|
+
`A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
|
|
703
|
+
"Z"
|
|
704
|
+
].join(" ");
|
|
705
|
+
}
|
|
706
|
+
return [
|
|
707
|
+
`M ${ox0},${oy0}`,
|
|
708
|
+
`A ${outerR},${outerR} 0 ${largeArc},1 ${ox1},${oy1}`,
|
|
709
|
+
`L ${ix1},${iy1}`,
|
|
710
|
+
`A ${innerR},${innerR} 0 ${largeArc},0 ${ix0},${iy0}`,
|
|
711
|
+
"Z"
|
|
712
|
+
].join(" ");
|
|
326
713
|
};
|
|
327
|
-
|
|
714
|
+
/*********************************************************
|
|
715
|
+
* Legend — hidden-label set keyed by category string
|
|
716
|
+
********************************************************/
|
|
717
|
+
const hiddenLabels = ref(new Set());
|
|
718
|
+
/*********************************************************
|
|
719
|
+
* Geometry engine — one wedge per data point
|
|
720
|
+
********************************************************/
|
|
328
721
|
const wedges = computed(() => {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
722
|
+
const series = props.series?.[0];
|
|
723
|
+
if (!series || !series.data?.length) return [];
|
|
724
|
+
const raw = series.data;
|
|
725
|
+
const values = raw.map((e) => typeof e === "number" ? e : e.y);
|
|
726
|
+
const count = values.length;
|
|
727
|
+
if (count === 0) return [];
|
|
728
|
+
const total = values.reduce((s, v) => s + (Number.isFinite(v) && v >= 0 ? v : 0), 0) || 1e-9;
|
|
729
|
+
const effectiveMax = props.maxValue != null && props.maxValue > 0 ? props.maxValue : Math.max(...values.filter((v) => Number.isFinite(v) && v >= 0), 1e-9);
|
|
730
|
+
const totalR = center.value - LABEL_RADIAL_OFFSET - 20;
|
|
731
|
+
const innerR = totalR * Math.max(0, Math.min(.99, props.innerRadius));
|
|
732
|
+
const totalAngularSpace = 2 * Math.PI - count * props.gap;
|
|
733
|
+
const slotAngle = Math.max(0, totalAngularSpace / count);
|
|
734
|
+
const formatValue = (v) => {
|
|
735
|
+
if (props.yAxisFormat) return props.yAxisFormat(v);
|
|
736
|
+
return String(v);
|
|
737
|
+
};
|
|
738
|
+
const categoryOf = (i) => {
|
|
739
|
+
if (props.categories[i] != null) return String(props.categories[i]);
|
|
740
|
+
const entry = raw[i];
|
|
741
|
+
if (typeof entry === "object" && entry !== null) return String(entry.x);
|
|
742
|
+
return t("origam.chart.polar_bar.item_label", i + 1);
|
|
743
|
+
};
|
|
744
|
+
return values.map((v, i) => {
|
|
745
|
+
const cat = categoryOf(i);
|
|
746
|
+
const isHidden = hiddenLabels.value.has(cat);
|
|
747
|
+
const safeVal = Number.isFinite(v) && v >= 0 ? v : 0;
|
|
748
|
+
const wedgeStart = props.startAngle + i * (slotAngle + props.gap);
|
|
749
|
+
const wedgeEnd = wedgeStart + slotAngle;
|
|
750
|
+
const midAngle = (wedgeStart + wedgeEnd) / 2;
|
|
751
|
+
const outerR = innerR + safeVal / effectiveMax * (totalR - innerR);
|
|
752
|
+
const d = arcPath(innerR, outerR, wedgeStart, wedgeEnd);
|
|
753
|
+
const labelR = outerR + LABEL_RADIAL_OFFSET;
|
|
754
|
+
const labelX = labelR * Math.cos(midAngle);
|
|
755
|
+
const labelY = labelR * Math.sin(midAngle);
|
|
756
|
+
const cosM = Math.cos(midAngle);
|
|
757
|
+
const labelAnchor = cosM > .1 ? "start" : cosM < -.1 ? "end" : "middle";
|
|
758
|
+
const pct = total > 0 ? safeVal / total * 100 : 0;
|
|
759
|
+
const percentage = `${pct.toFixed(1)}%`;
|
|
760
|
+
const showValueLabel = slotAngle >= VALUE_LABEL_MIN_ANGLE && outerR - innerR > 12;
|
|
761
|
+
const midR = (innerR + outerR) / 2;
|
|
762
|
+
const valueLabelX = midR * Math.cos(midAngle);
|
|
763
|
+
const valueLabelY = midR * Math.sin(midAngle);
|
|
764
|
+
return {
|
|
765
|
+
index: i,
|
|
766
|
+
d,
|
|
767
|
+
color: colorFor(i),
|
|
768
|
+
category: cat,
|
|
769
|
+
value: safeVal,
|
|
770
|
+
formatted: formatValue(safeVal),
|
|
771
|
+
visible: !isHidden,
|
|
772
|
+
outerR,
|
|
773
|
+
innerR,
|
|
774
|
+
startAngle: wedgeStart,
|
|
775
|
+
endAngle: wedgeEnd,
|
|
776
|
+
midAngle,
|
|
777
|
+
labelX,
|
|
778
|
+
labelY,
|
|
779
|
+
labelAnchor,
|
|
780
|
+
percentage,
|
|
781
|
+
showValueLabel,
|
|
782
|
+
valueLabelX,
|
|
783
|
+
valueLabelY
|
|
784
|
+
};
|
|
785
|
+
});
|
|
393
786
|
});
|
|
394
787
|
const visibleWedges = computed(() => wedges.value.filter((w) => w.visible));
|
|
788
|
+
/*********************************************************
|
|
789
|
+
* Legend items
|
|
790
|
+
********************************************************/
|
|
395
791
|
const legendItems = computed(() => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
792
|
+
const series = props.series?.[0];
|
|
793
|
+
if (!series) return [];
|
|
794
|
+
return wedges.value.map((w) => ({
|
|
795
|
+
series: {
|
|
796
|
+
...series,
|
|
797
|
+
name: w.category,
|
|
798
|
+
data: [w.value],
|
|
799
|
+
visible: w.visible
|
|
800
|
+
},
|
|
801
|
+
index: w.index,
|
|
802
|
+
color: w.color,
|
|
803
|
+
visible: w.visible
|
|
804
|
+
}));
|
|
805
|
+
});
|
|
806
|
+
/*********************************************************
|
|
807
|
+
* Hover / tooltip
|
|
808
|
+
********************************************************/
|
|
809
|
+
const mousePos = ref({
|
|
810
|
+
x: 0,
|
|
811
|
+
y: 0
|
|
409
812
|
});
|
|
410
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
411
813
|
const hoveredIndex = ref(null);
|
|
412
814
|
const hoveredWedge = computed(() => {
|
|
413
|
-
|
|
414
|
-
|
|
815
|
+
if (hoveredIndex.value === null) return null;
|
|
816
|
+
return visibleWedges.value.find((w) => w.index === hoveredIndex.value) ?? null;
|
|
415
817
|
});
|
|
416
818
|
const hoveredPoint = computed(() => {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
819
|
+
const w = hoveredWedge.value;
|
|
820
|
+
if (!w || !props.series?.[0]) return null;
|
|
821
|
+
return {
|
|
822
|
+
seriesIndex: 0,
|
|
823
|
+
seriesName: props.series[0].name,
|
|
824
|
+
dataIndex: w.index,
|
|
825
|
+
x: w.category,
|
|
826
|
+
y: w.value,
|
|
827
|
+
color: w.color
|
|
828
|
+
};
|
|
427
829
|
});
|
|
428
830
|
const hoveredSeries = computed(() => {
|
|
429
|
-
|
|
430
|
-
|
|
831
|
+
if (!hoveredWedge.value || !props.series?.[0]) return null;
|
|
832
|
+
return props.series[0];
|
|
431
833
|
});
|
|
432
|
-
const hoveredCategory = computed(
|
|
433
|
-
() => hoveredWedge.value?.category ?? ""
|
|
434
|
-
);
|
|
834
|
+
const hoveredCategory = computed(() => hoveredWedge.value?.category ?? "");
|
|
435
835
|
const showEmpty = computed(() => {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
836
|
+
if (!props.series?.length) return true;
|
|
837
|
+
const first = props.series[0];
|
|
838
|
+
if (!first?.data?.length) return true;
|
|
839
|
+
return visibleWedges.value.length === 0;
|
|
440
840
|
});
|
|
841
|
+
/*********************************************************
|
|
842
|
+
* Root classes / styles
|
|
843
|
+
********************************************************/
|
|
441
844
|
const rootClasses = computed(() => [
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
845
|
+
{
|
|
846
|
+
[`origam-chart-polar-bar--legend-${props.legendPosition}`]: true,
|
|
847
|
+
"origam-chart-polar-bar--no-animation": !props.animated
|
|
848
|
+
},
|
|
849
|
+
backgroundColorClasses.value,
|
|
850
|
+
elevationClasses.value,
|
|
851
|
+
marginClasses.value,
|
|
852
|
+
paddingClasses.value,
|
|
853
|
+
roundedClasses.value,
|
|
854
|
+
props.class
|
|
452
855
|
]);
|
|
453
856
|
const rootStyles = computed(() => {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
857
|
+
const out = {};
|
|
858
|
+
if (props.aspectRatio) {
|
|
859
|
+
out.aspectRatio = props.aspectRatio;
|
|
860
|
+
}
|
|
861
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
862
|
+
return [out, props.style];
|
|
460
863
|
});
|
|
461
|
-
const bodyClasses = computed(() => ({
|
|
462
|
-
|
|
463
|
-
}));
|
|
464
|
-
const svgClasses = computed(() => ({
|
|
465
|
-
"origam-chart__svg--animated": props.animated
|
|
466
|
-
}));
|
|
864
|
+
const bodyClasses = computed(() => ({ "origam-chart-polar-bar__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
865
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
467
866
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
867
|
+
/*********************************************************
|
|
868
|
+
* ARIA
|
|
869
|
+
********************************************************/
|
|
468
870
|
const defaultAriaLabel = computed(() => t("origam.chart.polar_bar.aria_label"));
|
|
469
871
|
const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
470
872
|
const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
471
873
|
const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
|
|
472
|
-
const svgDesc = computed(
|
|
473
|
-
() => t("origam.chart.polar_bar.desc", visibleWedges.value.length, { chart: defaultAriaLabel.value })
|
|
474
|
-
);
|
|
874
|
+
const svgDesc = computed(() => t("origam.chart.polar_bar.desc", visibleWedges.value.length, { chart: defaultAriaLabel.value }));
|
|
475
875
|
const wedgeAriaLabel = (wedge) => `${wedge.category}: ${wedge.formatted} (${wedge.percentage})`;
|
|
876
|
+
/*********************************************************
|
|
877
|
+
* Interaction
|
|
878
|
+
********************************************************/
|
|
476
879
|
const onWedgeEnter = (wedge) => {
|
|
477
|
-
|
|
880
|
+
hoveredIndex.value = wedge.index;
|
|
478
881
|
};
|
|
479
882
|
const onWedgeLeave = () => {
|
|
480
|
-
|
|
883
|
+
hoveredIndex.value = null;
|
|
481
884
|
};
|
|
482
885
|
const onSvgMouseMove = (event) => {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
886
|
+
const target = svgRef.value;
|
|
887
|
+
if (!target) return;
|
|
888
|
+
const rect = target.getBoundingClientRect();
|
|
889
|
+
mousePos.value = {
|
|
890
|
+
x: event.clientX - rect.left,
|
|
891
|
+
y: event.clientY - rect.top
|
|
892
|
+
};
|
|
490
893
|
};
|
|
491
894
|
const onSvgMouseLeave = () => {
|
|
492
|
-
|
|
895
|
+
onWedgeLeave();
|
|
493
896
|
};
|
|
494
897
|
const onWedgeActivate = (wedge, event) => {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
898
|
+
hoveredIndex.value = wedge.index;
|
|
899
|
+
if (hoveredPoint.value) {
|
|
900
|
+
emit("point-click", hoveredPoint.value, event);
|
|
901
|
+
}
|
|
499
902
|
};
|
|
500
903
|
const onLegendClick = (series, index) => {
|
|
501
|
-
|
|
904
|
+
emit("legend-click", series, index);
|
|
502
905
|
};
|
|
503
906
|
const onSeriesToggle = (series, nextVisible) => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
907
|
+
if (nextVisible) hiddenLabels.value.delete(series.name);
|
|
908
|
+
else hiddenLabels.value.add(series.name);
|
|
909
|
+
emit("series-toggle", series, nextVisible);
|
|
507
910
|
};
|
|
508
911
|
</script>
|
|
509
912
|
|