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
|
@@ -490,12 +490,7 @@
|
|
|
490
490
|
</template>
|
|
491
491
|
|
|
492
492
|
<script lang="ts" setup>
|
|
493
|
-
import {
|
|
494
|
-
computed,
|
|
495
|
-
nextTick,
|
|
496
|
-
ref,
|
|
497
|
-
watch
|
|
498
|
-
} from "vue";
|
|
493
|
+
import { computed, nextTick, ref, watch } from "vue";
|
|
499
494
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
500
495
|
import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
|
|
501
496
|
import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
|
|
@@ -509,175 +504,634 @@ import { useLocale } from "../../composables/Commons/locale.composable";
|
|
|
509
504
|
import { useMargin } from "../../composables/Commons/margin.composable";
|
|
510
505
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
511
506
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
512
|
-
import {
|
|
513
|
-
computeAnnotationGeometry,
|
|
514
|
-
computePlotBandGeometry,
|
|
515
|
-
computePlotLineGeometry
|
|
516
|
-
} from "../../composables/Chart/chart.composable";
|
|
507
|
+
import { computeAnnotationGeometry, computePlotBandGeometry, computePlotLineGeometry } from "../../composables/Chart/chart.composable";
|
|
517
508
|
import { CHART_RANGE_SELECTOR_DEFAULT_BUTTONS, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
518
|
-
import {
|
|
519
|
-
CHART_ZOOM_RESET_GAP,
|
|
520
|
-
CHART_ZOOM_RESET_MIN_WIDTH,
|
|
521
|
-
CHART_ZOOM_RESET_PADDING_X
|
|
522
|
-
} from "../../consts/Chart/chart-cartesian.const";
|
|
509
|
+
import { CHART_ZOOM_RESET_GAP, CHART_ZOOM_RESET_MIN_WIDTH, CHART_ZOOM_RESET_PADDING_X } from "../../consts/Chart/chart-cartesian.const";
|
|
523
510
|
import { OrigamBtn } from "../Btn";
|
|
524
511
|
import OrigamChartAxis from "./OrigamChartAxis.vue";
|
|
525
512
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
526
513
|
import OrigamChartRangeSelector from "./OrigamChartRangeSelector.vue";
|
|
527
514
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
515
|
+
/*********************************************************
|
|
516
|
+
* Global
|
|
517
|
+
*
|
|
518
|
+
* @description
|
|
519
|
+
* Cartesian chart family — renders `line`, `area`, `bar`,
|
|
520
|
+
* `column`, `scatter`, `spline`, `stepped-line`. Owns
|
|
521
|
+
* the X+Y axes + grid + tick labels via `<OrigamChartAxis>`.
|
|
522
|
+
*
|
|
523
|
+
* Polar / radar / gauge live in their own family components so
|
|
524
|
+
* pie / donut don't inherit the cartesian chrome. The shell
|
|
525
|
+
* `<OrigamChart>` dispatches between families based on the
|
|
526
|
+
* `type` prop.
|
|
527
|
+
********************************************************/
|
|
528
|
+
defineOptions({ name: "OrigamChartCartesian" });
|
|
529
|
+
/*********************************************************
|
|
530
|
+
* Props / Emits — defaults inlined per CLAUDE.md.
|
|
531
|
+
********************************************************/
|
|
531
532
|
const props = defineProps({
|
|
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
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
533
|
+
type: {
|
|
534
|
+
type: null,
|
|
535
|
+
required: false,
|
|
536
|
+
default: "line"
|
|
537
|
+
},
|
|
538
|
+
stacked: {
|
|
539
|
+
type: Boolean,
|
|
540
|
+
required: false,
|
|
541
|
+
default: false
|
|
542
|
+
},
|
|
543
|
+
stacking: {
|
|
544
|
+
type: null,
|
|
545
|
+
required: false,
|
|
546
|
+
default: "normal"
|
|
547
|
+
},
|
|
548
|
+
smoothing: {
|
|
549
|
+
type: null,
|
|
550
|
+
required: false,
|
|
551
|
+
default: "none"
|
|
552
|
+
},
|
|
553
|
+
yMin: {
|
|
554
|
+
type: Number,
|
|
555
|
+
required: false,
|
|
556
|
+
default: undefined
|
|
557
|
+
},
|
|
558
|
+
yMax: {
|
|
559
|
+
type: Number,
|
|
560
|
+
required: false,
|
|
561
|
+
default: undefined
|
|
562
|
+
},
|
|
563
|
+
showGrid: {
|
|
564
|
+
type: Boolean,
|
|
565
|
+
required: false,
|
|
566
|
+
default: true
|
|
567
|
+
},
|
|
568
|
+
showAxis: {
|
|
569
|
+
type: Boolean,
|
|
570
|
+
required: false,
|
|
571
|
+
default: true
|
|
572
|
+
},
|
|
573
|
+
showTooltip: {
|
|
574
|
+
type: Boolean,
|
|
575
|
+
required: false,
|
|
576
|
+
default: true
|
|
577
|
+
},
|
|
578
|
+
xAxisFormat: {
|
|
579
|
+
type: Function,
|
|
580
|
+
required: false,
|
|
581
|
+
default: undefined
|
|
582
|
+
},
|
|
583
|
+
yAxisFormat: {
|
|
584
|
+
type: Function,
|
|
585
|
+
required: false,
|
|
586
|
+
default: undefined
|
|
587
|
+
},
|
|
588
|
+
secondaryYAxis: {
|
|
589
|
+
type: Object,
|
|
590
|
+
required: false,
|
|
591
|
+
default: undefined
|
|
592
|
+
},
|
|
593
|
+
plotBands: {
|
|
594
|
+
type: Array,
|
|
595
|
+
required: false,
|
|
596
|
+
default: () => []
|
|
597
|
+
},
|
|
598
|
+
plotLines: {
|
|
599
|
+
type: Array,
|
|
600
|
+
required: false,
|
|
601
|
+
default: () => []
|
|
602
|
+
},
|
|
603
|
+
drilldown: {
|
|
604
|
+
type: Object,
|
|
605
|
+
required: false,
|
|
606
|
+
default: undefined
|
|
607
|
+
},
|
|
608
|
+
zoomable: {
|
|
609
|
+
type: Boolean,
|
|
610
|
+
required: false,
|
|
611
|
+
default: false
|
|
612
|
+
},
|
|
613
|
+
zoomResetLabel: {
|
|
614
|
+
type: String,
|
|
615
|
+
required: false,
|
|
616
|
+
default: "origam.chart.zoom.reset_aria_label"
|
|
617
|
+
},
|
|
618
|
+
rangeSelector: {
|
|
619
|
+
type: Object,
|
|
620
|
+
required: false,
|
|
621
|
+
default: undefined
|
|
622
|
+
},
|
|
623
|
+
annotations: {
|
|
624
|
+
type: Array,
|
|
625
|
+
required: false,
|
|
626
|
+
default: () => []
|
|
627
|
+
},
|
|
628
|
+
series: {
|
|
629
|
+
type: Array,
|
|
630
|
+
required: true
|
|
631
|
+
},
|
|
632
|
+
categories: {
|
|
633
|
+
type: Array,
|
|
634
|
+
required: false,
|
|
635
|
+
default: () => []
|
|
636
|
+
},
|
|
637
|
+
title: {
|
|
638
|
+
type: String,
|
|
639
|
+
required: false,
|
|
640
|
+
default: undefined
|
|
641
|
+
},
|
|
642
|
+
subtitle: {
|
|
643
|
+
type: String,
|
|
644
|
+
required: false,
|
|
645
|
+
default: undefined
|
|
646
|
+
},
|
|
647
|
+
showLegend: {
|
|
648
|
+
type: Boolean,
|
|
649
|
+
required: false,
|
|
650
|
+
default: true
|
|
651
|
+
},
|
|
652
|
+
legendPosition: {
|
|
653
|
+
type: null,
|
|
654
|
+
required: false,
|
|
655
|
+
default: "bottom"
|
|
656
|
+
},
|
|
657
|
+
animated: {
|
|
658
|
+
type: Boolean,
|
|
659
|
+
required: false,
|
|
660
|
+
default: true
|
|
661
|
+
},
|
|
662
|
+
animationDuration: {
|
|
663
|
+
type: Number,
|
|
664
|
+
required: false,
|
|
665
|
+
default: 600
|
|
666
|
+
},
|
|
667
|
+
colorScheme: {
|
|
668
|
+
type: Array,
|
|
669
|
+
required: false,
|
|
670
|
+
default: () => []
|
|
671
|
+
},
|
|
672
|
+
aspectRatio: {
|
|
673
|
+
type: String,
|
|
674
|
+
required: false,
|
|
675
|
+
default: undefined
|
|
676
|
+
},
|
|
677
|
+
id: {
|
|
678
|
+
type: String,
|
|
679
|
+
required: false
|
|
680
|
+
},
|
|
681
|
+
class: {
|
|
682
|
+
type: [
|
|
683
|
+
String,
|
|
684
|
+
Array,
|
|
685
|
+
Object
|
|
686
|
+
],
|
|
687
|
+
required: false
|
|
688
|
+
},
|
|
689
|
+
style: {
|
|
690
|
+
type: [
|
|
691
|
+
String,
|
|
692
|
+
Array,
|
|
693
|
+
Object,
|
|
694
|
+
Boolean,
|
|
695
|
+
null
|
|
696
|
+
],
|
|
697
|
+
required: false,
|
|
698
|
+
skipCheck: true
|
|
699
|
+
},
|
|
700
|
+
height: {
|
|
701
|
+
type: [Number, String],
|
|
702
|
+
required: false,
|
|
703
|
+
default: 300
|
|
704
|
+
},
|
|
705
|
+
maxHeight: {
|
|
706
|
+
type: [Number, String],
|
|
707
|
+
required: false
|
|
708
|
+
},
|
|
709
|
+
maxWidth: {
|
|
710
|
+
type: [Number, String],
|
|
711
|
+
required: false
|
|
712
|
+
},
|
|
713
|
+
minHeight: {
|
|
714
|
+
type: [Number, String],
|
|
715
|
+
required: false
|
|
716
|
+
},
|
|
717
|
+
minWidth: {
|
|
718
|
+
type: [Number, String],
|
|
719
|
+
required: false
|
|
720
|
+
},
|
|
721
|
+
width: {
|
|
722
|
+
type: [Number, String],
|
|
723
|
+
required: false
|
|
724
|
+
},
|
|
725
|
+
margin: {
|
|
726
|
+
type: [
|
|
727
|
+
Boolean,
|
|
728
|
+
Number,
|
|
729
|
+
String
|
|
730
|
+
],
|
|
731
|
+
required: false
|
|
732
|
+
},
|
|
733
|
+
marginTop: {
|
|
734
|
+
type: [
|
|
735
|
+
Boolean,
|
|
736
|
+
Number,
|
|
737
|
+
String
|
|
738
|
+
],
|
|
739
|
+
required: false
|
|
740
|
+
},
|
|
741
|
+
marginLeft: {
|
|
742
|
+
type: [
|
|
743
|
+
Boolean,
|
|
744
|
+
Number,
|
|
745
|
+
String
|
|
746
|
+
],
|
|
747
|
+
required: false
|
|
748
|
+
},
|
|
749
|
+
marginBottom: {
|
|
750
|
+
type: [
|
|
751
|
+
Boolean,
|
|
752
|
+
Number,
|
|
753
|
+
String
|
|
754
|
+
],
|
|
755
|
+
required: false
|
|
756
|
+
},
|
|
757
|
+
marginRight: {
|
|
758
|
+
type: [
|
|
759
|
+
Boolean,
|
|
760
|
+
Number,
|
|
761
|
+
String
|
|
762
|
+
],
|
|
763
|
+
required: false
|
|
764
|
+
},
|
|
765
|
+
marginBlock: {
|
|
766
|
+
type: [
|
|
767
|
+
Boolean,
|
|
768
|
+
Number,
|
|
769
|
+
String
|
|
770
|
+
],
|
|
771
|
+
required: false
|
|
772
|
+
},
|
|
773
|
+
marginInline: {
|
|
774
|
+
type: [
|
|
775
|
+
Boolean,
|
|
776
|
+
Number,
|
|
777
|
+
String
|
|
778
|
+
],
|
|
779
|
+
required: false
|
|
780
|
+
},
|
|
781
|
+
marginInlineStart: {
|
|
782
|
+
type: [
|
|
783
|
+
Boolean,
|
|
784
|
+
Number,
|
|
785
|
+
String
|
|
786
|
+
],
|
|
787
|
+
required: false
|
|
788
|
+
},
|
|
789
|
+
marginInlineEnd: {
|
|
790
|
+
type: [
|
|
791
|
+
Boolean,
|
|
792
|
+
Number,
|
|
793
|
+
String
|
|
794
|
+
],
|
|
795
|
+
required: false
|
|
796
|
+
},
|
|
797
|
+
marginBlockStart: {
|
|
798
|
+
type: [
|
|
799
|
+
Boolean,
|
|
800
|
+
Number,
|
|
801
|
+
String
|
|
802
|
+
],
|
|
803
|
+
required: false
|
|
804
|
+
},
|
|
805
|
+
marginBlockEnd: {
|
|
806
|
+
type: [
|
|
807
|
+
Boolean,
|
|
808
|
+
Number,
|
|
809
|
+
String
|
|
810
|
+
],
|
|
811
|
+
required: false
|
|
812
|
+
},
|
|
813
|
+
padding: {
|
|
814
|
+
type: [
|
|
815
|
+
Boolean,
|
|
816
|
+
Number,
|
|
817
|
+
String
|
|
818
|
+
],
|
|
819
|
+
required: false
|
|
820
|
+
},
|
|
821
|
+
paddingTop: {
|
|
822
|
+
type: [
|
|
823
|
+
Boolean,
|
|
824
|
+
Number,
|
|
825
|
+
String
|
|
826
|
+
],
|
|
827
|
+
required: false
|
|
828
|
+
},
|
|
829
|
+
paddingLeft: {
|
|
830
|
+
type: [
|
|
831
|
+
Boolean,
|
|
832
|
+
Number,
|
|
833
|
+
String
|
|
834
|
+
],
|
|
835
|
+
required: false
|
|
836
|
+
},
|
|
837
|
+
paddingBottom: {
|
|
838
|
+
type: [
|
|
839
|
+
Boolean,
|
|
840
|
+
Number,
|
|
841
|
+
String
|
|
842
|
+
],
|
|
843
|
+
required: false
|
|
844
|
+
},
|
|
845
|
+
paddingRight: {
|
|
846
|
+
type: [
|
|
847
|
+
Boolean,
|
|
848
|
+
Number,
|
|
849
|
+
String
|
|
850
|
+
],
|
|
851
|
+
required: false
|
|
852
|
+
},
|
|
853
|
+
paddingBlock: {
|
|
854
|
+
type: [
|
|
855
|
+
Boolean,
|
|
856
|
+
Number,
|
|
857
|
+
String
|
|
858
|
+
],
|
|
859
|
+
required: false
|
|
860
|
+
},
|
|
861
|
+
paddingInline: {
|
|
862
|
+
type: [
|
|
863
|
+
Boolean,
|
|
864
|
+
Number,
|
|
865
|
+
String
|
|
866
|
+
],
|
|
867
|
+
required: false
|
|
868
|
+
},
|
|
869
|
+
paddingInlineStart: {
|
|
870
|
+
type: [
|
|
871
|
+
Boolean,
|
|
872
|
+
Number,
|
|
873
|
+
String
|
|
874
|
+
],
|
|
875
|
+
required: false
|
|
876
|
+
},
|
|
877
|
+
paddingInlineEnd: {
|
|
878
|
+
type: [
|
|
879
|
+
Boolean,
|
|
880
|
+
Number,
|
|
881
|
+
String
|
|
882
|
+
],
|
|
883
|
+
required: false
|
|
884
|
+
},
|
|
885
|
+
paddingBlockStart: {
|
|
886
|
+
type: [
|
|
887
|
+
Boolean,
|
|
888
|
+
Number,
|
|
889
|
+
String
|
|
890
|
+
],
|
|
891
|
+
required: false
|
|
892
|
+
},
|
|
893
|
+
paddingBlockEnd: {
|
|
894
|
+
type: [
|
|
895
|
+
Boolean,
|
|
896
|
+
Number,
|
|
897
|
+
String
|
|
898
|
+
],
|
|
899
|
+
required: false
|
|
900
|
+
},
|
|
901
|
+
rounded: {
|
|
902
|
+
type: [
|
|
903
|
+
Boolean,
|
|
904
|
+
Number,
|
|
905
|
+
String,
|
|
906
|
+
null
|
|
907
|
+
],
|
|
908
|
+
required: false,
|
|
909
|
+
skipCheck: true
|
|
910
|
+
},
|
|
911
|
+
roundedTopRight: {
|
|
912
|
+
type: [
|
|
913
|
+
Boolean,
|
|
914
|
+
Number,
|
|
915
|
+
String
|
|
916
|
+
],
|
|
917
|
+
required: false
|
|
918
|
+
},
|
|
919
|
+
roundedTopLeft: {
|
|
920
|
+
type: [
|
|
921
|
+
Boolean,
|
|
922
|
+
Number,
|
|
923
|
+
String
|
|
924
|
+
],
|
|
925
|
+
required: false
|
|
926
|
+
},
|
|
927
|
+
roundedBottomLeft: {
|
|
928
|
+
type: [
|
|
929
|
+
Boolean,
|
|
930
|
+
Number,
|
|
931
|
+
String
|
|
932
|
+
],
|
|
933
|
+
required: false
|
|
934
|
+
},
|
|
935
|
+
roundedBottomRight: {
|
|
936
|
+
type: [
|
|
937
|
+
Boolean,
|
|
938
|
+
Number,
|
|
939
|
+
String
|
|
940
|
+
],
|
|
941
|
+
required: false
|
|
942
|
+
},
|
|
943
|
+
roundedStartStart: {
|
|
944
|
+
type: [
|
|
945
|
+
Boolean,
|
|
946
|
+
Number,
|
|
947
|
+
String
|
|
948
|
+
],
|
|
949
|
+
required: false
|
|
950
|
+
},
|
|
951
|
+
roundedStartEnd: {
|
|
952
|
+
type: [
|
|
953
|
+
Boolean,
|
|
954
|
+
Number,
|
|
955
|
+
String
|
|
956
|
+
],
|
|
957
|
+
required: false
|
|
958
|
+
},
|
|
959
|
+
roundedEndStart: {
|
|
960
|
+
type: [
|
|
961
|
+
Boolean,
|
|
962
|
+
Number,
|
|
963
|
+
String
|
|
964
|
+
],
|
|
965
|
+
required: false
|
|
966
|
+
},
|
|
967
|
+
roundedEndEnd: {
|
|
968
|
+
type: [
|
|
969
|
+
Boolean,
|
|
970
|
+
Number,
|
|
971
|
+
String
|
|
972
|
+
],
|
|
973
|
+
required: false
|
|
974
|
+
},
|
|
975
|
+
elevation: {
|
|
976
|
+
type: [Number, String],
|
|
977
|
+
required: false
|
|
978
|
+
},
|
|
979
|
+
bgColor: {
|
|
980
|
+
type: [
|
|
981
|
+
String,
|
|
982
|
+
Object,
|
|
983
|
+
Boolean,
|
|
984
|
+
null
|
|
985
|
+
],
|
|
986
|
+
required: false,
|
|
987
|
+
skipCheck: true
|
|
988
|
+
},
|
|
989
|
+
fontSize: {
|
|
990
|
+
type: null,
|
|
991
|
+
required: false
|
|
992
|
+
},
|
|
993
|
+
fontWeight: {
|
|
994
|
+
type: null,
|
|
995
|
+
required: false
|
|
996
|
+
}
|
|
605
997
|
});
|
|
606
|
-
const emit = defineEmits([
|
|
998
|
+
const emit = defineEmits([
|
|
999
|
+
"drill",
|
|
1000
|
+
"drill-up",
|
|
1001
|
+
"zoom",
|
|
1002
|
+
"reset-zoom",
|
|
1003
|
+
"point-click",
|
|
1004
|
+
"legend-click",
|
|
1005
|
+
"series-toggle"
|
|
1006
|
+
]);
|
|
607
1007
|
defineSlots();
|
|
1008
|
+
/*********************************************************
|
|
1009
|
+
* Composables
|
|
1010
|
+
********************************************************/
|
|
608
1011
|
const { t } = useLocale();
|
|
1012
|
+
/*********************************************************
|
|
1013
|
+
* Drilldown state — a navigation stack where index 0 is the
|
|
1014
|
+
* root frame (props.series / props.categories). Each drill-in
|
|
1015
|
+
* pushes a new frame; "Back" pops it. The chart engine always
|
|
1016
|
+
* reads the top frame so reactivity flows automatically.
|
|
1017
|
+
*
|
|
1018
|
+
* Cycle detection: a point's drilldown id is looked up in the
|
|
1019
|
+
* dataset bank; if the id already appears in the current stack
|
|
1020
|
+
* we silently ignore the click to prevent infinite loops.
|
|
1021
|
+
* Maximum depth is naturally bounded by the number of distinct
|
|
1022
|
+
* dataset ids the consumer provides — infinite levels are
|
|
1023
|
+
* supported as long as there are no cycles.
|
|
1024
|
+
********************************************************/
|
|
609
1025
|
const drillStack = ref([]);
|
|
610
1026
|
const activeSeries = computed(() => {
|
|
611
|
-
|
|
612
|
-
|
|
1027
|
+
if (!drillStack.value.length) return props.series;
|
|
1028
|
+
return drillStack.value[drillStack.value.length - 1].series;
|
|
613
1029
|
});
|
|
614
1030
|
const activeCategories = computed(() => {
|
|
615
|
-
|
|
616
|
-
|
|
1031
|
+
if (!drillStack.value.length) return props.categories;
|
|
1032
|
+
return drillStack.value[drillStack.value.length - 1].categories;
|
|
617
1033
|
});
|
|
618
1034
|
const hasDrilldown = computed(() => Boolean(props.drilldown?.datasets?.length));
|
|
619
1035
|
const isDrilled = computed(() => drillStack.value.length > 0);
|
|
620
1036
|
const breadcrumbItems = computed(() => {
|
|
621
|
-
|
|
622
|
-
|
|
1037
|
+
const root = {
|
|
1038
|
+
name: props.title ?? t("origam.chart.drilldown.root_label"),
|
|
1039
|
+
depth: -1
|
|
1040
|
+
};
|
|
1041
|
+
return [root, ...drillStack.value.map((frame, i) => ({
|
|
1042
|
+
name: frame.name,
|
|
1043
|
+
depth: i
|
|
1044
|
+
}))];
|
|
623
1045
|
});
|
|
624
1046
|
const drilldownBackLabel = computed(() => props.drilldown?.backLabel ?? t("origam.chart.drilldown.back_label"));
|
|
625
1047
|
const drilldownNavAriaLabel = computed(() => t(props.drilldown?.navAriaLabel ?? "origam.chart.drilldown.aria_label"));
|
|
626
1048
|
const zoomResetAriaLabel = computed(() => t(props.zoomResetLabel));
|
|
1049
|
+
/*********************************************************
|
|
1050
|
+
* Largeur de la pilule « Reset zoom » — mesuree, pas devinee
|
|
1051
|
+
*
|
|
1052
|
+
* @description
|
|
1053
|
+
* La boite etait un `<rect width="64">` ECRIT EN DUR, dimensionne
|
|
1054
|
+
* pour l'anglais. Depuis que le texte visible suit la locale (#764),
|
|
1055
|
+
* toute langue plus verbeuse debordait. Mesure Chromium :
|
|
1056
|
+
*
|
|
1057
|
+
* en « Reset zoom » texte 56.75 → tenait
|
|
1058
|
+
* fr « Réinitialiser le zoom » texte 98.06 → +34.06 de debord
|
|
1059
|
+
*
|
|
1060
|
+
* @description
|
|
1061
|
+
* ⛔ SVG N'A PAS D'AUTO-LAYOUT : aucun mecanisme natif n'elargit un
|
|
1062
|
+
* `<rect>` au texte d'un `<text>` frere, contrairement au padding
|
|
1063
|
+
* d'une boite HTML. C'est le cas ou la plateforme ne fait PAS le
|
|
1064
|
+
* travail, donc on le lui demande explicitement — `getBBox()`, la
|
|
1065
|
+
* mesure typographique reelle du navigateur.
|
|
1066
|
+
*
|
|
1067
|
+
* @description
|
|
1068
|
+
* L'alternative — estimer depuis `label.length` — a ete ecartee sur
|
|
1069
|
+
* mesure, pas par principe : les deux chaines ci-dessus donnent
|
|
1070
|
+
* 5.68 et 4.67 unites par caractere. Un facteur unique se tromperait
|
|
1071
|
+
* deja de ~20 % sur ces deux-la, et davantage sur des glyphes larges
|
|
1072
|
+
* (`W` contre `i`), que le compte de caracteres ne distingue pas.
|
|
1073
|
+
*
|
|
1074
|
+
* @description
|
|
1075
|
+
* `getBBox` est absent en SSR et sous jsdom : la garde laisse alors
|
|
1076
|
+
* la pilule au plancher, qui est exactement le rendu d'avant.
|
|
1077
|
+
*
|
|
1078
|
+
* @description
|
|
1079
|
+
* Le `catch` couvre le second cas de repli : `getBBox()` LEVE sur un
|
|
1080
|
+
* noeud non rendu — onglet d'arriere-plan, `display: none`, sous-arbre
|
|
1081
|
+
* detache. Le plancher reste alors une largeur valide, donc l'echec de
|
|
1082
|
+
* mesure degrade le rendu sans jamais le casser.
|
|
1083
|
+
********************************************************/
|
|
627
1084
|
const zoomResetTextRef = ref(null);
|
|
628
1085
|
const zoomResetTextWidth = ref(0);
|
|
629
1086
|
const zoomResetWidth = computed(() => {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
CHART_ZOOM_RESET_MIN_WIDTH,
|
|
633
|
-
zoomResetTextWidth.value + CHART_ZOOM_RESET_PADDING_X * 2
|
|
634
|
-
);
|
|
1087
|
+
if (!zoomResetTextWidth.value) return CHART_ZOOM_RESET_MIN_WIDTH;
|
|
1088
|
+
return Math.max(CHART_ZOOM_RESET_MIN_WIDTH, zoomResetTextWidth.value + CHART_ZOOM_RESET_PADDING_X * 2);
|
|
635
1089
|
});
|
|
636
1090
|
const measureZoomResetText = async () => {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
1091
|
+
await nextTick();
|
|
1092
|
+
const el = zoomResetTextRef.value;
|
|
1093
|
+
if (!el || typeof el.getBBox !== "function") {
|
|
1094
|
+
zoomResetTextWidth.value = 0;
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
try {
|
|
1098
|
+
zoomResetTextWidth.value = el.getBBox().width;
|
|
1099
|
+
} catch {
|
|
1100
|
+
zoomResetTextWidth.value = 0;
|
|
1101
|
+
}
|
|
648
1102
|
};
|
|
649
1103
|
const resolveDrilldownLink = (link) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
1104
|
+
if (!props.drilldown) return null;
|
|
1105
|
+
const dataset = props.drilldown.datasets.find((d) => d.id === link.id);
|
|
1106
|
+
if (!dataset) return null;
|
|
1107
|
+
return {
|
|
1108
|
+
name: dataset.name,
|
|
1109
|
+
series: dataset.series,
|
|
1110
|
+
categories: dataset.categories ?? []
|
|
1111
|
+
};
|
|
658
1112
|
};
|
|
659
1113
|
const isDrilldownCycle = (id) => drillStack.value.some((frame) => frame.name === id);
|
|
660
1114
|
const onDrillIn = (link, point) => {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
1115
|
+
if (isDrilldownCycle(link.id)) return;
|
|
1116
|
+
const frame = resolveDrilldownLink(link);
|
|
1117
|
+
if (!frame) return;
|
|
1118
|
+
drillStack.value = [...drillStack.value, frame];
|
|
1119
|
+
hoveredPath.value = null;
|
|
1120
|
+
emit("drill", link, point);
|
|
667
1121
|
};
|
|
668
1122
|
const onDrillUp = () => {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
1123
|
+
if (!drillStack.value.length) return;
|
|
1124
|
+
drillStack.value = drillStack.value.slice(0, -1);
|
|
1125
|
+
hoveredPath.value = null;
|
|
1126
|
+
emit("drill-up");
|
|
673
1127
|
};
|
|
674
1128
|
const onBreadcrumbClick = (depth) => {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
1129
|
+
if (depth === -1) {
|
|
1130
|
+
drillStack.value = [];
|
|
1131
|
+
} else {
|
|
1132
|
+
drillStack.value = drillStack.value.slice(0, depth + 1);
|
|
1133
|
+
}
|
|
1134
|
+
hoveredPath.value = null;
|
|
681
1135
|
};
|
|
682
1136
|
const { dimensionStyles } = useDimension(props);
|
|
683
1137
|
const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(props, "bgColor");
|
|
@@ -687,431 +1141,545 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
687
1141
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
688
1142
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
689
1143
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
1144
|
+
/*********************************************************
|
|
1145
|
+
* Static — viewBox geometry. SVG renders into a fixed coordinate
|
|
1146
|
+
* space; CSS scales the resulting box. Trend sparklines use a
|
|
1147
|
+
* shorter viewBox so they don't grow taller than their host
|
|
1148
|
+
* row when wrapped into a table cell.
|
|
1149
|
+
********************************************************/
|
|
1150
|
+
const { resizeRef: svgSizeRef, width: svgWidth, height: svgHeight } = useChartSize({
|
|
1151
|
+
width: 600,
|
|
1152
|
+
height: 360
|
|
1153
|
+
});
|
|
1154
|
+
const PADDING_DEFAULT = {
|
|
1155
|
+
top: 24,
|
|
1156
|
+
right: 24,
|
|
1157
|
+
bottom: 36,
|
|
1158
|
+
left: 48
|
|
1159
|
+
};
|
|
1160
|
+
const PADDING_WITH_SECONDARY_AXIS = {
|
|
1161
|
+
top: 24,
|
|
1162
|
+
right: 56,
|
|
1163
|
+
bottom: 36,
|
|
1164
|
+
left: 48
|
|
1165
|
+
};
|
|
693
1166
|
const svgRef = ref(null);
|
|
694
1167
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
695
1168
|
const setSvgRef = (el) => {
|
|
696
|
-
|
|
697
|
-
|
|
1169
|
+
svgRef.value = el;
|
|
1170
|
+
svgSizeRef.value = el;
|
|
698
1171
|
};
|
|
699
|
-
const mousePos = ref({
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
);
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
1172
|
+
const mousePos = ref({
|
|
1173
|
+
x: 0,
|
|
1174
|
+
y: 0
|
|
1175
|
+
});
|
|
1176
|
+
const hasSecondaryAxis = computed(() => Boolean(props.secondaryYAxis) || activeSeries.value.some((s) => (s.yAxis ?? 0) === 1));
|
|
1177
|
+
const chartPadding = computed(() => hasSecondaryAxis.value ? PADDING_WITH_SECONDARY_AXIS : PADDING_DEFAULT);
|
|
1178
|
+
/*********************************************************
|
|
1179
|
+
* Zoom / pan state — `useChartZoom` manages the visible
|
|
1180
|
+
* category window. The engine clips `activeCategories` to
|
|
1181
|
+
* `[zoomStart, zoomEnd]` before scale computation. When
|
|
1182
|
+
* `zoomable` is `false` the window covers the full range and
|
|
1183
|
+
* all methods are no-ops from the consumer's perspective.
|
|
1184
|
+
********************************************************/
|
|
706
1185
|
const zoom = useChartZoom({ dataLength: () => activeCategories.value.length });
|
|
707
|
-
const {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
zoomReset: zoomResetState,
|
|
716
|
-
zoomBy,
|
|
717
|
-
pxToCategoryIndex,
|
|
718
|
-
WHEEL_ZOOM_STEP
|
|
719
|
-
} = zoom;
|
|
1186
|
+
const { zoomStart, zoomEnd, isDragging, dragStartPx, dragEndPx, isZoomed, zoomTo, zoomReset: zoomResetState, zoomBy, pxToCategoryIndex, WHEEL_ZOOM_STEP } = zoom;
|
|
1187
|
+
/*********************************************************
|
|
1188
|
+
* ⛔ Le `watch` vit ICI, et pas aupres de `measureZoomResetText`
|
|
1189
|
+
* qu'il appelle : `isZoomed` sort de la destructuration de
|
|
1190
|
+
* `useChartZoom` juste au-dessus, et il est `immediate`. Declare
|
|
1191
|
+
* plus haut, il lirait `isZoomed` avant son `const` — zone morte
|
|
1192
|
+
* temporelle, qui casse le montage du composant entier.
|
|
1193
|
+
********************************************************/
|
|
720
1194
|
watch(
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1195
|
+
[
|
|
1196
|
+
zoomResetAriaLabel,
|
|
1197
|
+
isZoomed,
|
|
1198
|
+
() => props.zoomable
|
|
1199
|
+
],
|
|
1200
|
+
/*********************************************************
|
|
1201
|
+
* Promesse flottante, deliberement
|
|
1202
|
+
*
|
|
1203
|
+
* @description
|
|
1204
|
+
* La mesure se fait en `flush: 'post'` et rien n'attend la
|
|
1205
|
+
* promesse. Le `void` qui marquait cette intention est retire
|
|
1206
|
+
* (Sonar #771) : la valeur de retour reste ignoree a l'identique,
|
|
1207
|
+
* et le callback rend toujours `undefined`.
|
|
1208
|
+
********************************************************/
|
|
1209
|
+
() => {
|
|
1210
|
+
measureZoomResetText();
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
flush: "post",
|
|
1214
|
+
immediate: true
|
|
1215
|
+
}
|
|
735
1216
|
);
|
|
736
1217
|
const visibleCategories = computed(() => {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
1218
|
+
if (!props.zoomable) return activeCategories.value;
|
|
1219
|
+
const len = activeCategories.value.length;
|
|
1220
|
+
if (!len) return activeCategories.value;
|
|
1221
|
+
const s = zoomStart.value;
|
|
1222
|
+
const e = Math.min(zoomEnd.value, len - 1);
|
|
1223
|
+
return activeCategories.value.slice(s, e + 1);
|
|
743
1224
|
});
|
|
1225
|
+
/*********************************************************
|
|
1226
|
+
* Range selector state — tracks which button is currently active.
|
|
1227
|
+
********************************************************/
|
|
744
1228
|
const rangeSelectorActiveIndex = ref(-1);
|
|
745
|
-
const hasRangeSelector = computed(
|
|
746
|
-
() => Boolean(props.rangeSelector?.enabled)
|
|
747
|
-
);
|
|
1229
|
+
const hasRangeSelector = computed(() => Boolean(props.rangeSelector?.enabled));
|
|
748
1230
|
const rangeSelectorButtons = computed(() => {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1231
|
+
const custom = props.rangeSelector?.buttons;
|
|
1232
|
+
if (custom && custom.length) return custom;
|
|
1233
|
+
return CHART_RANGE_SELECTOR_DEFAULT_BUTTONS;
|
|
752
1234
|
});
|
|
753
1235
|
const onRangeSelectorSelect = (index, start, end) => {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1236
|
+
rangeSelectorActiveIndex.value = index;
|
|
1237
|
+
if (props.zoomable) {
|
|
1238
|
+
zoomTo(start, end);
|
|
1239
|
+
emit("zoom", {
|
|
1240
|
+
start,
|
|
1241
|
+
end
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
759
1244
|
};
|
|
760
|
-
watch(
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
1245
|
+
watch(() => activeCategories.value.length, () => {
|
|
1246
|
+
zoomResetState();
|
|
1247
|
+
rangeSelectorActiveIndex.value = -1;
|
|
1248
|
+
const sel = props.rangeSelector?.selected;
|
|
1249
|
+
if (sel !== undefined && rangeSelectorButtons.value[sel]) {
|
|
1250
|
+
const btn = rangeSelectorButtons.value[sel];
|
|
1251
|
+
const len = activeCategories.value.length;
|
|
1252
|
+
let start;
|
|
1253
|
+
let end;
|
|
1254
|
+
if (btn.fraction !== undefined) {
|
|
1255
|
+
const windowSize = Math.round(len * Math.max(0, Math.min(1, btn.fraction)));
|
|
1256
|
+
start = Math.max(0, len - windowSize);
|
|
1257
|
+
end = len - 1;
|
|
1258
|
+
} else if (btn.count !== undefined) {
|
|
1259
|
+
start = Math.max(0, len - btn.count);
|
|
1260
|
+
end = len - 1;
|
|
1261
|
+
} else {
|
|
1262
|
+
start = 0;
|
|
1263
|
+
end = len - 1;
|
|
1264
|
+
}
|
|
1265
|
+
rangeSelectorActiveIndex.value = sel;
|
|
1266
|
+
if (props.zoomable) zoomTo(start, end);
|
|
1267
|
+
}
|
|
1268
|
+
}, { immediate: true });
|
|
1269
|
+
/*********************************************************
|
|
1270
|
+
* Engine — `useChart` produces every descriptor needed to
|
|
1271
|
+
* paint. The thunks make the composable reactive against
|
|
1272
|
+
* `props` without owning the prop reference itself.
|
|
1273
|
+
* When drilled in, `activeSeries` / `activeCategories` point
|
|
1274
|
+
* to the sub-dataset instead of the root props.
|
|
1275
|
+
* The zoom window clips the visible category slice so the
|
|
1276
|
+
* X scale maps only the visible range to the full plot width.
|
|
1277
|
+
********************************************************/
|
|
788
1278
|
const chart = useChart({
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
1279
|
+
type: () => props.type,
|
|
1280
|
+
series: () => activeSeries.value,
|
|
1281
|
+
categories: () => visibleCategories.value,
|
|
1282
|
+
stacked: () => props.stacked,
|
|
1283
|
+
stacking: () => props.stacking,
|
|
1284
|
+
// donutHoleSize is a no-op for cartesian; fixed to 0.
|
|
1285
|
+
donutHoleSize: () => 0,
|
|
1286
|
+
colorScheme: () => props.colorScheme,
|
|
1287
|
+
smoothing: () => props.smoothing,
|
|
1288
|
+
yMin: () => props.yMin,
|
|
1289
|
+
yMax: () => props.yMax,
|
|
1290
|
+
width: () => svgWidth.value,
|
|
1291
|
+
height: () => svgHeight.value,
|
|
1292
|
+
padding: () => chartPadding.value,
|
|
1293
|
+
secondaryYAxis: () => props.secondaryYAxis
|
|
804
1294
|
});
|
|
805
1295
|
const { viewBox, ticks, secondaryTicks, paths, legend, plot, scales, yRange, slotCount, effectiveStacking, percentValues } = chart;
|
|
1296
|
+
/*********************************************************
|
|
1297
|
+
* Plot bands + lines — background decoration layers.
|
|
1298
|
+
* Split by `layer` so the template renders below/above
|
|
1299
|
+
* data in the correct order without z-index tricks.
|
|
1300
|
+
********************************************************/
|
|
806
1301
|
const bandDescriptors = computed(() => {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
scales.value,
|
|
813
|
-
activeCategories.value,
|
|
814
|
-
x0,
|
|
815
|
-
x1,
|
|
816
|
-
y0,
|
|
817
|
-
y1
|
|
818
|
-
)
|
|
819
|
-
})).filter((d) => d.geo !== null);
|
|
1302
|
+
const { x0, x1, y0, y1 } = plot.value;
|
|
1303
|
+
return (props.plotBands ?? []).map((band) => ({
|
|
1304
|
+
band,
|
|
1305
|
+
geo: computePlotBandGeometry(band, scales.value, activeCategories.value, x0, x1, y0, y1)
|
|
1306
|
+
})).filter((d) => d.geo !== null);
|
|
820
1307
|
});
|
|
821
1308
|
const lineDescriptors = computed(() => {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
scales.value,
|
|
828
|
-
activeCategories.value,
|
|
829
|
-
x0,
|
|
830
|
-
x1,
|
|
831
|
-
y0,
|
|
832
|
-
y1
|
|
833
|
-
)
|
|
834
|
-
})).filter((d) => d.geo !== null);
|
|
1309
|
+
const { x0, x1, y0, y1 } = plot.value;
|
|
1310
|
+
return (props.plotLines ?? []).map((line) => ({
|
|
1311
|
+
line,
|
|
1312
|
+
geo: computePlotLineGeometry(line, scales.value, activeCategories.value, x0, x1, y0, y1)
|
|
1313
|
+
})).filter((d) => d.geo !== null);
|
|
835
1314
|
});
|
|
836
|
-
const belowBands = computed(
|
|
837
|
-
|
|
838
|
-
);
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const aboveLines = computed(
|
|
846
|
-
() => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "above")
|
|
847
|
-
);
|
|
1315
|
+
const belowBands = computed(() => bandDescriptors.value.filter((d) => (d.band.layer ?? "below") === "below"));
|
|
1316
|
+
const aboveBands = computed(() => bandDescriptors.value.filter((d) => d.band.layer === "above"));
|
|
1317
|
+
const belowLines = computed(() => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "below"));
|
|
1318
|
+
const aboveLines = computed(() => lineDescriptors.value.filter((d) => (d.line.layer ?? "above") === "above"));
|
|
1319
|
+
/*********************************************************
|
|
1320
|
+
* Annotations — projected above all series and decorations.
|
|
1321
|
+
* Each entry is `IChartAnnotationGeo | null`; nulls are
|
|
1322
|
+
* filtered out so the template never receives bad geometry.
|
|
1323
|
+
********************************************************/
|
|
848
1324
|
const annotationGeos = computed(() => {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1325
|
+
const annos = props.annotations ?? [];
|
|
1326
|
+
if (!annos.length) return [];
|
|
1327
|
+
return annos.map((a) => computeAnnotationGeometry(a, scales.value, visibleCategories.value, slotCount.value)).filter((g) => g !== null);
|
|
852
1328
|
});
|
|
1329
|
+
/*********************************************************
|
|
1330
|
+
* Hover / tooltip — pure data flow, no DOM measurements
|
|
1331
|
+
* beyond positioning the floating tooltip. Identical to the
|
|
1332
|
+
* shell pattern.
|
|
1333
|
+
********************************************************/
|
|
853
1334
|
const hoveredPath = ref(null);
|
|
854
1335
|
const hoveredPoint = computed(() => {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1336
|
+
const p = hoveredPath.value;
|
|
1337
|
+
if (!p) return null;
|
|
1338
|
+
const series = p.series;
|
|
1339
|
+
const visibleIdx = p.dataIndex ?? 0;
|
|
1340
|
+
const absIdx = zoomStart.value + visibleIdx;
|
|
1341
|
+
const entry = series.data[absIdx] ?? series.data[visibleIdx];
|
|
1342
|
+
const x = typeof entry === "number" ? visibleCategories.value[visibleIdx] ?? activeCategories.value[absIdx] ?? absIdx : entry.x;
|
|
1343
|
+
const y = typeof entry === "number" ? entry : entry.y;
|
|
1344
|
+
return {
|
|
1345
|
+
seriesIndex: p.seriesIndex,
|
|
1346
|
+
seriesName: series.name,
|
|
1347
|
+
dataIndex: absIdx,
|
|
1348
|
+
x,
|
|
1349
|
+
y,
|
|
1350
|
+
color: p.color
|
|
1351
|
+
};
|
|
871
1352
|
});
|
|
872
|
-
const hoveredSeries = computed(
|
|
873
|
-
() => hoveredPath.value?.series ?? null
|
|
874
|
-
);
|
|
1353
|
+
const hoveredSeries = computed(() => hoveredPath.value?.series ?? null);
|
|
875
1354
|
const hoveredCategory = computed(() => {
|
|
876
|
-
|
|
877
|
-
|
|
1355
|
+
if (!hoveredPoint.value) return "";
|
|
1356
|
+
return activeCategories.value[hoveredPoint.value.dataIndex] ?? hoveredPoint.value.x;
|
|
878
1357
|
});
|
|
1358
|
+
/*********************************************************
|
|
1359
|
+
* Empty state — fired when no series carries usable data.
|
|
1360
|
+
********************************************************/
|
|
879
1361
|
const showEmpty = computed(() => {
|
|
880
|
-
|
|
881
|
-
|
|
1362
|
+
if (!activeSeries.value?.length) return true;
|
|
1363
|
+
return activeSeries.value.every((s) => !s.data?.length || s.visible === false);
|
|
882
1364
|
});
|
|
1365
|
+
/*********************************************************
|
|
1366
|
+
* Root classes / styles — `aspectRatio` wins over `height`.
|
|
1367
|
+
********************************************************/
|
|
883
1368
|
const rootClasses = computed(() => [
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1369
|
+
{
|
|
1370
|
+
[`origam-chart-cartesian--${props.type}`]: true,
|
|
1371
|
+
[`origam-chart-cartesian--legend-${props.legendPosition}`]: true,
|
|
1372
|
+
"origam-chart-cartesian--no-animation": !props.animated
|
|
1373
|
+
},
|
|
1374
|
+
backgroundColorClasses.value,
|
|
1375
|
+
elevationClasses.value,
|
|
1376
|
+
marginClasses.value,
|
|
1377
|
+
paddingClasses.value,
|
|
1378
|
+
roundedClasses.value,
|
|
1379
|
+
props.class
|
|
895
1380
|
]);
|
|
896
1381
|
const rootStyles = computed(() => {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1382
|
+
const out = {};
|
|
1383
|
+
if (props.aspectRatio) {
|
|
1384
|
+
out.aspectRatio = props.aspectRatio;
|
|
1385
|
+
}
|
|
1386
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
1387
|
+
return [out, props.style];
|
|
903
1388
|
});
|
|
904
|
-
const bodyClasses = computed(() => ({
|
|
905
|
-
"origam-chart-cartesian__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right")
|
|
906
|
-
}));
|
|
1389
|
+
const bodyClasses = computed(() => ({ "origam-chart-cartesian__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
907
1390
|
const svgClasses = computed(() => ({
|
|
908
|
-
|
|
909
|
-
|
|
1391
|
+
"origam-chart__svg--animated": props.animated,
|
|
1392
|
+
"origam-chart__svg--zoomable": props.zoomable
|
|
910
1393
|
}));
|
|
911
1394
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
1395
|
+
/*********************************************************
|
|
1396
|
+
* Format helpers — fall back to identity.
|
|
1397
|
+
********************************************************/
|
|
912
1398
|
const formatY = (value) => {
|
|
913
|
-
|
|
914
|
-
|
|
1399
|
+
if (props.yAxisFormat) return props.yAxisFormat(value);
|
|
1400
|
+
return String(value);
|
|
915
1401
|
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Y-axis formatter active for the currently hovered series.
|
|
1404
|
+
*
|
|
1405
|
+
* - Secondary axis: uses `secondaryYAxis.format` when present.
|
|
1406
|
+
* - Percent stacking: overrides with `rawValue (XX.X%)` so the
|
|
1407
|
+
* tooltip shows both the raw data value and the stack share.
|
|
1408
|
+
* - Default: falls back to `props.yAxisFormat` or identity.
|
|
1409
|
+
*/
|
|
916
1410
|
const activeYAxisFormat = computed(() => {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1411
|
+
const isPercent = effectiveStacking.value === "percent" && props.stacked;
|
|
1412
|
+
if (isPercent) {
|
|
1413
|
+
return (rawY) => {
|
|
1414
|
+
const seriesIdx = hoveredPath.value?.seriesIndex ?? -1;
|
|
1415
|
+
const dataIdx = hoveredPath.value?.dataIndex ?? 0;
|
|
1416
|
+
const pct = seriesIdx >= 0 ? percentValues.value.get(seriesIdx)?.[dataIdx] ?? 0 : 0;
|
|
1417
|
+
const base = props.yAxisFormat ? props.yAxisFormat(rawY) : String(rawY);
|
|
1418
|
+
return `${base} (${pct.toFixed(1)}%)`;
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
const s = hoveredSeries.value;
|
|
1422
|
+
if (s && (s.yAxis ?? 0) === 1 && props.secondaryYAxis?.format) {
|
|
1423
|
+
return props.secondaryYAxis.format;
|
|
1424
|
+
}
|
|
1425
|
+
return props.yAxisFormat;
|
|
932
1426
|
});
|
|
1427
|
+
/*********************************************************
|
|
1428
|
+
* Path classification — pie / donut helpers don't apply
|
|
1429
|
+
* here (the engine never emits a slice descriptor when
|
|
1430
|
+
* `type` is cartesian). We keep `effectiveTypeOf` for
|
|
1431
|
+
* mixed-type series (e.g. a `<column>` chart with a `line`
|
|
1432
|
+
* overlay series).
|
|
1433
|
+
********************************************************/
|
|
933
1434
|
const effectiveTypeOf = (path) => path.series.type ?? props.type;
|
|
1435
|
+
/*********************************************************
|
|
1436
|
+
* strokeStyleFor — `--origam-chart-path---length` n'est PAS un token
|
|
1437
|
+
*
|
|
1438
|
+
* @description
|
|
1439
|
+
* ⛔ Cette variable ne doit PAS etre declaree dans les feuilles de tokens
|
|
1440
|
+
* (#591). C'est une synthese locale : la longueur MESUREE de chaque
|
|
1441
|
+
* trace, ecrite en style inline par instance et relue par
|
|
1442
|
+
* `stroke-dasharray` / `stroke-dashoffset` dans le bloc `<style>` pour
|
|
1443
|
+
* l'animation de dessin.
|
|
1444
|
+
*
|
|
1445
|
+
* @description
|
|
1446
|
+
* Une declaration de feuille serait inerte (le style inline gagne) et
|
|
1447
|
+
* surtout mensongere : un theme qui la reglerait casserait l'animation
|
|
1448
|
+
* sur tous les traces a la fois. Le garde `token-var-channels` la compte
|
|
1449
|
+
* en « canal mort » a tort — son exclusion « synthese locale » ne regarde
|
|
1450
|
+
* que les LHS du `<style>`, pas celles ecrites depuis le `<script>`.
|
|
1451
|
+
* Laissee en baseline volontairement.
|
|
1452
|
+
********************************************************/
|
|
934
1453
|
const strokeStyleFor = (path) => {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1454
|
+
if (!props.animated) return {};
|
|
1455
|
+
const length = path.pathLength ?? 0;
|
|
1456
|
+
if (!length) return {};
|
|
1457
|
+
return { "--origam-chart-path---length": String(length) };
|
|
939
1458
|
};
|
|
1459
|
+
/*
|
|
1460
|
+
* Combined inline style for SVG `<path>` — pre-fix the fill /
|
|
1461
|
+
* stroke were emitted as SVG presentation attributes
|
|
1462
|
+
* (`fill="..."`, `stroke="..."`), which are treated as INITIAL
|
|
1463
|
+
* CSS values and lose against the scoped `.origam-chart__path
|
|
1464
|
+
* { fill: none; }` rule below. The area's translucent fill
|
|
1465
|
+
* therefore never rendered — the user-reported "area looks
|
|
1466
|
+
* identical to line" symptom. Inline styles have higher
|
|
1467
|
+
* precedence than CSS rules, so emitting them here makes the
|
|
1468
|
+
* fill / stroke survive the cascade.
|
|
1469
|
+
*/
|
|
940
1470
|
const pathStyleFor = (path) => {
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1471
|
+
const base = strokeStyleFor(path);
|
|
1472
|
+
const isAreaFill = path.variant === "fill" && effectiveTypeOf(path) === "area";
|
|
1473
|
+
const isStroke = path.variant !== "fill";
|
|
1474
|
+
return {
|
|
1475
|
+
...base,
|
|
1476
|
+
fill: isAreaFill ? path.color : "none",
|
|
1477
|
+
fillOpacity: isAreaFill ? "0.25" : "0",
|
|
1478
|
+
stroke: isStroke ? path.color : "none"
|
|
1479
|
+
};
|
|
950
1480
|
};
|
|
1481
|
+
/*********************************************************
|
|
1482
|
+
* Interaction
|
|
1483
|
+
********************************************************/
|
|
951
1484
|
const hoverMatches = (path) => hoveredPath.value === path;
|
|
952
1485
|
const onPointEnter = (path) => {
|
|
953
|
-
|
|
954
|
-
|
|
1486
|
+
hoveredPath.value = path;
|
|
1487
|
+
if (hoveredPoint.value) chart.onPointHover(hoveredPoint.value);
|
|
955
1488
|
};
|
|
956
1489
|
const onPointLeaveEvent = () => {
|
|
957
|
-
|
|
958
|
-
|
|
1490
|
+
hoveredPath.value = null;
|
|
1491
|
+
chart.onPointHover(null);
|
|
959
1492
|
};
|
|
960
1493
|
const onSvgMouseMove = (event) => {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1494
|
+
const target = svgRef.value;
|
|
1495
|
+
if (!target) return;
|
|
1496
|
+
const rect = target.getBoundingClientRect();
|
|
1497
|
+
mousePos.value = {
|
|
1498
|
+
x: event.clientX - rect.left,
|
|
1499
|
+
y: event.clientY - rect.top
|
|
1500
|
+
};
|
|
968
1501
|
};
|
|
969
1502
|
const onSvgMouseLeave = () => {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1503
|
+
if (isDragging.value) {
|
|
1504
|
+
isDragging.value = false;
|
|
1505
|
+
dragStartPx.value = null;
|
|
1506
|
+
dragEndPx.value = null;
|
|
1507
|
+
}
|
|
1508
|
+
onPointLeaveEvent();
|
|
976
1509
|
};
|
|
1510
|
+
/*********************************************************
|
|
1511
|
+
* Zoom / pan interactions
|
|
1512
|
+
*
|
|
1513
|
+
* SVG viewBox follows the measured box (useChartSize). Mouse events
|
|
1514
|
+
* are in DOM pixels; we convert via `getBoundingClientRect()` +
|
|
1515
|
+
* the scale factor between DOM and SVG viewBox dimensions.
|
|
1516
|
+
********************************************************/
|
|
977
1517
|
const svgToCategoryIndex = (clientX) => {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1518
|
+
const svgEl = svgRef.value;
|
|
1519
|
+
if (!svgEl) return 0;
|
|
1520
|
+
const rect = svgEl.getBoundingClientRect();
|
|
1521
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
1522
|
+
const svgX = (clientX - rect.left) * domRatio;
|
|
1523
|
+
return pxToCategoryIndex(svgX, plot.value.x0, plot.value.x1);
|
|
984
1524
|
};
|
|
985
1525
|
const onSvgMouseDown = (event) => {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1526
|
+
if (!props.zoomable) return;
|
|
1527
|
+
if (event.button !== 0) return;
|
|
1528
|
+
if (event.ctrlKey || event.metaKey) {
|
|
1529
|
+
isDragging.value = false;
|
|
1530
|
+
dragStartPx.value = event.clientX;
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
isDragging.value = true;
|
|
1534
|
+
dragStartPx.value = event.clientX;
|
|
1535
|
+
dragEndPx.value = event.clientX;
|
|
1536
|
+
const handleMouseMove = (mv) => {
|
|
1537
|
+
if (!isDragging.value) return;
|
|
1538
|
+
dragEndPx.value = mv.clientX;
|
|
1539
|
+
};
|
|
1540
|
+
const handleMouseUp = (mu) => {
|
|
1541
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
1542
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
1543
|
+
if (!isDragging.value) return;
|
|
1544
|
+
isDragging.value = false;
|
|
1545
|
+
const startIdx = svgToCategoryIndex(dragStartPx.value ?? mu.clientX);
|
|
1546
|
+
const endIdx = svgToCategoryIndex(mu.clientX);
|
|
1547
|
+
dragStartPx.value = null;
|
|
1548
|
+
dragEndPx.value = null;
|
|
1549
|
+
const lo = Math.floor(Math.min(startIdx, endIdx));
|
|
1550
|
+
const hi = Math.ceil(Math.max(startIdx, endIdx));
|
|
1551
|
+
if (hi - lo < 1) return;
|
|
1552
|
+
const len = activeCategories.value.length;
|
|
1553
|
+
const absLo = zoomStart.value + lo;
|
|
1554
|
+
const absHi = Math.min(len - 1, zoomStart.value + hi);
|
|
1555
|
+
if (absHi - absLo < 1) return;
|
|
1556
|
+
zoomTo(absLo, absHi);
|
|
1557
|
+
rangeSelectorActiveIndex.value = -1;
|
|
1558
|
+
emit("zoom", {
|
|
1559
|
+
start: absLo,
|
|
1560
|
+
end: absHi
|
|
1561
|
+
});
|
|
1562
|
+
};
|
|
1563
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
1564
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
1024
1565
|
};
|
|
1566
|
+
const onSvgMouseUp = (_event) => {};
|
|
1025
1567
|
const onSvgWheel = (event) => {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1568
|
+
if (!props.zoomable) return;
|
|
1569
|
+
if (!event.shiftKey) return;
|
|
1570
|
+
event.preventDefault();
|
|
1571
|
+
const svgEl = svgRef.value;
|
|
1572
|
+
if (!svgEl) return;
|
|
1573
|
+
const rect = svgEl.getBoundingClientRect();
|
|
1574
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
1575
|
+
const svgX = (event.clientX - rect.left) * domRatio;
|
|
1576
|
+
const { x0, x1 } = plot.value;
|
|
1577
|
+
const plotWidth = Math.max(1, x1 - x0);
|
|
1578
|
+
const anchorFraction = Math.max(0, Math.min(1, (svgX - x0) / plotWidth));
|
|
1579
|
+
const zoomIn = event.deltaY < 0;
|
|
1580
|
+
const delta = zoomIn ? WHEEL_ZOOM_STEP : -WHEEL_ZOOM_STEP;
|
|
1581
|
+
zoomBy(delta, anchorFraction);
|
|
1582
|
+
rangeSelectorActiveIndex.value = -1;
|
|
1583
|
+
emit("zoom", {
|
|
1584
|
+
start: zoomStart.value,
|
|
1585
|
+
end: zoomEnd.value
|
|
1586
|
+
});
|
|
1042
1587
|
};
|
|
1043
1588
|
const onZoomReset = () => {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1589
|
+
zoomResetState();
|
|
1590
|
+
rangeSelectorActiveIndex.value = -1;
|
|
1591
|
+
emit("reset-zoom");
|
|
1047
1592
|
};
|
|
1048
1593
|
const dragSelectionRect = computed(() => {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1594
|
+
if (!isDragging.value || dragStartPx.value === null || dragEndPx.value === null) return null;
|
|
1595
|
+
const svgEl = svgRef.value;
|
|
1596
|
+
if (!svgEl) return null;
|
|
1597
|
+
const rect = svgEl.getBoundingClientRect();
|
|
1598
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
1599
|
+
const startSvgX = (dragStartPx.value - rect.left) * domRatio;
|
|
1600
|
+
const endSvgX = (dragEndPx.value - rect.left) * domRatio;
|
|
1601
|
+
const { x0, x1, y0, y1 } = plot.value;
|
|
1602
|
+
const left = Math.max(x0, Math.min(x1, Math.min(startSvgX, endSvgX)));
|
|
1603
|
+
const right = Math.max(x0, Math.min(x1, Math.max(startSvgX, endSvgX)));
|
|
1604
|
+
const width = right - left;
|
|
1605
|
+
if (width < 1) return null;
|
|
1606
|
+
return {
|
|
1607
|
+
x: left,
|
|
1608
|
+
y: y0,
|
|
1609
|
+
width,
|
|
1610
|
+
height: y1 - y0
|
|
1611
|
+
};
|
|
1062
1612
|
});
|
|
1063
1613
|
const onPointActivate = (path, event) => {
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1614
|
+
if (!hoveredPoint.value || hoveredPath.value !== path) {
|
|
1615
|
+
hoveredPath.value = path;
|
|
1616
|
+
}
|
|
1617
|
+
if (!hoveredPoint.value) return;
|
|
1618
|
+
const currentPoint = hoveredPoint.value;
|
|
1619
|
+
if (hasDrilldown.value) {
|
|
1620
|
+
const dataIdx = path.dataIndex ?? 0;
|
|
1621
|
+
const entry = path.series.data[dataIdx];
|
|
1622
|
+
const drillLink = typeof entry !== "number" ? entry.drilldown : undefined;
|
|
1623
|
+
if (drillLink) {
|
|
1624
|
+
onDrillIn(drillLink, currentPoint);
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
emit("point-click", currentPoint, event);
|
|
1079
1629
|
};
|
|
1080
1630
|
const onLegendClick = (series, index) => {
|
|
1081
|
-
|
|
1631
|
+
emit("legend-click", series, index);
|
|
1082
1632
|
};
|
|
1083
1633
|
const onSeriesToggle = (series, nextVisible) => {
|
|
1084
|
-
|
|
1085
|
-
|
|
1634
|
+
series.visible = nextVisible;
|
|
1635
|
+
emit("series-toggle", series, nextVisible);
|
|
1086
1636
|
};
|
|
1637
|
+
/*********************************************************
|
|
1638
|
+
* ARIA
|
|
1639
|
+
*
|
|
1640
|
+
* @description
|
|
1641
|
+
* `svgDesc` compose DEUX comptes INDEPENDANTS — les series et les points.
|
|
1642
|
+
* Une seule cle pluralisee ne peut pas les accorder tous les deux : la
|
|
1643
|
+
* forme est choisie sur UN compte, et l'autre suit la mauvaise categorie.
|
|
1644
|
+
* Mesure en `fr` avec 1 serie et 5 points, la cle unique selectionnait
|
|
1645
|
+
* `desc_other` et rendait « avec 1 series et 5 points » ; avec 3 series et
|
|
1646
|
+
* 1 point elle rendait « avec 3 serie et 1 point ».
|
|
1647
|
+
* @description
|
|
1648
|
+
* Invisible en `en`, ou « series » est invariable — c'est pourquoi le
|
|
1649
|
+
* defaut a franchi la revue de #610. Chaque compte est donc resolu par son
|
|
1650
|
+
* PROPRE appel a `t()`, puis la chaine porteuse recoit les fragments deja
|
|
1651
|
+
* resolus en simple substitution : la couche i18n n'a rien a composer.
|
|
1652
|
+
* Meme patron que radar / streamgraph / sankey ; les composants a un seul
|
|
1653
|
+
* compte (variwide) gardent la forme simple `desc_one` / `desc_other`.
|
|
1654
|
+
********************************************************/
|
|
1087
1655
|
const ariaLabel = computed(() => props.title ?? t("origam.chart.aria_label"));
|
|
1088
1656
|
const svgAriaLabel = computed(() => props.title ?? t("origam.chart.cartesian.aria_label", { type: props.type }));
|
|
1089
1657
|
const svgTitle = computed(() => props.title ?? t("origam.chart.cartesian.aria_label", { type: props.type }));
|
|
1090
1658
|
const svgDesc = computed(() => {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1659
|
+
const seriesCount = activeSeries.value.length;
|
|
1660
|
+
if (!seriesCount) return t("origam.chart.desc_no_data");
|
|
1661
|
+
const range = yRange.value;
|
|
1662
|
+
const points = slotCount.value;
|
|
1663
|
+
return t("origam.chart.cartesian.desc", {
|
|
1664
|
+
type: props.type,
|
|
1665
|
+
series: t("origam.chart.cartesian.desc_series", seriesCount, { count: seriesCount }),
|
|
1666
|
+
points: t("origam.chart.cartesian.desc_points", points, { count: points }),
|
|
1667
|
+
min: range.min,
|
|
1668
|
+
max: range.max
|
|
1669
|
+
});
|
|
1102
1670
|
});
|
|
1103
1671
|
const pointAriaLabel = (path) => {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1672
|
+
const dataIdx = path.dataIndex ?? 0;
|
|
1673
|
+
const absIdx = zoomStart.value + dataIdx;
|
|
1674
|
+
const entry = path.series.data[absIdx] ?? path.series.data[dataIdx];
|
|
1675
|
+
const y = typeof entry === "number" ? entry : entry.y;
|
|
1676
|
+
const cat = visibleCategories.value[dataIdx] ?? activeCategories.value[absIdx] ?? absIdx;
|
|
1677
|
+
const isPercent = effectiveStacking.value === "percent" && props.stacked;
|
|
1678
|
+
if (isPercent) {
|
|
1679
|
+
const pct = percentValues.value.get(path.seriesIndex)?.[dataIdx] ?? 0;
|
|
1680
|
+
return `${path.series.name}, ${cat}: ${formatY(y)} (${pct.toFixed(1)}%)`;
|
|
1681
|
+
}
|
|
1682
|
+
return `${path.series.name}, ${cat}: ${formatY(y)}`;
|
|
1115
1683
|
};
|
|
1116
1684
|
</script>
|
|
1117
1685
|
|