origam 2.38.1 → 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 +24 -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 +6 -6
|
@@ -156,10 +156,7 @@
|
|
|
156
156
|
|
|
157
157
|
<script lang="ts" setup>
|
|
158
158
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
159
|
-
import {
|
|
160
|
-
computed,
|
|
161
|
-
ref
|
|
162
|
-
} from "vue";
|
|
159
|
+
import { computed, ref } from "vue";
|
|
163
160
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
164
161
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
165
162
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
@@ -174,72 +171,431 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
174
171
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
175
172
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
176
173
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
/*********************************************************
|
|
175
|
+
* Global
|
|
176
|
+
*
|
|
177
|
+
* @description
|
|
178
|
+
* Pyramid / Funnel chart family. Renders a single series of
|
|
179
|
+
* N data points as N horizontal trapezoids stacked vertically.
|
|
180
|
+
*
|
|
181
|
+
* - `type='funnel'` — widest at top, narrowing toward bottom.
|
|
182
|
+
* Classic conversion funnel: 1000 visitors → 600 leads → …
|
|
183
|
+
* - `type='pyramid'` — narrow at top, widening toward bottom.
|
|
184
|
+
* Same data shape; direction is flipped.
|
|
185
|
+
*
|
|
186
|
+
* Legend entries are one per data point (= one per slice), keyed
|
|
187
|
+
* by category label. Clicking a legend entry hides that slice
|
|
188
|
+
* and collapses its height from the layout.
|
|
189
|
+
*
|
|
190
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
191
|
+
********************************************************/
|
|
192
|
+
defineOptions({ name: "OrigamChartPyramid" });
|
|
180
193
|
const props = defineProps({
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
194
|
+
type: {
|
|
195
|
+
type: null,
|
|
196
|
+
required: false,
|
|
197
|
+
default: "funnel"
|
|
198
|
+
},
|
|
199
|
+
sliceGap: {
|
|
200
|
+
type: Number,
|
|
201
|
+
required: false,
|
|
202
|
+
default: 0
|
|
203
|
+
},
|
|
204
|
+
labelPlacement: {
|
|
205
|
+
type: String,
|
|
206
|
+
required: false,
|
|
207
|
+
default: "auto"
|
|
208
|
+
},
|
|
209
|
+
xAxisFormat: {
|
|
210
|
+
type: Function,
|
|
211
|
+
required: false,
|
|
212
|
+
default: undefined
|
|
213
|
+
},
|
|
214
|
+
yAxisFormat: {
|
|
215
|
+
type: Function,
|
|
216
|
+
required: false,
|
|
217
|
+
default: undefined
|
|
218
|
+
},
|
|
219
|
+
series: {
|
|
220
|
+
type: Array,
|
|
221
|
+
required: true
|
|
222
|
+
},
|
|
223
|
+
categories: {
|
|
224
|
+
type: Array,
|
|
225
|
+
required: false,
|
|
226
|
+
default: () => []
|
|
227
|
+
},
|
|
228
|
+
title: {
|
|
229
|
+
type: String,
|
|
230
|
+
required: false,
|
|
231
|
+
default: undefined
|
|
232
|
+
},
|
|
233
|
+
subtitle: {
|
|
234
|
+
type: String,
|
|
235
|
+
required: false,
|
|
236
|
+
default: undefined
|
|
237
|
+
},
|
|
238
|
+
showLegend: {
|
|
239
|
+
type: Boolean,
|
|
240
|
+
required: false,
|
|
241
|
+
default: true
|
|
242
|
+
},
|
|
243
|
+
legendPosition: {
|
|
244
|
+
type: null,
|
|
245
|
+
required: false,
|
|
246
|
+
default: "bottom"
|
|
247
|
+
},
|
|
248
|
+
showTooltip: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
required: false,
|
|
251
|
+
default: true
|
|
252
|
+
},
|
|
253
|
+
animated: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
required: false,
|
|
256
|
+
default: true
|
|
257
|
+
},
|
|
258
|
+
animationDuration: {
|
|
259
|
+
type: Number,
|
|
260
|
+
required: false,
|
|
261
|
+
default: 600
|
|
262
|
+
},
|
|
263
|
+
colorScheme: {
|
|
264
|
+
type: Array,
|
|
265
|
+
required: false,
|
|
266
|
+
default: () => []
|
|
267
|
+
},
|
|
268
|
+
aspectRatio: {
|
|
269
|
+
type: String,
|
|
270
|
+
required: false,
|
|
271
|
+
default: undefined
|
|
272
|
+
},
|
|
273
|
+
id: {
|
|
274
|
+
type: String,
|
|
275
|
+
required: false
|
|
276
|
+
},
|
|
277
|
+
class: {
|
|
278
|
+
type: [
|
|
279
|
+
String,
|
|
280
|
+
Array,
|
|
281
|
+
Object
|
|
282
|
+
],
|
|
283
|
+
required: false
|
|
284
|
+
},
|
|
285
|
+
style: {
|
|
286
|
+
type: [
|
|
287
|
+
String,
|
|
288
|
+
Array,
|
|
289
|
+
Object,
|
|
290
|
+
Boolean,
|
|
291
|
+
null
|
|
292
|
+
],
|
|
293
|
+
required: false,
|
|
294
|
+
skipCheck: true
|
|
295
|
+
},
|
|
296
|
+
height: {
|
|
297
|
+
type: [Number, String],
|
|
298
|
+
required: false,
|
|
299
|
+
default: 360
|
|
300
|
+
},
|
|
301
|
+
maxHeight: {
|
|
302
|
+
type: [Number, String],
|
|
303
|
+
required: false
|
|
304
|
+
},
|
|
305
|
+
maxWidth: {
|
|
306
|
+
type: [Number, String],
|
|
307
|
+
required: false
|
|
308
|
+
},
|
|
309
|
+
minHeight: {
|
|
310
|
+
type: [Number, String],
|
|
311
|
+
required: false
|
|
312
|
+
},
|
|
313
|
+
minWidth: {
|
|
314
|
+
type: [Number, String],
|
|
315
|
+
required: false
|
|
316
|
+
},
|
|
317
|
+
width: {
|
|
318
|
+
type: [Number, String],
|
|
319
|
+
required: false
|
|
320
|
+
},
|
|
321
|
+
margin: {
|
|
322
|
+
type: [
|
|
323
|
+
Boolean,
|
|
324
|
+
Number,
|
|
325
|
+
String
|
|
326
|
+
],
|
|
327
|
+
required: false
|
|
328
|
+
},
|
|
329
|
+
marginTop: {
|
|
330
|
+
type: [
|
|
331
|
+
Boolean,
|
|
332
|
+
Number,
|
|
333
|
+
String
|
|
334
|
+
],
|
|
335
|
+
required: false
|
|
336
|
+
},
|
|
337
|
+
marginLeft: {
|
|
338
|
+
type: [
|
|
339
|
+
Boolean,
|
|
340
|
+
Number,
|
|
341
|
+
String
|
|
342
|
+
],
|
|
343
|
+
required: false
|
|
344
|
+
},
|
|
345
|
+
marginBottom: {
|
|
346
|
+
type: [
|
|
347
|
+
Boolean,
|
|
348
|
+
Number,
|
|
349
|
+
String
|
|
350
|
+
],
|
|
351
|
+
required: false
|
|
352
|
+
},
|
|
353
|
+
marginRight: {
|
|
354
|
+
type: [
|
|
355
|
+
Boolean,
|
|
356
|
+
Number,
|
|
357
|
+
String
|
|
358
|
+
],
|
|
359
|
+
required: false
|
|
360
|
+
},
|
|
361
|
+
marginBlock: {
|
|
362
|
+
type: [
|
|
363
|
+
Boolean,
|
|
364
|
+
Number,
|
|
365
|
+
String
|
|
366
|
+
],
|
|
367
|
+
required: false
|
|
368
|
+
},
|
|
369
|
+
marginInline: {
|
|
370
|
+
type: [
|
|
371
|
+
Boolean,
|
|
372
|
+
Number,
|
|
373
|
+
String
|
|
374
|
+
],
|
|
375
|
+
required: false
|
|
376
|
+
},
|
|
377
|
+
marginInlineStart: {
|
|
378
|
+
type: [
|
|
379
|
+
Boolean,
|
|
380
|
+
Number,
|
|
381
|
+
String
|
|
382
|
+
],
|
|
383
|
+
required: false
|
|
384
|
+
},
|
|
385
|
+
marginInlineEnd: {
|
|
386
|
+
type: [
|
|
387
|
+
Boolean,
|
|
388
|
+
Number,
|
|
389
|
+
String
|
|
390
|
+
],
|
|
391
|
+
required: false
|
|
392
|
+
},
|
|
393
|
+
marginBlockStart: {
|
|
394
|
+
type: [
|
|
395
|
+
Boolean,
|
|
396
|
+
Number,
|
|
397
|
+
String
|
|
398
|
+
],
|
|
399
|
+
required: false
|
|
400
|
+
},
|
|
401
|
+
marginBlockEnd: {
|
|
402
|
+
type: [
|
|
403
|
+
Boolean,
|
|
404
|
+
Number,
|
|
405
|
+
String
|
|
406
|
+
],
|
|
407
|
+
required: false
|
|
408
|
+
},
|
|
409
|
+
padding: {
|
|
410
|
+
type: [
|
|
411
|
+
Boolean,
|
|
412
|
+
Number,
|
|
413
|
+
String
|
|
414
|
+
],
|
|
415
|
+
required: false
|
|
416
|
+
},
|
|
417
|
+
paddingTop: {
|
|
418
|
+
type: [
|
|
419
|
+
Boolean,
|
|
420
|
+
Number,
|
|
421
|
+
String
|
|
422
|
+
],
|
|
423
|
+
required: false
|
|
424
|
+
},
|
|
425
|
+
paddingLeft: {
|
|
426
|
+
type: [
|
|
427
|
+
Boolean,
|
|
428
|
+
Number,
|
|
429
|
+
String
|
|
430
|
+
],
|
|
431
|
+
required: false
|
|
432
|
+
},
|
|
433
|
+
paddingBottom: {
|
|
434
|
+
type: [
|
|
435
|
+
Boolean,
|
|
436
|
+
Number,
|
|
437
|
+
String
|
|
438
|
+
],
|
|
439
|
+
required: false
|
|
440
|
+
},
|
|
441
|
+
paddingRight: {
|
|
442
|
+
type: [
|
|
443
|
+
Boolean,
|
|
444
|
+
Number,
|
|
445
|
+
String
|
|
446
|
+
],
|
|
447
|
+
required: false
|
|
448
|
+
},
|
|
449
|
+
paddingBlock: {
|
|
450
|
+
type: [
|
|
451
|
+
Boolean,
|
|
452
|
+
Number,
|
|
453
|
+
String
|
|
454
|
+
],
|
|
455
|
+
required: false
|
|
456
|
+
},
|
|
457
|
+
paddingInline: {
|
|
458
|
+
type: [
|
|
459
|
+
Boolean,
|
|
460
|
+
Number,
|
|
461
|
+
String
|
|
462
|
+
],
|
|
463
|
+
required: false
|
|
464
|
+
},
|
|
465
|
+
paddingInlineStart: {
|
|
466
|
+
type: [
|
|
467
|
+
Boolean,
|
|
468
|
+
Number,
|
|
469
|
+
String
|
|
470
|
+
],
|
|
471
|
+
required: false
|
|
472
|
+
},
|
|
473
|
+
paddingInlineEnd: {
|
|
474
|
+
type: [
|
|
475
|
+
Boolean,
|
|
476
|
+
Number,
|
|
477
|
+
String
|
|
478
|
+
],
|
|
479
|
+
required: false
|
|
480
|
+
},
|
|
481
|
+
paddingBlockStart: {
|
|
482
|
+
type: [
|
|
483
|
+
Boolean,
|
|
484
|
+
Number,
|
|
485
|
+
String
|
|
486
|
+
],
|
|
487
|
+
required: false
|
|
488
|
+
},
|
|
489
|
+
paddingBlockEnd: {
|
|
490
|
+
type: [
|
|
491
|
+
Boolean,
|
|
492
|
+
Number,
|
|
493
|
+
String
|
|
494
|
+
],
|
|
495
|
+
required: false
|
|
496
|
+
},
|
|
497
|
+
rounded: {
|
|
498
|
+
type: [
|
|
499
|
+
Boolean,
|
|
500
|
+
Number,
|
|
501
|
+
String,
|
|
502
|
+
null
|
|
503
|
+
],
|
|
504
|
+
required: false,
|
|
505
|
+
skipCheck: true
|
|
506
|
+
},
|
|
507
|
+
roundedTopRight: {
|
|
508
|
+
type: [
|
|
509
|
+
Boolean,
|
|
510
|
+
Number,
|
|
511
|
+
String
|
|
512
|
+
],
|
|
513
|
+
required: false
|
|
514
|
+
},
|
|
515
|
+
roundedTopLeft: {
|
|
516
|
+
type: [
|
|
517
|
+
Boolean,
|
|
518
|
+
Number,
|
|
519
|
+
String
|
|
520
|
+
],
|
|
521
|
+
required: false
|
|
522
|
+
},
|
|
523
|
+
roundedBottomLeft: {
|
|
524
|
+
type: [
|
|
525
|
+
Boolean,
|
|
526
|
+
Number,
|
|
527
|
+
String
|
|
528
|
+
],
|
|
529
|
+
required: false
|
|
530
|
+
},
|
|
531
|
+
roundedBottomRight: {
|
|
532
|
+
type: [
|
|
533
|
+
Boolean,
|
|
534
|
+
Number,
|
|
535
|
+
String
|
|
536
|
+
],
|
|
537
|
+
required: false
|
|
538
|
+
},
|
|
539
|
+
roundedStartStart: {
|
|
540
|
+
type: [
|
|
541
|
+
Boolean,
|
|
542
|
+
Number,
|
|
543
|
+
String
|
|
544
|
+
],
|
|
545
|
+
required: false
|
|
546
|
+
},
|
|
547
|
+
roundedStartEnd: {
|
|
548
|
+
type: [
|
|
549
|
+
Boolean,
|
|
550
|
+
Number,
|
|
551
|
+
String
|
|
552
|
+
],
|
|
553
|
+
required: false
|
|
554
|
+
},
|
|
555
|
+
roundedEndStart: {
|
|
556
|
+
type: [
|
|
557
|
+
Boolean,
|
|
558
|
+
Number,
|
|
559
|
+
String
|
|
560
|
+
],
|
|
561
|
+
required: false
|
|
562
|
+
},
|
|
563
|
+
roundedEndEnd: {
|
|
564
|
+
type: [
|
|
565
|
+
Boolean,
|
|
566
|
+
Number,
|
|
567
|
+
String
|
|
568
|
+
],
|
|
569
|
+
required: false
|
|
570
|
+
},
|
|
571
|
+
elevation: {
|
|
572
|
+
type: [Number, String],
|
|
573
|
+
required: false
|
|
574
|
+
},
|
|
575
|
+
bgColor: {
|
|
576
|
+
type: [
|
|
577
|
+
String,
|
|
578
|
+
Object,
|
|
579
|
+
Boolean,
|
|
580
|
+
null
|
|
581
|
+
],
|
|
582
|
+
required: false,
|
|
583
|
+
skipCheck: true
|
|
584
|
+
},
|
|
585
|
+
fontSize: {
|
|
586
|
+
type: null,
|
|
587
|
+
required: false
|
|
588
|
+
},
|
|
589
|
+
fontWeight: {
|
|
590
|
+
type: null,
|
|
591
|
+
required: false
|
|
592
|
+
}
|
|
241
593
|
});
|
|
242
|
-
const emit = defineEmits([
|
|
594
|
+
const emit = defineEmits([
|
|
595
|
+
"point-click",
|
|
596
|
+
"legend-click",
|
|
597
|
+
"series-toggle"
|
|
598
|
+
]);
|
|
243
599
|
defineSlots();
|
|
244
600
|
const { t } = useLocale();
|
|
245
601
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -250,242 +606,321 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
250
606
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
251
607
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
252
608
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
609
|
+
/*********************************************************
|
|
610
|
+
* Static SVG box — the component always paints into
|
|
611
|
+
* a fixed 600 × 400 coordinate space; CSS scales it.
|
|
612
|
+
********************************************************/
|
|
253
613
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.pyramid);
|
|
254
614
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
255
|
-
const PADDING = {
|
|
615
|
+
const PADDING = {
|
|
616
|
+
top: 20,
|
|
617
|
+
right: 120,
|
|
618
|
+
bottom: 20,
|
|
619
|
+
left: 20
|
|
620
|
+
};
|
|
256
621
|
const LABEL_FITS_INSIDE_MIN_HEIGHT = 18;
|
|
257
622
|
const LABEL_FITS_INSIDE_MIN_WIDTH = 90;
|
|
258
623
|
const LABEL_OUTSIDE_X_OFFSET = 10;
|
|
624
|
+
/*********************************************************
|
|
625
|
+
* Default colour palette — mirrors useChart's DEFAULT_PALETTE
|
|
626
|
+
********************************************************/
|
|
259
627
|
const DEFAULT_PALETTE = [
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
628
|
+
"primary",
|
|
629
|
+
"success",
|
|
630
|
+
"warning",
|
|
631
|
+
"danger",
|
|
632
|
+
"info",
|
|
633
|
+
"secondary",
|
|
634
|
+
"ghost",
|
|
635
|
+
"neutral"
|
|
268
636
|
];
|
|
269
637
|
const resolveColor = (raw) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
638
|
+
if (!raw) return "currentColor";
|
|
639
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
640
|
+
return raw;
|
|
641
|
+
}
|
|
642
|
+
if (isIntent(raw)) {
|
|
643
|
+
return intentBgExpr(raw, "default");
|
|
644
|
+
}
|
|
645
|
+
return "currentColor";
|
|
278
646
|
};
|
|
279
647
|
const colorFor = (dataIndex) => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
648
|
+
const series = props.series?.[0];
|
|
649
|
+
if (series?.color) return resolveColor(series.color);
|
|
650
|
+
const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
|
|
651
|
+
return resolveColor(scheme[dataIndex % scheme.length]);
|
|
284
652
|
};
|
|
285
|
-
|
|
653
|
+
/*********************************************************
|
|
654
|
+
* Legend — hidden-label set keyed by category string
|
|
655
|
+
********************************************************/
|
|
656
|
+
const hiddenLabels = ref(new Set());
|
|
286
657
|
const categoryLabel = (index) => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
658
|
+
const cat = props.categories[index];
|
|
659
|
+
if (cat != null) return String(cat);
|
|
660
|
+
const series = props.series?.[0];
|
|
661
|
+
if (!series) return t("origam.chart.pyramid.slice_label", index + 1);
|
|
662
|
+
const entry = series.data[index];
|
|
663
|
+
if (typeof entry === "object" && entry !== null) return String(entry.x);
|
|
664
|
+
return t("origam.chart.pyramid.slice_label", index + 1);
|
|
294
665
|
};
|
|
295
666
|
const formatValue = (v) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
667
|
+
if (props.yAxisFormat) return props.yAxisFormat(v);
|
|
668
|
+
if (props.xAxisFormat) return String(props.xAxisFormat(v));
|
|
669
|
+
return String(v);
|
|
299
670
|
};
|
|
671
|
+
/*********************************************************
|
|
672
|
+
* Geometry — canonical pyramid / funnel
|
|
673
|
+
*
|
|
674
|
+
* Canonical pyramid (Highcharts-style): the WHOLE chart is a
|
|
675
|
+
* single triangular silhouette divided into horizontal bands.
|
|
676
|
+
* - The silhouette is fixed (top width vs bottom width).
|
|
677
|
+
* - Each band's HEIGHT is proportional to its value (NOT
|
|
678
|
+
* its width — width is a function of vertical position
|
|
679
|
+
* on the linear taper).
|
|
680
|
+
* - Adjacent bands share their common edge → no kinks, no
|
|
681
|
+
* gaps, the outline reads as a single triangle.
|
|
682
|
+
*
|
|
683
|
+
* `funnel` — silhouette = inverted triangle. Top = full width,
|
|
684
|
+
* bottom = narrow band. Largest value sits at top,
|
|
685
|
+
* smallest at bottom.
|
|
686
|
+
* `pyramid` — silhouette = upright triangle. Top = narrow band,
|
|
687
|
+
* bottom = full width. Smallest at top, largest at
|
|
688
|
+
* bottom (data reversed internally so the consumer
|
|
689
|
+
* can pass descending values).
|
|
690
|
+
*
|
|
691
|
+
* Each band is a trapezoid. Width at any Y is linearly
|
|
692
|
+
* interpolated between silhouette top-width and bottom-width:
|
|
693
|
+
* w(α) = topW + (botW - topW) · α with α = (y - y0) / H
|
|
694
|
+
********************************************************/
|
|
300
695
|
const slices = computed(() => {
|
|
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
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
-
|
|
696
|
+
const series = props.series?.[0];
|
|
697
|
+
if (!series || !series.data?.length) return [];
|
|
698
|
+
const raw = series.data;
|
|
699
|
+
const values = raw.map((e) => typeof e === "number" ? e : e.y);
|
|
700
|
+
const count = values.length;
|
|
701
|
+
if (count === 0) return [];
|
|
702
|
+
const total = values.reduce((s, v) => s + (Number.isFinite(v) && v >= 0 ? v : 0), 0) || 1e-9;
|
|
703
|
+
const x0 = PADDING.left;
|
|
704
|
+
const x1 = svgWidth.value - PADDING.right;
|
|
705
|
+
const y0 = PADDING.top;
|
|
706
|
+
const y1 = svgHeight.value - PADDING.bottom;
|
|
707
|
+
const cx = (x0 + x1) / 2;
|
|
708
|
+
const plotW = x1 - x0;
|
|
709
|
+
const totalH = y1 - y0;
|
|
710
|
+
const isFunnel = props.type !== "pyramid";
|
|
711
|
+
/*
|
|
712
|
+
* Silhouette endpoints — fraction of plotW. TIP_FRACTION=0
|
|
713
|
+
* gives a true point at the narrow end (canonical funnel /
|
|
714
|
+
* pyramid). Labels on the narrow-end band auto-relocate
|
|
715
|
+
* outside via labelFitsInside when the band gets too short.
|
|
716
|
+
*
|
|
717
|
+
* Funnel: top = full width → bottom = 0 (point)
|
|
718
|
+
* Pyramid: top = 0 (point) → bottom = full width
|
|
719
|
+
*/
|
|
720
|
+
const TIP_FRACTION = 0;
|
|
721
|
+
const topSilhouette = isFunnel ? plotW : plotW * TIP_FRACTION;
|
|
722
|
+
const botSilhouette = isFunnel ? plotW * TIP_FRACTION : plotW;
|
|
723
|
+
const widthAt = (alpha) => topSilhouette + (botSilhouette - topSilhouette) * Math.max(0, Math.min(1, alpha));
|
|
724
|
+
/*
|
|
725
|
+
* Data-index mapping. Funnel renders in array order. Pyramid
|
|
726
|
+
* reverses so the consumer-supplied descending list becomes
|
|
727
|
+
* smallest-at-top, largest-at-bottom — the canonical pyramid.
|
|
728
|
+
*/
|
|
729
|
+
const dataIndexForSlot = (slot) => isFunnel ? slot : count - 1 - slot;
|
|
730
|
+
/*
|
|
731
|
+
* Visible band heights are proportional to their values
|
|
732
|
+
* relative to the total — that is the defining property of
|
|
733
|
+
* the canonical pyramid (height ∝ value, width = linear
|
|
734
|
+
* interpolation along Y). Optional sliceGap is subtracted
|
|
735
|
+
* from the available vertical space; default = 0 so the
|
|
736
|
+
* silhouette stays unbroken.
|
|
737
|
+
*/
|
|
738
|
+
const gap = props.sliceGap ?? 0;
|
|
739
|
+
const usableH = Math.max(totalH - gap * Math.max(0, count - 1), 1);
|
|
740
|
+
const result = [];
|
|
741
|
+
let cursorY = y0;
|
|
742
|
+
for (let slot = 0; slot < count; slot++) {
|
|
743
|
+
const dataIdx = dataIndexForSlot(slot);
|
|
744
|
+
const cat = categoryLabel(dataIdx);
|
|
745
|
+
const isHidden = hiddenLabels.value.has(cat);
|
|
746
|
+
const v = Number.isFinite(values[dataIdx]) && values[dataIdx] >= 0 ? values[dataIdx] : 0;
|
|
747
|
+
const bandH = v / total * usableH;
|
|
748
|
+
const slotTop = cursorY;
|
|
749
|
+
const slotBot = slotTop + bandH;
|
|
750
|
+
const alphaTop = (slotTop - y0) / totalH;
|
|
751
|
+
const alphaBot = (slotBot - y0) / totalH;
|
|
752
|
+
const topW = widthAt(alphaTop);
|
|
753
|
+
const botW = widthAt(alphaBot);
|
|
754
|
+
const tl = cx - topW / 2;
|
|
755
|
+
const tr = cx + topW / 2;
|
|
756
|
+
const br = cx + botW / 2;
|
|
757
|
+
const bl = cx - botW / 2;
|
|
758
|
+
const d = `M ${tl},${slotTop} L ${tr},${slotTop} L ${br},${slotBot} L ${bl},${slotBot} Z`;
|
|
759
|
+
const labelY = (slotTop + slotBot) / 2;
|
|
760
|
+
/*
|
|
761
|
+
* Inside-fit requires BOTH enough vertical room AND enough
|
|
762
|
+
* width at the band's midpoint to host the label text.
|
|
763
|
+
* For the narrow tip of a pyramid / funnel the band is
|
|
764
|
+
* tall but ~0px wide → label must go outside.
|
|
765
|
+
*/
|
|
766
|
+
const alphaMid = (labelY - y0) / totalH;
|
|
767
|
+
const midW = widthAt(alphaMid);
|
|
768
|
+
const labelFitsInside = bandH >= LABEL_FITS_INSIDE_MIN_HEIGHT && midW >= LABEL_FITS_INSIDE_MIN_WIDTH;
|
|
769
|
+
const labelAnchor = labelFitsInside ? "middle" : "start";
|
|
770
|
+
const leaderX = cx + midW / 2;
|
|
771
|
+
const labelX = labelFitsInside ? cx : leaderX + LABEL_OUTSIDE_X_OFFSET;
|
|
772
|
+
cursorY = slotBot + gap;
|
|
773
|
+
result.push({
|
|
774
|
+
labelAnchor,
|
|
775
|
+
leaderX,
|
|
776
|
+
index: dataIdx,
|
|
777
|
+
d,
|
|
778
|
+
color: colorFor(dataIdx),
|
|
779
|
+
category: cat,
|
|
780
|
+
value: v,
|
|
781
|
+
formatted: formatValue(v),
|
|
782
|
+
visible: !isHidden,
|
|
783
|
+
labelX,
|
|
784
|
+
labelY,
|
|
785
|
+
labelFitsInside
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
return result;
|
|
366
789
|
});
|
|
367
790
|
const visibleSlices = computed(() => slices.value.filter((s) => s.visible));
|
|
368
|
-
const outsideLabelSlices = computed(
|
|
369
|
-
|
|
370
|
-
)
|
|
791
|
+
const outsideLabelSlices = computed(() => visibleSlices.value.filter((s) => effectiveLabelPlacement(s) === "outside"));
|
|
792
|
+
/*********************************************************
|
|
793
|
+
* Legend items — one per data point (slice), keyed by
|
|
794
|
+
* category label. Mirrors the polar single-ring pattern.
|
|
795
|
+
********************************************************/
|
|
371
796
|
const legendItems = computed(() => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
797
|
+
const series = props.series?.[0];
|
|
798
|
+
if (!series) return [];
|
|
799
|
+
return slices.value.map((slice) => ({
|
|
800
|
+
series: {
|
|
801
|
+
...series,
|
|
802
|
+
name: slice.category,
|
|
803
|
+
data: [slice.value],
|
|
804
|
+
visible: slice.visible
|
|
805
|
+
},
|
|
806
|
+
index: slice.index,
|
|
807
|
+
color: slice.color,
|
|
808
|
+
visible: slice.visible
|
|
809
|
+
}));
|
|
385
810
|
});
|
|
811
|
+
/*********************************************************
|
|
812
|
+
* Effective label placement
|
|
813
|
+
********************************************************/
|
|
386
814
|
const effectiveLabelPlacement = (slice) => {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
815
|
+
if (props.labelPlacement === "inside") return "inside";
|
|
816
|
+
if (props.labelPlacement === "outside") return "outside";
|
|
817
|
+
return slice.labelFitsInside ? "inside" : "outside";
|
|
390
818
|
};
|
|
391
|
-
|
|
819
|
+
/*********************************************************
|
|
820
|
+
* Hover / tooltip
|
|
821
|
+
********************************************************/
|
|
822
|
+
const mousePos = ref({
|
|
823
|
+
x: 0,
|
|
824
|
+
y: 0
|
|
825
|
+
});
|
|
392
826
|
const hoveredIndex = ref(null);
|
|
393
827
|
const hoveredSlice = computed(() => {
|
|
394
|
-
|
|
395
|
-
|
|
828
|
+
if (hoveredIndex.value === null) return null;
|
|
829
|
+
return visibleSlices.value.find((s) => s.index === hoveredIndex.value) ?? null;
|
|
396
830
|
});
|
|
397
831
|
const hoveredPoint = computed(() => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
832
|
+
const s = hoveredSlice.value;
|
|
833
|
+
if (!s || !props.series?.[0]) return null;
|
|
834
|
+
return {
|
|
835
|
+
seriesIndex: 0,
|
|
836
|
+
seriesName: props.series[0].name,
|
|
837
|
+
dataIndex: s.index,
|
|
838
|
+
x: s.category,
|
|
839
|
+
y: s.value,
|
|
840
|
+
color: s.color
|
|
841
|
+
};
|
|
408
842
|
});
|
|
409
843
|
const hoveredSeries = computed(() => {
|
|
410
|
-
|
|
411
|
-
|
|
844
|
+
if (!hoveredSlice.value || !props.series?.[0]) return null;
|
|
845
|
+
return props.series[0];
|
|
412
846
|
});
|
|
413
|
-
const hoveredCategory = computed(
|
|
414
|
-
() => hoveredSlice.value?.category ?? ""
|
|
415
|
-
);
|
|
847
|
+
const hoveredCategory = computed(() => hoveredSlice.value?.category ?? "");
|
|
416
848
|
const showEmpty = computed(() => {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
849
|
+
if (!props.series?.length) return true;
|
|
850
|
+
const first = props.series[0];
|
|
851
|
+
if (!first?.data?.length) return true;
|
|
852
|
+
return visibleSlices.value.length === 0;
|
|
421
853
|
});
|
|
854
|
+
/*********************************************************
|
|
855
|
+
* Root classes / styles
|
|
856
|
+
********************************************************/
|
|
422
857
|
const rootClasses = computed(() => [
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
858
|
+
{
|
|
859
|
+
[`origam-chart-pyramid--${props.type}`]: true,
|
|
860
|
+
[`origam-chart-pyramid--legend-${props.legendPosition}`]: true,
|
|
861
|
+
"origam-chart-pyramid--no-animation": !props.animated
|
|
862
|
+
},
|
|
863
|
+
backgroundColorClasses.value,
|
|
864
|
+
elevationClasses.value,
|
|
865
|
+
marginClasses.value,
|
|
866
|
+
paddingClasses.value,
|
|
867
|
+
roundedClasses.value,
|
|
868
|
+
props.class
|
|
434
869
|
]);
|
|
435
870
|
const rootStyles = computed(() => {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
871
|
+
const out = {};
|
|
872
|
+
if (props.aspectRatio) {
|
|
873
|
+
out.aspectRatio = props.aspectRatio;
|
|
874
|
+
}
|
|
875
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
876
|
+
return [out, props.style];
|
|
442
877
|
});
|
|
443
|
-
const bodyClasses = computed(() => ({
|
|
444
|
-
|
|
445
|
-
}));
|
|
446
|
-
const svgClasses = computed(() => ({
|
|
447
|
-
"origam-chart__svg--animated": props.animated
|
|
448
|
-
}));
|
|
878
|
+
const bodyClasses = computed(() => ({ "origam-chart-pyramid__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
879
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
449
880
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
881
|
+
/*********************************************************
|
|
882
|
+
* ARIA
|
|
883
|
+
********************************************************/
|
|
450
884
|
const defaultAriaLabel = computed(() => t(`origam.chart.pyramid.aria_label_${props.type}`));
|
|
451
885
|
const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
452
886
|
const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
453
887
|
const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
|
|
454
|
-
const svgDesc = computed(
|
|
455
|
-
() => t("origam.chart.pyramid.desc", visibleSlices.value.length, { chart: defaultAriaLabel.value })
|
|
456
|
-
);
|
|
888
|
+
const svgDesc = computed(() => t("origam.chart.pyramid.desc", visibleSlices.value.length, { chart: defaultAriaLabel.value }));
|
|
457
889
|
const sliceAriaLabel = (slice) => `${slice.category}: ${slice.formatted}`;
|
|
890
|
+
/*********************************************************
|
|
891
|
+
* Interaction
|
|
892
|
+
********************************************************/
|
|
458
893
|
const onSliceEnter = (slice) => {
|
|
459
|
-
|
|
894
|
+
hoveredIndex.value = slice.index;
|
|
460
895
|
};
|
|
461
896
|
const onSliceLeave = () => {
|
|
462
|
-
|
|
897
|
+
hoveredIndex.value = null;
|
|
463
898
|
};
|
|
464
899
|
const onSvgMouseMove = (event) => {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
900
|
+
const target = svgRef.value;
|
|
901
|
+
if (!target) return;
|
|
902
|
+
const rect = target.getBoundingClientRect();
|
|
903
|
+
mousePos.value = {
|
|
904
|
+
x: event.clientX - rect.left,
|
|
905
|
+
y: event.clientY - rect.top
|
|
906
|
+
};
|
|
472
907
|
};
|
|
473
908
|
const onSvgMouseLeave = () => {
|
|
474
|
-
|
|
909
|
+
onSliceLeave();
|
|
475
910
|
};
|
|
476
911
|
const onSliceActivate = (slice, event) => {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
912
|
+
hoveredIndex.value = slice.index;
|
|
913
|
+
if (hoveredPoint.value) {
|
|
914
|
+
emit("point-click", hoveredPoint.value, event);
|
|
915
|
+
}
|
|
481
916
|
};
|
|
482
917
|
const onLegendClick = (series, index) => {
|
|
483
|
-
|
|
918
|
+
emit("legend-click", series, index);
|
|
484
919
|
};
|
|
485
920
|
const onSeriesToggle = (series, nextVisible) => {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
921
|
+
if (nextVisible) hiddenLabels.value.delete(series.name);
|
|
922
|
+
else hiddenLabels.value.add(series.name);
|
|
923
|
+
emit("series-toggle", series, nextVisible);
|
|
489
924
|
};
|
|
490
925
|
</script>
|
|
491
926
|
|