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
|
@@ -296,10 +296,7 @@
|
|
|
296
296
|
|
|
297
297
|
<script lang="ts" setup>
|
|
298
298
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
299
|
-
import {
|
|
300
|
-
computed,
|
|
301
|
-
ref
|
|
302
|
-
} from "vue";
|
|
299
|
+
import { computed, ref } from "vue";
|
|
303
300
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
304
301
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
305
302
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
@@ -315,77 +312,451 @@ import { usePadding } from "../../composables/Commons/padding.composable";
|
|
|
315
312
|
import { usePassedProps } from "../../composables/Commons/passedProps.composable";
|
|
316
313
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
317
314
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
315
|
+
/*********************************************************
|
|
316
|
+
* Global
|
|
317
|
+
*
|
|
318
|
+
* @description
|
|
319
|
+
* Pareto chart family. Combines vertical columns sorted
|
|
320
|
+
* descending by value with a cumulative percentage line
|
|
321
|
+
* overlaid on a secondary right Y-axis.
|
|
322
|
+
*
|
|
323
|
+
* Classic uses: quality control, root-cause analysis,
|
|
324
|
+
* the 80/20 rule (Pareto principle).
|
|
325
|
+
*
|
|
326
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
327
|
+
********************************************************/
|
|
328
|
+
defineOptions({ name: "OrigamChartPareto" });
|
|
321
329
|
const props = defineProps({
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
330
|
+
barColor: {
|
|
331
|
+
type: null,
|
|
332
|
+
required: false,
|
|
333
|
+
default: "primary"
|
|
334
|
+
},
|
|
335
|
+
lineColor: {
|
|
336
|
+
type: null,
|
|
337
|
+
required: false,
|
|
338
|
+
default: "danger"
|
|
339
|
+
},
|
|
340
|
+
barGap: {
|
|
341
|
+
type: Number,
|
|
342
|
+
required: false,
|
|
343
|
+
default: 4
|
|
344
|
+
},
|
|
345
|
+
showLine: {
|
|
346
|
+
type: Boolean,
|
|
347
|
+
required: false,
|
|
348
|
+
default: true
|
|
349
|
+
},
|
|
350
|
+
showLabel: {
|
|
351
|
+
type: Boolean,
|
|
352
|
+
required: false,
|
|
353
|
+
default: false
|
|
354
|
+
},
|
|
355
|
+
showAxis: {
|
|
356
|
+
type: Boolean,
|
|
357
|
+
required: false,
|
|
358
|
+
default: true
|
|
359
|
+
},
|
|
360
|
+
showGrid: {
|
|
361
|
+
type: Boolean,
|
|
362
|
+
required: false,
|
|
363
|
+
default: true
|
|
364
|
+
},
|
|
365
|
+
xAxisFormat: {
|
|
366
|
+
type: Function,
|
|
367
|
+
required: false,
|
|
368
|
+
default: undefined
|
|
369
|
+
},
|
|
370
|
+
yAxisFormat: {
|
|
371
|
+
type: Function,
|
|
372
|
+
required: false,
|
|
373
|
+
default: undefined
|
|
374
|
+
},
|
|
375
|
+
cumulativeFormat: {
|
|
376
|
+
type: Function,
|
|
377
|
+
required: false,
|
|
378
|
+
default: undefined
|
|
379
|
+
},
|
|
380
|
+
series: {
|
|
381
|
+
type: Array,
|
|
382
|
+
required: true
|
|
383
|
+
},
|
|
384
|
+
categories: {
|
|
385
|
+
type: Array,
|
|
386
|
+
required: false,
|
|
387
|
+
default: () => []
|
|
388
|
+
},
|
|
389
|
+
title: {
|
|
390
|
+
type: String,
|
|
391
|
+
required: false,
|
|
392
|
+
default: undefined
|
|
393
|
+
},
|
|
394
|
+
subtitle: {
|
|
395
|
+
type: String,
|
|
396
|
+
required: false,
|
|
397
|
+
default: undefined
|
|
398
|
+
},
|
|
399
|
+
showLegend: {
|
|
400
|
+
type: Boolean,
|
|
401
|
+
required: false,
|
|
402
|
+
default: true
|
|
403
|
+
},
|
|
404
|
+
legendPosition: {
|
|
405
|
+
type: null,
|
|
406
|
+
required: false,
|
|
407
|
+
default: "bottom"
|
|
408
|
+
},
|
|
409
|
+
showTooltip: {
|
|
410
|
+
type: Boolean,
|
|
411
|
+
required: false,
|
|
412
|
+
default: true
|
|
413
|
+
},
|
|
414
|
+
animated: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
required: false,
|
|
417
|
+
default: true
|
|
418
|
+
},
|
|
419
|
+
animationDuration: {
|
|
420
|
+
type: Number,
|
|
421
|
+
required: false,
|
|
422
|
+
default: 600
|
|
423
|
+
},
|
|
424
|
+
colorScheme: {
|
|
425
|
+
type: Array,
|
|
426
|
+
required: false,
|
|
427
|
+
default: () => []
|
|
428
|
+
},
|
|
429
|
+
aspectRatio: {
|
|
430
|
+
type: String,
|
|
431
|
+
required: false,
|
|
432
|
+
default: undefined
|
|
433
|
+
},
|
|
434
|
+
id: {
|
|
435
|
+
type: String,
|
|
436
|
+
required: false
|
|
437
|
+
},
|
|
438
|
+
class: {
|
|
439
|
+
type: [
|
|
440
|
+
String,
|
|
441
|
+
Array,
|
|
442
|
+
Object
|
|
443
|
+
],
|
|
444
|
+
required: false
|
|
445
|
+
},
|
|
446
|
+
style: {
|
|
447
|
+
type: [
|
|
448
|
+
String,
|
|
449
|
+
Array,
|
|
450
|
+
Object,
|
|
451
|
+
Boolean,
|
|
452
|
+
null
|
|
453
|
+
],
|
|
454
|
+
required: false,
|
|
455
|
+
skipCheck: true
|
|
456
|
+
},
|
|
457
|
+
height: {
|
|
458
|
+
type: [Number, String],
|
|
459
|
+
required: false,
|
|
460
|
+
default: 360
|
|
461
|
+
},
|
|
462
|
+
maxHeight: {
|
|
463
|
+
type: [Number, String],
|
|
464
|
+
required: false
|
|
465
|
+
},
|
|
466
|
+
maxWidth: {
|
|
467
|
+
type: [Number, String],
|
|
468
|
+
required: false
|
|
469
|
+
},
|
|
470
|
+
minHeight: {
|
|
471
|
+
type: [Number, String],
|
|
472
|
+
required: false
|
|
473
|
+
},
|
|
474
|
+
minWidth: {
|
|
475
|
+
type: [Number, String],
|
|
476
|
+
required: false
|
|
477
|
+
},
|
|
478
|
+
width: {
|
|
479
|
+
type: [Number, String],
|
|
480
|
+
required: false
|
|
481
|
+
},
|
|
482
|
+
margin: {
|
|
483
|
+
type: [
|
|
484
|
+
Boolean,
|
|
485
|
+
Number,
|
|
486
|
+
String
|
|
487
|
+
],
|
|
488
|
+
required: false
|
|
489
|
+
},
|
|
490
|
+
marginTop: {
|
|
491
|
+
type: [
|
|
492
|
+
Boolean,
|
|
493
|
+
Number,
|
|
494
|
+
String
|
|
495
|
+
],
|
|
496
|
+
required: false
|
|
497
|
+
},
|
|
498
|
+
marginLeft: {
|
|
499
|
+
type: [
|
|
500
|
+
Boolean,
|
|
501
|
+
Number,
|
|
502
|
+
String
|
|
503
|
+
],
|
|
504
|
+
required: false
|
|
505
|
+
},
|
|
506
|
+
marginBottom: {
|
|
507
|
+
type: [
|
|
508
|
+
Boolean,
|
|
509
|
+
Number,
|
|
510
|
+
String
|
|
511
|
+
],
|
|
512
|
+
required: false
|
|
513
|
+
},
|
|
514
|
+
marginRight: {
|
|
515
|
+
type: [
|
|
516
|
+
Boolean,
|
|
517
|
+
Number,
|
|
518
|
+
String
|
|
519
|
+
],
|
|
520
|
+
required: false
|
|
521
|
+
},
|
|
522
|
+
marginBlock: {
|
|
523
|
+
type: [
|
|
524
|
+
Boolean,
|
|
525
|
+
Number,
|
|
526
|
+
String
|
|
527
|
+
],
|
|
528
|
+
required: false
|
|
529
|
+
},
|
|
530
|
+
marginInline: {
|
|
531
|
+
type: [
|
|
532
|
+
Boolean,
|
|
533
|
+
Number,
|
|
534
|
+
String
|
|
535
|
+
],
|
|
536
|
+
required: false
|
|
537
|
+
},
|
|
538
|
+
marginInlineStart: {
|
|
539
|
+
type: [
|
|
540
|
+
Boolean,
|
|
541
|
+
Number,
|
|
542
|
+
String
|
|
543
|
+
],
|
|
544
|
+
required: false
|
|
545
|
+
},
|
|
546
|
+
marginInlineEnd: {
|
|
547
|
+
type: [
|
|
548
|
+
Boolean,
|
|
549
|
+
Number,
|
|
550
|
+
String
|
|
551
|
+
],
|
|
552
|
+
required: false
|
|
553
|
+
},
|
|
554
|
+
marginBlockStart: {
|
|
555
|
+
type: [
|
|
556
|
+
Boolean,
|
|
557
|
+
Number,
|
|
558
|
+
String
|
|
559
|
+
],
|
|
560
|
+
required: false
|
|
561
|
+
},
|
|
562
|
+
marginBlockEnd: {
|
|
563
|
+
type: [
|
|
564
|
+
Boolean,
|
|
565
|
+
Number,
|
|
566
|
+
String
|
|
567
|
+
],
|
|
568
|
+
required: false
|
|
569
|
+
},
|
|
570
|
+
padding: {
|
|
571
|
+
type: [
|
|
572
|
+
Boolean,
|
|
573
|
+
Number,
|
|
574
|
+
String
|
|
575
|
+
],
|
|
576
|
+
required: false
|
|
577
|
+
},
|
|
578
|
+
paddingTop: {
|
|
579
|
+
type: [
|
|
580
|
+
Boolean,
|
|
581
|
+
Number,
|
|
582
|
+
String
|
|
583
|
+
],
|
|
584
|
+
required: false
|
|
585
|
+
},
|
|
586
|
+
paddingLeft: {
|
|
587
|
+
type: [
|
|
588
|
+
Boolean,
|
|
589
|
+
Number,
|
|
590
|
+
String
|
|
591
|
+
],
|
|
592
|
+
required: false
|
|
593
|
+
},
|
|
594
|
+
paddingBottom: {
|
|
595
|
+
type: [
|
|
596
|
+
Boolean,
|
|
597
|
+
Number,
|
|
598
|
+
String
|
|
599
|
+
],
|
|
600
|
+
required: false
|
|
601
|
+
},
|
|
602
|
+
paddingRight: {
|
|
603
|
+
type: [
|
|
604
|
+
Boolean,
|
|
605
|
+
Number,
|
|
606
|
+
String
|
|
607
|
+
],
|
|
608
|
+
required: false
|
|
609
|
+
},
|
|
610
|
+
paddingBlock: {
|
|
611
|
+
type: [
|
|
612
|
+
Boolean,
|
|
613
|
+
Number,
|
|
614
|
+
String
|
|
615
|
+
],
|
|
616
|
+
required: false
|
|
617
|
+
},
|
|
618
|
+
paddingInline: {
|
|
619
|
+
type: [
|
|
620
|
+
Boolean,
|
|
621
|
+
Number,
|
|
622
|
+
String
|
|
623
|
+
],
|
|
624
|
+
required: false
|
|
625
|
+
},
|
|
626
|
+
paddingInlineStart: {
|
|
627
|
+
type: [
|
|
628
|
+
Boolean,
|
|
629
|
+
Number,
|
|
630
|
+
String
|
|
631
|
+
],
|
|
632
|
+
required: false
|
|
633
|
+
},
|
|
634
|
+
paddingInlineEnd: {
|
|
635
|
+
type: [
|
|
636
|
+
Boolean,
|
|
637
|
+
Number,
|
|
638
|
+
String
|
|
639
|
+
],
|
|
640
|
+
required: false
|
|
641
|
+
},
|
|
642
|
+
paddingBlockStart: {
|
|
643
|
+
type: [
|
|
644
|
+
Boolean,
|
|
645
|
+
Number,
|
|
646
|
+
String
|
|
647
|
+
],
|
|
648
|
+
required: false
|
|
649
|
+
},
|
|
650
|
+
paddingBlockEnd: {
|
|
651
|
+
type: [
|
|
652
|
+
Boolean,
|
|
653
|
+
Number,
|
|
654
|
+
String
|
|
655
|
+
],
|
|
656
|
+
required: false
|
|
657
|
+
},
|
|
658
|
+
rounded: {
|
|
659
|
+
type: [
|
|
660
|
+
Boolean,
|
|
661
|
+
Number,
|
|
662
|
+
String,
|
|
663
|
+
null
|
|
664
|
+
],
|
|
665
|
+
required: false,
|
|
666
|
+
skipCheck: true
|
|
667
|
+
},
|
|
668
|
+
roundedTopRight: {
|
|
669
|
+
type: [
|
|
670
|
+
Boolean,
|
|
671
|
+
Number,
|
|
672
|
+
String
|
|
673
|
+
],
|
|
674
|
+
required: false
|
|
675
|
+
},
|
|
676
|
+
roundedTopLeft: {
|
|
677
|
+
type: [
|
|
678
|
+
Boolean,
|
|
679
|
+
Number,
|
|
680
|
+
String
|
|
681
|
+
],
|
|
682
|
+
required: false
|
|
683
|
+
},
|
|
684
|
+
roundedBottomLeft: {
|
|
685
|
+
type: [
|
|
686
|
+
Boolean,
|
|
687
|
+
Number,
|
|
688
|
+
String
|
|
689
|
+
],
|
|
690
|
+
required: false
|
|
691
|
+
},
|
|
692
|
+
roundedBottomRight: {
|
|
693
|
+
type: [
|
|
694
|
+
Boolean,
|
|
695
|
+
Number,
|
|
696
|
+
String
|
|
697
|
+
],
|
|
698
|
+
required: false
|
|
699
|
+
},
|
|
700
|
+
roundedStartStart: {
|
|
701
|
+
type: [
|
|
702
|
+
Boolean,
|
|
703
|
+
Number,
|
|
704
|
+
String
|
|
705
|
+
],
|
|
706
|
+
required: false
|
|
707
|
+
},
|
|
708
|
+
roundedStartEnd: {
|
|
709
|
+
type: [
|
|
710
|
+
Boolean,
|
|
711
|
+
Number,
|
|
712
|
+
String
|
|
713
|
+
],
|
|
714
|
+
required: false
|
|
715
|
+
},
|
|
716
|
+
roundedEndStart: {
|
|
717
|
+
type: [
|
|
718
|
+
Boolean,
|
|
719
|
+
Number,
|
|
720
|
+
String
|
|
721
|
+
],
|
|
722
|
+
required: false
|
|
723
|
+
},
|
|
724
|
+
roundedEndEnd: {
|
|
725
|
+
type: [
|
|
726
|
+
Boolean,
|
|
727
|
+
Number,
|
|
728
|
+
String
|
|
729
|
+
],
|
|
730
|
+
required: false
|
|
731
|
+
},
|
|
732
|
+
elevation: {
|
|
733
|
+
type: [Number, String],
|
|
734
|
+
required: false
|
|
735
|
+
},
|
|
736
|
+
bgColor: {
|
|
737
|
+
type: [
|
|
738
|
+
String,
|
|
739
|
+
Object,
|
|
740
|
+
Boolean,
|
|
741
|
+
null
|
|
742
|
+
],
|
|
743
|
+
required: false,
|
|
744
|
+
skipCheck: true
|
|
745
|
+
},
|
|
746
|
+
fontSize: {
|
|
747
|
+
type: null,
|
|
748
|
+
required: false
|
|
749
|
+
},
|
|
750
|
+
fontWeight: {
|
|
751
|
+
type: null,
|
|
752
|
+
required: false
|
|
753
|
+
}
|
|
387
754
|
});
|
|
388
|
-
const emit = defineEmits([
|
|
755
|
+
const emit = defineEmits([
|
|
756
|
+
"point-click",
|
|
757
|
+
"legend-click",
|
|
758
|
+
"series-toggle"
|
|
759
|
+
]);
|
|
389
760
|
defineSlots();
|
|
390
761
|
const { t } = useLocale();
|
|
391
762
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -396,279 +767,353 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
396
767
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
397
768
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
398
769
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
770
|
+
/*********************************************************
|
|
771
|
+
* Static SVG box — fixed 600 × 400 coordinate space;
|
|
772
|
+
* CSS scales it to the container.
|
|
773
|
+
* Right padding is wider to accommodate the right Y-axis.
|
|
774
|
+
********************************************************/
|
|
399
775
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.pareto);
|
|
400
776
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
401
777
|
const TICK_SIZE = 4;
|
|
402
778
|
const PLOT = {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
779
|
+
top: 24,
|
|
780
|
+
right: 60,
|
|
781
|
+
bottom: 48,
|
|
782
|
+
left: 52
|
|
407
783
|
};
|
|
408
784
|
const plotWidth = computed(() => svgWidth.value - PLOT.left - PLOT.right);
|
|
409
785
|
const plotHeight = computed(() => svgHeight.value - PLOT.top - PLOT.bottom);
|
|
786
|
+
/*********************************************************
|
|
787
|
+
* Color resolution
|
|
788
|
+
********************************************************/
|
|
410
789
|
const resolveColor = (raw) => {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
790
|
+
if (!raw) return "currentColor";
|
|
791
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
792
|
+
return raw;
|
|
793
|
+
}
|
|
794
|
+
if (isIntent(raw)) {
|
|
795
|
+
return intentBgExpr(raw, "default");
|
|
796
|
+
}
|
|
797
|
+
return "currentColor";
|
|
419
798
|
};
|
|
420
799
|
const resolvedBarColor = computed(() => resolveColor(props.barColor));
|
|
421
800
|
const resolvedLineColor = computed(() => resolveColor(props.lineColor));
|
|
801
|
+
/*********************************************************
|
|
802
|
+
* wasBarColorPassed / barColorAt
|
|
803
|
+
*
|
|
804
|
+
* @description
|
|
805
|
+
* `barColor` carries a hard `withDefaults()` default ('primary'), so
|
|
806
|
+
* `props.barColor` is NEVER `undefined` at render time — a plain
|
|
807
|
+
* `props.barColor ?? colorScheme[...]` fallback could never fire.
|
|
808
|
+
*
|
|
809
|
+
* @description
|
|
810
|
+
* Same shadowing shape `useChartAnimationStyle` documents for
|
|
811
|
+
* `animationDuration` (#505): the distinguishing test is whether the
|
|
812
|
+
* CONSUMER (or a theme) actually touched the prop, not whether the
|
|
813
|
+
* resolved value is falsy (#426).
|
|
814
|
+
********************************************************/
|
|
422
815
|
const wasBarColorPassed = usePassedProps(props, "OrigamChartPareto");
|
|
423
816
|
const barColorAt = (i) => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
817
|
+
if (!wasBarColorPassed("barColor") && props.colorScheme?.length) {
|
|
818
|
+
return resolveColor(props.colorScheme[i % props.colorScheme.length]);
|
|
819
|
+
}
|
|
820
|
+
return resolvedBarColor.value;
|
|
428
821
|
};
|
|
822
|
+
/*********************************************************
|
|
823
|
+
* Data normalisation — accepts IChartParetoDatum objects
|
|
824
|
+
* or legacy {x, y} point shapes from IChartSeries.data.
|
|
825
|
+
********************************************************/
|
|
429
826
|
const sortedData = computed(() => {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
827
|
+
const series = props.series?.[0];
|
|
828
|
+
if (!series?.data?.length) return [];
|
|
829
|
+
const items = series.data.map((item, i) => {
|
|
830
|
+
if (typeof item === "number") {
|
|
831
|
+
const cat = props.categories?.[i] ?? String(i);
|
|
832
|
+
return {
|
|
833
|
+
category: cat,
|
|
834
|
+
value: item
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
if (typeof item === "object" && item !== null) {
|
|
838
|
+
const obj = item;
|
|
839
|
+
if ("category" in obj && typeof obj["value"] === "number") {
|
|
840
|
+
return item;
|
|
841
|
+
}
|
|
842
|
+
const x = obj["x"];
|
|
843
|
+
const y = obj["y"];
|
|
844
|
+
return {
|
|
845
|
+
category: x != null ? String(x) : props.categories?.[i] ?? String(i),
|
|
846
|
+
value: typeof y === "number" ? y : 0
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
category: props.categories?.[i] ?? String(i),
|
|
851
|
+
value: 0
|
|
852
|
+
};
|
|
853
|
+
});
|
|
854
|
+
return [...items].sort((a, b) => b.value - a.value);
|
|
452
855
|
});
|
|
453
|
-
const total = computed(
|
|
454
|
-
|
|
455
|
-
)
|
|
856
|
+
const total = computed(() => sortedData.value.reduce((acc, d) => acc + (Number.isFinite(d.value) && d.value >= 0 ? d.value : 0), 0) || 1e-9);
|
|
857
|
+
/*********************************************************
|
|
858
|
+
* Y scale — left axis (values)
|
|
859
|
+
********************************************************/
|
|
456
860
|
const yMax = computed(() => {
|
|
457
|
-
|
|
458
|
-
|
|
861
|
+
if (!sortedData.value.length) return 1;
|
|
862
|
+
return Math.max(...sortedData.value.map((d) => d.value).filter(Number.isFinite), 1);
|
|
459
863
|
});
|
|
460
864
|
const scaleY = (value) => {
|
|
461
|
-
|
|
462
|
-
|
|
865
|
+
const fraction = value / yMax.value;
|
|
866
|
+
return PLOT.top + plotHeight.value * (1 - fraction);
|
|
463
867
|
};
|
|
868
|
+
/*********************************************************
|
|
869
|
+
* Y scale — right axis (cumulative %)
|
|
870
|
+
********************************************************/
|
|
464
871
|
const scaleYCumulative = (fraction) => {
|
|
465
|
-
|
|
872
|
+
return PLOT.top + plotHeight.value * (1 - fraction);
|
|
466
873
|
};
|
|
874
|
+
/*********************************************************
|
|
875
|
+
* Y-axis ticks — left (values)
|
|
876
|
+
********************************************************/
|
|
467
877
|
const Y_TICK_COUNT = 5;
|
|
468
878
|
const yTicks = computed(() => {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
879
|
+
const max = yMax.value;
|
|
880
|
+
const step = max / (Y_TICK_COUNT - 1);
|
|
881
|
+
return Array.from({ length: Y_TICK_COUNT }, (_, i) => {
|
|
882
|
+
const value = i * step;
|
|
883
|
+
const label = props.yAxisFormat ? props.yAxisFormat(value) : String(Math.round(value * 100) / 100);
|
|
884
|
+
return {
|
|
885
|
+
value,
|
|
886
|
+
label
|
|
887
|
+
};
|
|
888
|
+
});
|
|
476
889
|
});
|
|
890
|
+
/*********************************************************
|
|
891
|
+
* Cumulative axis ticks — right (0–100%)
|
|
892
|
+
********************************************************/
|
|
477
893
|
const CUMULATIVE_TICK_COUNT = 5;
|
|
478
894
|
const cumulativeTicks = computed(() => {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
895
|
+
return Array.from({ length: CUMULATIVE_TICK_COUNT }, (_, i) => {
|
|
896
|
+
const fraction = i / (CUMULATIVE_TICK_COUNT - 1);
|
|
897
|
+
const label = props.cumulativeFormat ? props.cumulativeFormat(fraction) : `${Math.round(fraction * 100)}%`;
|
|
898
|
+
return {
|
|
899
|
+
value: fraction,
|
|
900
|
+
label
|
|
901
|
+
};
|
|
902
|
+
});
|
|
484
903
|
});
|
|
904
|
+
/*********************************************************
|
|
905
|
+
* Geometry — Pareto bars
|
|
906
|
+
********************************************************/
|
|
485
907
|
const bars = computed(() => {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
908
|
+
const items = sortedData.value;
|
|
909
|
+
if (!items.length) return [];
|
|
910
|
+
const count = items.length;
|
|
911
|
+
const totalBarSpace = plotWidth.value - props.barGap * Math.max(0, count - 1);
|
|
912
|
+
const barWidth = Math.max(1, totalBarSpace / count);
|
|
913
|
+
const baseline = scaleY(0);
|
|
914
|
+
let cumulativeSum = 0;
|
|
915
|
+
let cursorX = PLOT.left;
|
|
916
|
+
return items.map((datum, i) => {
|
|
917
|
+
const safeValue = Number.isFinite(datum.value) && datum.value >= 0 ? datum.value : 0;
|
|
918
|
+
cumulativeSum += safeValue;
|
|
919
|
+
const cumulative = cumulativeSum / total.value;
|
|
920
|
+
const share = safeValue / total.value;
|
|
921
|
+
const barTop = scaleY(safeValue);
|
|
922
|
+
const barHeight = Math.abs(baseline - barTop);
|
|
923
|
+
const x = cursorX;
|
|
924
|
+
const cx = cursorX + barWidth / 2;
|
|
925
|
+
const dotY = scaleYCumulative(cumulative);
|
|
926
|
+
cursorX += barWidth + props.barGap;
|
|
927
|
+
return {
|
|
928
|
+
index: i,
|
|
929
|
+
category: datum.category,
|
|
930
|
+
value: safeValue,
|
|
931
|
+
formattedValue: props.yAxisFormat ? props.yAxisFormat(safeValue) : String(safeValue),
|
|
932
|
+
share,
|
|
933
|
+
cumulative,
|
|
934
|
+
color: barColorAt(i),
|
|
935
|
+
x,
|
|
936
|
+
y: barTop,
|
|
937
|
+
w: barWidth,
|
|
938
|
+
h: Math.max(barHeight, 1),
|
|
939
|
+
cx,
|
|
940
|
+
dotY
|
|
941
|
+
};
|
|
942
|
+
});
|
|
521
943
|
});
|
|
944
|
+
/*********************************************************
|
|
945
|
+
* Cumulative line path
|
|
946
|
+
********************************************************/
|
|
522
947
|
const cumulativeLinePath = computed(() => {
|
|
523
|
-
|
|
524
|
-
|
|
948
|
+
if (!bars.value.length) return "";
|
|
949
|
+
return bars.value.map((bar, i) => `${i === 0 ? "M" : "L"} ${bar.cx},${bar.dotY}`).join(" ");
|
|
525
950
|
});
|
|
951
|
+
/*********************************************************
|
|
952
|
+
* formatCategory helper
|
|
953
|
+
********************************************************/
|
|
526
954
|
const formatCategory = (cat) => {
|
|
527
|
-
|
|
528
|
-
|
|
955
|
+
if (props.xAxisFormat) return String(props.xAxisFormat(cat));
|
|
956
|
+
return cat;
|
|
529
957
|
};
|
|
958
|
+
/*********************************************************
|
|
959
|
+
* Legend items — two entries: bars + cumulative line
|
|
960
|
+
********************************************************/
|
|
530
961
|
const legendItems = computed(() => {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
return items;
|
|
962
|
+
const series = props.series?.[0];
|
|
963
|
+
if (!series) return [];
|
|
964
|
+
const items = [{
|
|
965
|
+
series: {
|
|
966
|
+
...series,
|
|
967
|
+
name: series.name || "Values",
|
|
968
|
+
visible: true
|
|
969
|
+
},
|
|
970
|
+
index: 0,
|
|
971
|
+
color: resolvedBarColor.value,
|
|
972
|
+
visible: true
|
|
973
|
+
}];
|
|
974
|
+
if (props.showLine) {
|
|
975
|
+
items.push({
|
|
976
|
+
series: {
|
|
977
|
+
name: t("origam.chart.pareto.cumulative_label"),
|
|
978
|
+
data: [],
|
|
979
|
+
visible: true
|
|
980
|
+
},
|
|
981
|
+
index: 1,
|
|
982
|
+
color: resolvedLineColor.value,
|
|
983
|
+
visible: true
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
return items;
|
|
558
987
|
});
|
|
988
|
+
/*********************************************************
|
|
989
|
+
* Empty state
|
|
990
|
+
********************************************************/
|
|
559
991
|
const showEmpty = computed(() => {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
992
|
+
if (!props.series?.length) return true;
|
|
993
|
+
const first = props.series[0];
|
|
994
|
+
if (!first?.data?.length) return true;
|
|
995
|
+
return bars.value.length === 0;
|
|
996
|
+
});
|
|
997
|
+
/*********************************************************
|
|
998
|
+
* Hover / tooltip
|
|
999
|
+
********************************************************/
|
|
1000
|
+
const mousePos = ref({
|
|
1001
|
+
x: 0,
|
|
1002
|
+
y: 0
|
|
564
1003
|
});
|
|
565
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
566
1004
|
const hoveredIndex = ref(null);
|
|
567
1005
|
const hoveredBar = computed(() => {
|
|
568
|
-
|
|
569
|
-
|
|
1006
|
+
if (hoveredIndex.value === null) return null;
|
|
1007
|
+
return bars.value.find((b) => b.index === hoveredIndex.value) ?? null;
|
|
570
1008
|
});
|
|
571
1009
|
const hoveredPoint = computed(() => {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1010
|
+
const bar = hoveredBar.value;
|
|
1011
|
+
if (!bar || !props.series?.[0]) return null;
|
|
1012
|
+
return {
|
|
1013
|
+
seriesIndex: 0,
|
|
1014
|
+
seriesName: props.series[0].name,
|
|
1015
|
+
dataIndex: bar.index,
|
|
1016
|
+
x: bar.category,
|
|
1017
|
+
y: bar.value,
|
|
1018
|
+
color: bar.color
|
|
1019
|
+
};
|
|
582
1020
|
});
|
|
583
1021
|
const hoveredSeries = computed(() => {
|
|
584
|
-
|
|
585
|
-
|
|
1022
|
+
if (!hoveredBar.value || !props.series?.[0]) return null;
|
|
1023
|
+
return props.series[0];
|
|
586
1024
|
});
|
|
587
|
-
const hoveredCategory = computed(
|
|
588
|
-
|
|
589
|
-
|
|
1025
|
+
const hoveredCategory = computed(() => hoveredBar.value?.category ?? "");
|
|
1026
|
+
/**
|
|
1027
|
+
* Builds the `IChartParetoSlots['tooltip']` scope from the default
|
|
1028
|
+
* `{ point, series, category }` binding + the hovered bar's own
|
|
1029
|
+
* fields (`value`, `formattedValue`, `share`, `cumulative`,
|
|
1030
|
+
* `color`). `bar` is guaranteed non-null whenever this runs — the
|
|
1031
|
+
* tooltip only renders while `hoveredBar` backs `hoveredPoint` /
|
|
1032
|
+
* `hoveredSeries`, which the `<origam-chart-tooltip>` wrapper's own
|
|
1033
|
+
* `v-if="point && series"` already gates — but the fallback keeps
|
|
1034
|
+
* the return type honest without a non-null assertion.
|
|
1035
|
+
*/
|
|
590
1036
|
const tooltipBindings = (bindings) => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
1037
|
+
const bar = hoveredBar.value;
|
|
1038
|
+
return {
|
|
1039
|
+
point: bindings.point,
|
|
1040
|
+
category: bar?.category ?? "",
|
|
1041
|
+
value: bar?.value ?? 0,
|
|
1042
|
+
formattedValue: bar?.formattedValue ?? "",
|
|
1043
|
+
share: bar?.share ?? 0,
|
|
1044
|
+
cumulative: bar?.cumulative ?? 0,
|
|
1045
|
+
color: bar?.color ?? ""
|
|
1046
|
+
};
|
|
601
1047
|
};
|
|
1048
|
+
/*********************************************************
|
|
1049
|
+
* Root classes / styles
|
|
1050
|
+
********************************************************/
|
|
602
1051
|
const rootClasses = computed(() => [
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
1052
|
+
{
|
|
1053
|
+
[`origam-chart-pareto--legend-${props.legendPosition}`]: true,
|
|
1054
|
+
"origam-chart-pareto--no-animation": !props.animated
|
|
1055
|
+
},
|
|
1056
|
+
backgroundColorClasses.value,
|
|
1057
|
+
elevationClasses.value,
|
|
1058
|
+
marginClasses.value,
|
|
1059
|
+
paddingClasses.value,
|
|
1060
|
+
roundedClasses.value,
|
|
1061
|
+
props.class
|
|
613
1062
|
]);
|
|
614
1063
|
const rootStyles = computed(() => {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
1064
|
+
const out = {};
|
|
1065
|
+
if (props.aspectRatio) {
|
|
1066
|
+
out.aspectRatio = props.aspectRatio;
|
|
1067
|
+
}
|
|
1068
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
1069
|
+
return [out, props.style];
|
|
621
1070
|
});
|
|
622
|
-
const bodyClasses = computed(() => ({
|
|
623
|
-
|
|
624
|
-
}));
|
|
625
|
-
const svgClasses = computed(() => ({
|
|
626
|
-
"origam-chart__svg--animated": props.animated
|
|
627
|
-
}));
|
|
1071
|
+
const bodyClasses = computed(() => ({ "origam-chart-pareto__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
1072
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
628
1073
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
1074
|
+
/*********************************************************
|
|
1075
|
+
* ARIA
|
|
1076
|
+
********************************************************/
|
|
629
1077
|
const ariaLabel = computed(() => props.title ?? t("origam.chart.pareto.aria_label"));
|
|
630
1078
|
const svgAriaLabel = computed(() => props.title ?? t("origam.chart.pareto.aria_label"));
|
|
631
1079
|
const svgTitle = computed(() => props.title ?? t("origam.chart.pareto.aria_label"));
|
|
632
1080
|
const svgDesc = computed(() => {
|
|
633
|
-
|
|
634
|
-
|
|
1081
|
+
const n = bars.value.length;
|
|
1082
|
+
return t("origam.chart.pareto.desc", n);
|
|
635
1083
|
});
|
|
636
|
-
const barAriaLabel = (bar) => t(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
Math.round(bar.share * 100),
|
|
641
|
-
Math.round(bar.cumulative * 100)
|
|
642
|
-
);
|
|
1084
|
+
const barAriaLabel = (bar) => t("origam.chart.pareto.bar_aria_label", bar.category, bar.formattedValue, Math.round(bar.share * 100), Math.round(bar.cumulative * 100));
|
|
1085
|
+
/*********************************************************
|
|
1086
|
+
* Interaction
|
|
1087
|
+
********************************************************/
|
|
643
1088
|
const onBarEnter = (bar) => {
|
|
644
|
-
|
|
1089
|
+
hoveredIndex.value = bar.index;
|
|
645
1090
|
};
|
|
646
1091
|
const onBarLeave = () => {
|
|
647
|
-
|
|
1092
|
+
hoveredIndex.value = null;
|
|
648
1093
|
};
|
|
649
1094
|
const onSvgMouseMove = (event) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1095
|
+
const target = svgRef.value;
|
|
1096
|
+
if (!target) return;
|
|
1097
|
+
const rect = target.getBoundingClientRect();
|
|
1098
|
+
mousePos.value = {
|
|
1099
|
+
x: event.clientX - rect.left,
|
|
1100
|
+
y: event.clientY - rect.top
|
|
1101
|
+
};
|
|
657
1102
|
};
|
|
658
1103
|
const onSvgMouseLeave = () => {
|
|
659
|
-
|
|
1104
|
+
onBarLeave();
|
|
660
1105
|
};
|
|
661
1106
|
const onBarActivate = (bar, event) => {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
1107
|
+
hoveredIndex.value = bar.index;
|
|
1108
|
+
if (hoveredPoint.value) {
|
|
1109
|
+
emit("point-click", hoveredPoint.value, event);
|
|
1110
|
+
}
|
|
666
1111
|
};
|
|
667
1112
|
const onLegendClick = (series, index) => {
|
|
668
|
-
|
|
1113
|
+
emit("legend-click", series, index);
|
|
669
1114
|
};
|
|
670
1115
|
const onSeriesToggle = (series, visible) => {
|
|
671
|
-
|
|
1116
|
+
emit("series-toggle", series, visible);
|
|
672
1117
|
};
|
|
673
1118
|
</script>
|
|
674
1119
|
|