origam 2.38.0 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +8 -8
|
@@ -170,10 +170,7 @@
|
|
|
170
170
|
|
|
171
171
|
<script lang="ts" setup>
|
|
172
172
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
173
|
-
import {
|
|
174
|
-
computed,
|
|
175
|
-
ref
|
|
176
|
-
} from "vue";
|
|
173
|
+
import { computed, ref } from "vue";
|
|
177
174
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
178
175
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
179
176
|
import { useUnsupportedProp } from "../../composables/Commons/unsupportedProp.composable";
|
|
@@ -189,73 +186,430 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
189
186
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
190
187
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
191
188
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
/*********************************************************
|
|
190
|
+
* Global
|
|
191
|
+
*
|
|
192
|
+
* @description
|
|
193
|
+
* Sankey diagram family. Visualises flows between categories:
|
|
194
|
+
* energy budgets, revenue funnels, web-traffic paths.
|
|
195
|
+
*
|
|
196
|
+
* - Nodes are inferred from unique `from` / `to` strings.
|
|
197
|
+
* - Columns are assigned via topological sort (Kahn's algorithm).
|
|
198
|
+
* - Flows are rendered as cubic Bezier ribbons.
|
|
199
|
+
*
|
|
200
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
201
|
+
********************************************************/
|
|
202
|
+
defineOptions({ name: "OrigamChartSankey" });
|
|
195
203
|
const props = defineProps({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
204
|
+
nodeWidth: {
|
|
205
|
+
type: Number,
|
|
206
|
+
required: false,
|
|
207
|
+
default: 16
|
|
208
|
+
},
|
|
209
|
+
nodePadding: {
|
|
210
|
+
type: Number,
|
|
211
|
+
required: false,
|
|
212
|
+
default: 8
|
|
213
|
+
},
|
|
214
|
+
linkOpacity: {
|
|
215
|
+
type: Number,
|
|
216
|
+
required: false,
|
|
217
|
+
default: .4
|
|
218
|
+
},
|
|
219
|
+
showLabel: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
required: false,
|
|
222
|
+
default: true
|
|
223
|
+
},
|
|
224
|
+
xAxisFormat: {
|
|
225
|
+
type: Function,
|
|
226
|
+
required: false,
|
|
227
|
+
default: undefined
|
|
228
|
+
},
|
|
229
|
+
yAxisFormat: {
|
|
230
|
+
type: Function,
|
|
231
|
+
required: false,
|
|
232
|
+
default: undefined
|
|
233
|
+
},
|
|
234
|
+
series: {
|
|
235
|
+
type: Array,
|
|
236
|
+
required: true
|
|
237
|
+
},
|
|
238
|
+
categories: {
|
|
239
|
+
type: Array,
|
|
240
|
+
required: false
|
|
241
|
+
},
|
|
242
|
+
title: {
|
|
243
|
+
type: String,
|
|
244
|
+
required: false,
|
|
245
|
+
default: undefined
|
|
246
|
+
},
|
|
247
|
+
subtitle: {
|
|
248
|
+
type: String,
|
|
249
|
+
required: false,
|
|
250
|
+
default: undefined
|
|
251
|
+
},
|
|
252
|
+
showLegend: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
required: false,
|
|
255
|
+
default: false
|
|
256
|
+
},
|
|
257
|
+
legendPosition: {
|
|
258
|
+
type: null,
|
|
259
|
+
required: false,
|
|
260
|
+
default: "bottom"
|
|
261
|
+
},
|
|
262
|
+
showTooltip: {
|
|
263
|
+
type: Boolean,
|
|
264
|
+
required: false,
|
|
265
|
+
default: true
|
|
266
|
+
},
|
|
267
|
+
animated: {
|
|
268
|
+
type: Boolean,
|
|
269
|
+
required: false,
|
|
270
|
+
default: true
|
|
271
|
+
},
|
|
272
|
+
animationDuration: {
|
|
273
|
+
type: Number,
|
|
274
|
+
required: false,
|
|
275
|
+
default: 600
|
|
276
|
+
},
|
|
277
|
+
colorScheme: {
|
|
278
|
+
type: Array,
|
|
279
|
+
required: false,
|
|
280
|
+
default: () => []
|
|
281
|
+
},
|
|
282
|
+
aspectRatio: {
|
|
283
|
+
type: String,
|
|
284
|
+
required: false,
|
|
285
|
+
default: undefined
|
|
286
|
+
},
|
|
287
|
+
id: {
|
|
288
|
+
type: String,
|
|
289
|
+
required: false
|
|
290
|
+
},
|
|
291
|
+
class: {
|
|
292
|
+
type: [
|
|
293
|
+
String,
|
|
294
|
+
Array,
|
|
295
|
+
Object
|
|
296
|
+
],
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
style: {
|
|
300
|
+
type: [
|
|
301
|
+
String,
|
|
302
|
+
Array,
|
|
303
|
+
Object,
|
|
304
|
+
Boolean,
|
|
305
|
+
null
|
|
306
|
+
],
|
|
307
|
+
required: false,
|
|
308
|
+
skipCheck: true
|
|
309
|
+
},
|
|
310
|
+
height: {
|
|
311
|
+
type: [Number, String],
|
|
312
|
+
required: false,
|
|
313
|
+
default: 400
|
|
314
|
+
},
|
|
315
|
+
maxHeight: {
|
|
316
|
+
type: [Number, String],
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
maxWidth: {
|
|
320
|
+
type: [Number, String],
|
|
321
|
+
required: false
|
|
322
|
+
},
|
|
323
|
+
minHeight: {
|
|
324
|
+
type: [Number, String],
|
|
325
|
+
required: false
|
|
326
|
+
},
|
|
327
|
+
minWidth: {
|
|
328
|
+
type: [Number, String],
|
|
329
|
+
required: false
|
|
330
|
+
},
|
|
331
|
+
width: {
|
|
332
|
+
type: [Number, String],
|
|
333
|
+
required: false
|
|
334
|
+
},
|
|
335
|
+
margin: {
|
|
336
|
+
type: [
|
|
337
|
+
Boolean,
|
|
338
|
+
Number,
|
|
339
|
+
String
|
|
340
|
+
],
|
|
341
|
+
required: false
|
|
342
|
+
},
|
|
343
|
+
marginTop: {
|
|
344
|
+
type: [
|
|
345
|
+
Boolean,
|
|
346
|
+
Number,
|
|
347
|
+
String
|
|
348
|
+
],
|
|
349
|
+
required: false
|
|
350
|
+
},
|
|
351
|
+
marginLeft: {
|
|
352
|
+
type: [
|
|
353
|
+
Boolean,
|
|
354
|
+
Number,
|
|
355
|
+
String
|
|
356
|
+
],
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
marginBottom: {
|
|
360
|
+
type: [
|
|
361
|
+
Boolean,
|
|
362
|
+
Number,
|
|
363
|
+
String
|
|
364
|
+
],
|
|
365
|
+
required: false
|
|
366
|
+
},
|
|
367
|
+
marginRight: {
|
|
368
|
+
type: [
|
|
369
|
+
Boolean,
|
|
370
|
+
Number,
|
|
371
|
+
String
|
|
372
|
+
],
|
|
373
|
+
required: false
|
|
374
|
+
},
|
|
375
|
+
marginBlock: {
|
|
376
|
+
type: [
|
|
377
|
+
Boolean,
|
|
378
|
+
Number,
|
|
379
|
+
String
|
|
380
|
+
],
|
|
381
|
+
required: false
|
|
382
|
+
},
|
|
383
|
+
marginInline: {
|
|
384
|
+
type: [
|
|
385
|
+
Boolean,
|
|
386
|
+
Number,
|
|
387
|
+
String
|
|
388
|
+
],
|
|
389
|
+
required: false
|
|
390
|
+
},
|
|
391
|
+
marginInlineStart: {
|
|
392
|
+
type: [
|
|
393
|
+
Boolean,
|
|
394
|
+
Number,
|
|
395
|
+
String
|
|
396
|
+
],
|
|
397
|
+
required: false
|
|
398
|
+
},
|
|
399
|
+
marginInlineEnd: {
|
|
400
|
+
type: [
|
|
401
|
+
Boolean,
|
|
402
|
+
Number,
|
|
403
|
+
String
|
|
404
|
+
],
|
|
405
|
+
required: false
|
|
406
|
+
},
|
|
407
|
+
marginBlockStart: {
|
|
408
|
+
type: [
|
|
409
|
+
Boolean,
|
|
410
|
+
Number,
|
|
411
|
+
String
|
|
412
|
+
],
|
|
413
|
+
required: false
|
|
414
|
+
},
|
|
415
|
+
marginBlockEnd: {
|
|
416
|
+
type: [
|
|
417
|
+
Boolean,
|
|
418
|
+
Number,
|
|
419
|
+
String
|
|
420
|
+
],
|
|
421
|
+
required: false
|
|
422
|
+
},
|
|
423
|
+
padding: {
|
|
424
|
+
type: [
|
|
425
|
+
Boolean,
|
|
426
|
+
Number,
|
|
427
|
+
String
|
|
428
|
+
],
|
|
429
|
+
required: false
|
|
430
|
+
},
|
|
431
|
+
paddingTop: {
|
|
432
|
+
type: [
|
|
433
|
+
Boolean,
|
|
434
|
+
Number,
|
|
435
|
+
String
|
|
436
|
+
],
|
|
437
|
+
required: false
|
|
438
|
+
},
|
|
439
|
+
paddingLeft: {
|
|
440
|
+
type: [
|
|
441
|
+
Boolean,
|
|
442
|
+
Number,
|
|
443
|
+
String
|
|
444
|
+
],
|
|
445
|
+
required: false
|
|
446
|
+
},
|
|
447
|
+
paddingBottom: {
|
|
448
|
+
type: [
|
|
449
|
+
Boolean,
|
|
450
|
+
Number,
|
|
451
|
+
String
|
|
452
|
+
],
|
|
453
|
+
required: false
|
|
454
|
+
},
|
|
455
|
+
paddingRight: {
|
|
456
|
+
type: [
|
|
457
|
+
Boolean,
|
|
458
|
+
Number,
|
|
459
|
+
String
|
|
460
|
+
],
|
|
461
|
+
required: false
|
|
462
|
+
},
|
|
463
|
+
paddingBlock: {
|
|
464
|
+
type: [
|
|
465
|
+
Boolean,
|
|
466
|
+
Number,
|
|
467
|
+
String
|
|
468
|
+
],
|
|
469
|
+
required: false
|
|
470
|
+
},
|
|
471
|
+
paddingInline: {
|
|
472
|
+
type: [
|
|
473
|
+
Boolean,
|
|
474
|
+
Number,
|
|
475
|
+
String
|
|
476
|
+
],
|
|
477
|
+
required: false
|
|
478
|
+
},
|
|
479
|
+
paddingInlineStart: {
|
|
480
|
+
type: [
|
|
481
|
+
Boolean,
|
|
482
|
+
Number,
|
|
483
|
+
String
|
|
484
|
+
],
|
|
485
|
+
required: false
|
|
486
|
+
},
|
|
487
|
+
paddingInlineEnd: {
|
|
488
|
+
type: [
|
|
489
|
+
Boolean,
|
|
490
|
+
Number,
|
|
491
|
+
String
|
|
492
|
+
],
|
|
493
|
+
required: false
|
|
494
|
+
},
|
|
495
|
+
paddingBlockStart: {
|
|
496
|
+
type: [
|
|
497
|
+
Boolean,
|
|
498
|
+
Number,
|
|
499
|
+
String
|
|
500
|
+
],
|
|
501
|
+
required: false
|
|
502
|
+
},
|
|
503
|
+
paddingBlockEnd: {
|
|
504
|
+
type: [
|
|
505
|
+
Boolean,
|
|
506
|
+
Number,
|
|
507
|
+
String
|
|
508
|
+
],
|
|
509
|
+
required: false
|
|
510
|
+
},
|
|
511
|
+
rounded: {
|
|
512
|
+
type: [
|
|
513
|
+
Boolean,
|
|
514
|
+
Number,
|
|
515
|
+
String,
|
|
516
|
+
null
|
|
517
|
+
],
|
|
518
|
+
required: false,
|
|
519
|
+
skipCheck: true
|
|
520
|
+
},
|
|
521
|
+
roundedTopRight: {
|
|
522
|
+
type: [
|
|
523
|
+
Boolean,
|
|
524
|
+
Number,
|
|
525
|
+
String
|
|
526
|
+
],
|
|
527
|
+
required: false
|
|
528
|
+
},
|
|
529
|
+
roundedTopLeft: {
|
|
530
|
+
type: [
|
|
531
|
+
Boolean,
|
|
532
|
+
Number,
|
|
533
|
+
String
|
|
534
|
+
],
|
|
535
|
+
required: false
|
|
536
|
+
},
|
|
537
|
+
roundedBottomLeft: {
|
|
538
|
+
type: [
|
|
539
|
+
Boolean,
|
|
540
|
+
Number,
|
|
541
|
+
String
|
|
542
|
+
],
|
|
543
|
+
required: false
|
|
544
|
+
},
|
|
545
|
+
roundedBottomRight: {
|
|
546
|
+
type: [
|
|
547
|
+
Boolean,
|
|
548
|
+
Number,
|
|
549
|
+
String
|
|
550
|
+
],
|
|
551
|
+
required: false
|
|
552
|
+
},
|
|
553
|
+
roundedStartStart: {
|
|
554
|
+
type: [
|
|
555
|
+
Boolean,
|
|
556
|
+
Number,
|
|
557
|
+
String
|
|
558
|
+
],
|
|
559
|
+
required: false
|
|
560
|
+
},
|
|
561
|
+
roundedStartEnd: {
|
|
562
|
+
type: [
|
|
563
|
+
Boolean,
|
|
564
|
+
Number,
|
|
565
|
+
String
|
|
566
|
+
],
|
|
567
|
+
required: false
|
|
568
|
+
},
|
|
569
|
+
roundedEndStart: {
|
|
570
|
+
type: [
|
|
571
|
+
Boolean,
|
|
572
|
+
Number,
|
|
573
|
+
String
|
|
574
|
+
],
|
|
575
|
+
required: false
|
|
576
|
+
},
|
|
577
|
+
roundedEndEnd: {
|
|
578
|
+
type: [
|
|
579
|
+
Boolean,
|
|
580
|
+
Number,
|
|
581
|
+
String
|
|
582
|
+
],
|
|
583
|
+
required: false
|
|
584
|
+
},
|
|
585
|
+
elevation: {
|
|
586
|
+
type: [Number, String],
|
|
587
|
+
required: false
|
|
588
|
+
},
|
|
589
|
+
bgColor: {
|
|
590
|
+
type: [
|
|
591
|
+
String,
|
|
592
|
+
Object,
|
|
593
|
+
Boolean,
|
|
594
|
+
null
|
|
595
|
+
],
|
|
596
|
+
required: false,
|
|
597
|
+
skipCheck: true
|
|
598
|
+
},
|
|
599
|
+
fontSize: {
|
|
600
|
+
type: null,
|
|
601
|
+
required: false
|
|
602
|
+
},
|
|
603
|
+
fontWeight: {
|
|
604
|
+
type: null,
|
|
605
|
+
required: false
|
|
606
|
+
}
|
|
257
607
|
});
|
|
258
|
-
const emit = defineEmits([
|
|
608
|
+
const emit = defineEmits([
|
|
609
|
+
"point-click",
|
|
610
|
+
"legend-click",
|
|
611
|
+
"series-toggle"
|
|
612
|
+
]);
|
|
259
613
|
defineSlots();
|
|
260
614
|
const { t } = useLocale();
|
|
261
615
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -265,468 +619,560 @@ const { marginClasses, marginStyles } = useMargin(props);
|
|
|
265
619
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
266
620
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
267
621
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
622
|
+
/*********************************************************
|
|
623
|
+
* Props heritees sans effet ici (#426)
|
|
624
|
+
*
|
|
625
|
+
* @description
|
|
626
|
+
* ⛔ Ces props sont declarees par `IChartBaseProps` et n'ont aucun
|
|
627
|
+
* effet sur ce composant. Elles ne sont ni retirees ni cablees a un
|
|
628
|
+
* comportement fictif : elles avertissent une fois, en dev, avec la
|
|
629
|
+
* raison exacte. Meme traitement que `OrigamChartGauge`.
|
|
630
|
+
********************************************************/
|
|
631
|
+
useUnsupportedProp("OrigamChartSankey", "categories", "a sankey draws nodes and links — there is no category axis.", () => props.categories !== undefined);
|
|
274
632
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
633
|
+
/*********************************************************
|
|
634
|
+
* Static SVG box — always paints into 600 × 400 coordinate
|
|
635
|
+
* space; CSS scales it.
|
|
636
|
+
********************************************************/
|
|
275
637
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sankey);
|
|
276
638
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
277
|
-
const PADDING = {
|
|
639
|
+
const PADDING = {
|
|
640
|
+
top: 20,
|
|
641
|
+
right: 100,
|
|
642
|
+
bottom: 20,
|
|
643
|
+
left: 100
|
|
644
|
+
};
|
|
645
|
+
/*********************************************************
|
|
646
|
+
* Default colour palette — mirrors the pyramid family
|
|
647
|
+
********************************************************/
|
|
278
648
|
const DEFAULT_PALETTE = [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
649
|
+
"primary",
|
|
650
|
+
"success",
|
|
651
|
+
"warning",
|
|
652
|
+
"danger",
|
|
653
|
+
"info",
|
|
654
|
+
"secondary",
|
|
655
|
+
"ghost",
|
|
656
|
+
"neutral"
|
|
287
657
|
];
|
|
288
658
|
const resolveColor = (raw) => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
659
|
+
if (!raw) return "currentColor";
|
|
660
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
661
|
+
return raw;
|
|
662
|
+
}
|
|
663
|
+
if (isIntent(raw)) {
|
|
664
|
+
return intentBgExpr(raw, "default");
|
|
665
|
+
}
|
|
666
|
+
return "currentColor";
|
|
297
667
|
};
|
|
668
|
+
/*********************************************************
|
|
669
|
+
* Sankey layout engine
|
|
670
|
+
*
|
|
671
|
+
* Step 1 — parse data into node set + link set
|
|
672
|
+
* Step 2 — topological sort (Kahn) to assign column depths
|
|
673
|
+
* Step 3 — compute node values (max of in/out sums)
|
|
674
|
+
* Step 4 — vertical layout per column (proportional height)
|
|
675
|
+
* Step 5 — generate link paths (cubic Bezier)
|
|
676
|
+
********************************************************/
|
|
298
677
|
const formatValue = (v) => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
678
|
+
if (props.yAxisFormat) return props.yAxisFormat(v);
|
|
679
|
+
if (props.xAxisFormat) return String(props.xAxisFormat(v));
|
|
680
|
+
return String(v);
|
|
302
681
|
};
|
|
303
682
|
const colorForColumn = (columnIndex) => {
|
|
304
|
-
|
|
305
|
-
|
|
683
|
+
const scheme = props.colorScheme?.length ? props.colorScheme : DEFAULT_PALETTE;
|
|
684
|
+
return resolveColor(scheme[columnIndex % scheme.length]);
|
|
306
685
|
};
|
|
686
|
+
/*
|
|
687
|
+
* Kahn's topological sort — assigns each node the maximum
|
|
688
|
+
* column depth reachable from any source node.
|
|
689
|
+
* Returns an empty map on cycle detection (logs a warning).
|
|
690
|
+
*/
|
|
307
691
|
const topoColumns = (nodeNames, edges) => {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
692
|
+
const inDegree = new Map();
|
|
693
|
+
const adjacency = new Map();
|
|
694
|
+
for (const name of nodeNames) {
|
|
695
|
+
inDegree.set(name, 0);
|
|
696
|
+
adjacency.set(name, []);
|
|
697
|
+
}
|
|
698
|
+
for (const { from, to } of edges) {
|
|
699
|
+
adjacency.get(from)?.push(to);
|
|
700
|
+
inDegree.set(to, (inDegree.get(to) ?? 0) + 1);
|
|
701
|
+
}
|
|
702
|
+
const columns = new Map();
|
|
703
|
+
const queue = [];
|
|
704
|
+
for (const name of nodeNames) {
|
|
705
|
+
if (inDegree.get(name) === 0) {
|
|
706
|
+
queue.push(name);
|
|
707
|
+
columns.set(name, 0);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
let processed = 0;
|
|
711
|
+
while (queue.length > 0) {
|
|
712
|
+
const current = queue.shift();
|
|
713
|
+
processed++;
|
|
714
|
+
for (const neighbour of adjacency.get(current) ?? []) {
|
|
715
|
+
const nextCol = (columns.get(current) ?? 0) + 1;
|
|
716
|
+
if (!columns.has(neighbour) || (columns.get(neighbour) ?? 0) < nextCol) {
|
|
717
|
+
columns.set(neighbour, nextCol);
|
|
718
|
+
}
|
|
719
|
+
inDegree.set(neighbour, (inDegree.get(neighbour) ?? 1) - 1);
|
|
720
|
+
if (inDegree.get(neighbour) === 0) {
|
|
721
|
+
queue.push(neighbour);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (processed < nodeNames.length) {
|
|
726
|
+
console.warn("[origam] OrigamChartSankey: cycle detected in flow data — diagram may be incomplete.");
|
|
727
|
+
}
|
|
728
|
+
return columns;
|
|
345
729
|
};
|
|
346
730
|
const layoutNodes = computed(() => {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
731
|
+
const series = props.series?.[0];
|
|
732
|
+
if (!series?.data?.length) return [];
|
|
733
|
+
const data = series.data;
|
|
734
|
+
const nodeSet = new Set();
|
|
735
|
+
for (const d of data) {
|
|
736
|
+
nodeSet.add(d.from);
|
|
737
|
+
nodeSet.add(d.to);
|
|
738
|
+
}
|
|
739
|
+
const nodeNames = Array.from(nodeSet);
|
|
740
|
+
const edges = data.map(({ from, to }) => ({
|
|
741
|
+
from,
|
|
742
|
+
to
|
|
743
|
+
}));
|
|
744
|
+
const columns = topoColumns(nodeNames, edges);
|
|
745
|
+
const totalColumns = Math.max(...Array.from(columns.values())) + 1;
|
|
746
|
+
const incomingSum = new Map();
|
|
747
|
+
const outgoingSum = new Map();
|
|
748
|
+
for (const name of nodeNames) {
|
|
749
|
+
incomingSum.set(name, 0);
|
|
750
|
+
outgoingSum.set(name, 0);
|
|
751
|
+
}
|
|
752
|
+
for (const d of data) {
|
|
753
|
+
outgoingSum.set(d.from, (outgoingSum.get(d.from) ?? 0) + d.value);
|
|
754
|
+
incomingSum.set(d.to, (incomingSum.get(d.to) ?? 0) + d.value);
|
|
755
|
+
}
|
|
756
|
+
const nodeValues = new Map();
|
|
757
|
+
for (const name of nodeNames) {
|
|
758
|
+
nodeValues.set(name, Math.max(incomingSum.get(name) ?? 0, outgoingSum.get(name) ?? 0));
|
|
759
|
+
}
|
|
760
|
+
const plotLeft = PADDING.left;
|
|
761
|
+
const plotRight = svgWidth.value - PADDING.right;
|
|
762
|
+
const plotTop = PADDING.top;
|
|
763
|
+
const plotBottom = svgHeight.value - PADDING.bottom;
|
|
764
|
+
const plotWidth = plotRight - plotLeft;
|
|
765
|
+
const plotHeight = plotBottom - plotTop;
|
|
766
|
+
const colXStep = totalColumns > 1 ? (plotWidth - props.nodeWidth) / (totalColumns - 1) : 0;
|
|
767
|
+
const byColumn = new Map();
|
|
768
|
+
for (const [name, col] of columns.entries()) {
|
|
769
|
+
if (!byColumn.has(col)) byColumn.set(col, []);
|
|
770
|
+
byColumn.get(col).push(name);
|
|
771
|
+
}
|
|
772
|
+
/*
|
|
773
|
+
* Barycentric node ordering — sort each column so each node
|
|
774
|
+
* sits near the average position of its neighbours. Two
|
|
775
|
+
* sweeps (left-to-right then right-to-left, applied twice)
|
|
776
|
+
* are enough to minimise crossings on the typical 3-5
|
|
777
|
+
* column funnel without paying for a full LP solver.
|
|
778
|
+
*/
|
|
779
|
+
const orderIndex = new Map();
|
|
780
|
+
const sortedColumns = Array.from(byColumn.keys()).sort((a, b) => a - b);
|
|
781
|
+
for (const col of sortedColumns) {
|
|
782
|
+
const names = byColumn.get(col);
|
|
783
|
+
names.forEach((n, i) => orderIndex.set(n, i));
|
|
784
|
+
}
|
|
785
|
+
const predecessors = new Map();
|
|
786
|
+
const successors = new Map();
|
|
787
|
+
for (const name of nodeNames) {
|
|
788
|
+
predecessors.set(name, []);
|
|
789
|
+
successors.set(name, []);
|
|
790
|
+
}
|
|
791
|
+
for (const { from, to } of edges) {
|
|
792
|
+
successors.get(from).push(to);
|
|
793
|
+
predecessors.get(to).push(from);
|
|
794
|
+
}
|
|
795
|
+
const barycenter = (neighbours) => {
|
|
796
|
+
if (!neighbours.length) return Number.POSITIVE_INFINITY;
|
|
797
|
+
let sum = 0;
|
|
798
|
+
let count = 0;
|
|
799
|
+
for (const n of neighbours) {
|
|
800
|
+
const idx = orderIndex.get(n);
|
|
801
|
+
if (idx !== undefined) {
|
|
802
|
+
sum += idx;
|
|
803
|
+
count++;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return count ? sum / count : Number.POSITIVE_INFINITY;
|
|
807
|
+
};
|
|
808
|
+
const sweep = (direction) => {
|
|
809
|
+
const cols = direction === "down" ? sortedColumns : [...sortedColumns].reverse();
|
|
810
|
+
for (const col of cols) {
|
|
811
|
+
const names = byColumn.get(col);
|
|
812
|
+
if (names.length < 2) continue;
|
|
813
|
+
const neighbours = direction === "down" ? predecessors : successors;
|
|
814
|
+
names.sort((a, b) => barycenter(neighbours.get(a)) - barycenter(neighbours.get(b)));
|
|
815
|
+
names.forEach((n, i) => orderIndex.set(n, i));
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
819
|
+
sweep("down");
|
|
820
|
+
sweep("up");
|
|
821
|
+
}
|
|
822
|
+
const nodes = [];
|
|
823
|
+
for (const [col, names] of byColumn.entries()) {
|
|
824
|
+
const colTotal = names.reduce((sum, n) => sum + (nodeValues.get(n) ?? 0), 0);
|
|
825
|
+
const totalPadding = props.nodePadding * (names.length - 1);
|
|
826
|
+
const availableHeight = Math.max(plotHeight - totalPadding, 1);
|
|
827
|
+
let currentY = plotTop;
|
|
828
|
+
const xPos = plotLeft + col * colXStep;
|
|
829
|
+
for (const name of names) {
|
|
830
|
+
const val = nodeValues.get(name) ?? 0;
|
|
831
|
+
const nodeH = colTotal > 0 ? val / colTotal * availableHeight : availableHeight / names.length;
|
|
832
|
+
const colIndex = col;
|
|
833
|
+
nodes.push({
|
|
834
|
+
name,
|
|
835
|
+
column: colIndex,
|
|
836
|
+
value: val,
|
|
837
|
+
formatted: formatValue(val),
|
|
838
|
+
color: colorForColumn(colIndex),
|
|
839
|
+
x: xPos,
|
|
840
|
+
y: currentY,
|
|
841
|
+
height: Math.max(nodeH, 2),
|
|
842
|
+
outgoingOffset: 0,
|
|
843
|
+
incomingOffset: 0
|
|
844
|
+
});
|
|
845
|
+
currentY += nodeH + props.nodePadding;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return nodes;
|
|
455
849
|
});
|
|
456
850
|
const layoutLinks = computed(() => {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
851
|
+
const series = props.series?.[0];
|
|
852
|
+
if (!series?.data?.length) return [];
|
|
853
|
+
const data = series.data;
|
|
854
|
+
if (layoutNodes.value.length === 0) return [];
|
|
855
|
+
const nodeMap = new Map();
|
|
856
|
+
for (const node of layoutNodes.value) {
|
|
857
|
+
nodeMap.set(node.name, node);
|
|
858
|
+
}
|
|
859
|
+
const incomingSum = new Map();
|
|
860
|
+
const outgoingSum = new Map();
|
|
861
|
+
for (const name of nodeMap.keys()) {
|
|
862
|
+
incomingSum.set(name, 0);
|
|
863
|
+
outgoingSum.set(name, 0);
|
|
864
|
+
}
|
|
865
|
+
for (const d of data) {
|
|
866
|
+
outgoingSum.set(d.from, (outgoingSum.get(d.from) ?? 0) + d.value);
|
|
867
|
+
incomingSum.set(d.to, (incomingSum.get(d.to) ?? 0) + d.value);
|
|
868
|
+
}
|
|
869
|
+
/*
|
|
870
|
+
* Pre-compute per-link source / target band heights and
|
|
871
|
+
* sort the links so ribbons leave each source in target-Y
|
|
872
|
+
* order and arrive at each target in source-Y order. Without
|
|
873
|
+
* this sort, ribbons cross themselves on the same node and
|
|
874
|
+
* produce the swirl-from-hell visual.
|
|
875
|
+
*/
|
|
876
|
+
const specs = [];
|
|
877
|
+
for (let i = 0; i < data.length; i++) {
|
|
878
|
+
const d = data[i];
|
|
879
|
+
const sourceNode = nodeMap.get(d.from);
|
|
880
|
+
const targetNode = nodeMap.get(d.to);
|
|
881
|
+
if (!sourceNode || !targetNode) continue;
|
|
882
|
+
const srcOutTotal = outgoingSum.get(d.from) ?? 1;
|
|
883
|
+
const tgtInTotal = incomingSum.get(d.to) ?? 1;
|
|
884
|
+
const srcBandH = srcOutTotal > 0 ? d.value / srcOutTotal * sourceNode.height : 0;
|
|
885
|
+
const tgtBandH = tgtInTotal > 0 ? d.value / tgtInTotal * targetNode.height : 0;
|
|
886
|
+
const linkColor = d.color ? resolveColor(d.color) : sourceNode.color ?? "currentColor";
|
|
887
|
+
specs.push({
|
|
888
|
+
index: i,
|
|
889
|
+
from: d.from,
|
|
890
|
+
to: d.to,
|
|
891
|
+
value: d.value,
|
|
892
|
+
color: linkColor,
|
|
893
|
+
srcBandH,
|
|
894
|
+
tgtBandH,
|
|
895
|
+
srcY: sourceNode.y,
|
|
896
|
+
tgtY: targetNode.y
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
/*
|
|
900
|
+
* Assign source-side Y offsets: for each source node, sort
|
|
901
|
+
* its outgoing links by target Y ascending so the topmost
|
|
902
|
+
* link leaves the node from the top of its outgoing band.
|
|
903
|
+
* We store the band TOP (not its centre) — the ribbon is
|
|
904
|
+
* drawn as a filled path with explicit top + bottom edges,
|
|
905
|
+
* so we need the exact vertical extent.
|
|
906
|
+
*/
|
|
907
|
+
const srcOffsetMap = new Map();
|
|
908
|
+
const bySource = new Map();
|
|
909
|
+
for (const s of specs) {
|
|
910
|
+
if (!bySource.has(s.from)) bySource.set(s.from, []);
|
|
911
|
+
bySource.get(s.from).push(s);
|
|
912
|
+
}
|
|
913
|
+
for (const [from, group] of bySource.entries()) {
|
|
914
|
+
group.sort((a, b) => a.tgtY - b.tgtY);
|
|
915
|
+
const source = nodeMap.get(from);
|
|
916
|
+
let acc = source.y;
|
|
917
|
+
for (const link of group) {
|
|
918
|
+
srcOffsetMap.set(link.index, {
|
|
919
|
+
yTop: acc,
|
|
920
|
+
srcBandH: link.srcBandH
|
|
921
|
+
});
|
|
922
|
+
acc += link.srcBandH;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
/*
|
|
926
|
+
* Same on the receiving side. Incoming bands stack from
|
|
927
|
+
* the target's top edge, sorted by source Y so the topmost
|
|
928
|
+
* band on the target came from the topmost source.
|
|
929
|
+
*/
|
|
930
|
+
const tgtOffsetMap = new Map();
|
|
931
|
+
const byTarget = new Map();
|
|
932
|
+
for (const s of specs) {
|
|
933
|
+
if (!byTarget.has(s.to)) byTarget.set(s.to, []);
|
|
934
|
+
byTarget.get(s.to).push(s);
|
|
935
|
+
}
|
|
936
|
+
for (const [to, group] of byTarget.entries()) {
|
|
937
|
+
group.sort((a, b) => a.srcY - b.srcY);
|
|
938
|
+
const target = nodeMap.get(to);
|
|
939
|
+
let acc = target.y;
|
|
940
|
+
for (const link of group) {
|
|
941
|
+
tgtOffsetMap.set(link.index, {
|
|
942
|
+
yTop: acc,
|
|
943
|
+
tgtBandH: link.tgtBandH
|
|
944
|
+
});
|
|
945
|
+
acc += link.tgtBandH;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
/*
|
|
949
|
+
* Filled ribbon path — two Bezier curves (top + bottom)
|
|
950
|
+
* joined by short vertical segments at each node face.
|
|
951
|
+
* Each curve uses control points midway between source
|
|
952
|
+
* and target so the band hugs both ends. Drawing the
|
|
953
|
+
* ribbon as a fill instead of a stroke means the band's
|
|
954
|
+
* vertical extent matches the source / target band exactly
|
|
955
|
+
* — no spillover above / below the node bars.
|
|
956
|
+
*/
|
|
957
|
+
const links = [];
|
|
958
|
+
for (const s of specs) {
|
|
959
|
+
const srcOff = srcOffsetMap.get(s.index);
|
|
960
|
+
const tgtOff = tgtOffsetMap.get(s.index);
|
|
961
|
+
if (!srcOff || !tgtOff) continue;
|
|
962
|
+
const sourceNode = nodeMap.get(s.from);
|
|
963
|
+
const targetNode = nodeMap.get(s.to);
|
|
964
|
+
const x0 = sourceNode.x + props.nodeWidth;
|
|
965
|
+
const x1 = targetNode.x;
|
|
966
|
+
const y0Top = srcOff.yTop;
|
|
967
|
+
const y0Bot = srcOff.yTop + srcOff.srcBandH;
|
|
968
|
+
const y1Top = tgtOff.yTop;
|
|
969
|
+
const y1Bot = tgtOff.yTop + tgtOff.tgtBandH;
|
|
970
|
+
const cp = (x1 - x0) * .5;
|
|
971
|
+
const pathD = [
|
|
972
|
+
`M ${x0},${y0Top}`,
|
|
973
|
+
`C ${x0 + cp},${y0Top} ${x1 - cp},${y1Top} ${x1},${y1Top}`,
|
|
974
|
+
`L ${x1},${y1Bot}`,
|
|
975
|
+
`C ${x1 - cp},${y1Bot} ${x0 + cp},${y0Bot} ${x0},${y0Bot}`,
|
|
976
|
+
"Z"
|
|
977
|
+
].join(" ");
|
|
978
|
+
links.push({
|
|
979
|
+
index: s.index,
|
|
980
|
+
from: s.from,
|
|
981
|
+
to: s.to,
|
|
982
|
+
value: s.value,
|
|
983
|
+
formatted: formatValue(s.value),
|
|
984
|
+
d: pathD,
|
|
985
|
+
color: s.color,
|
|
986
|
+
strokeWidth: Math.max((s.srcBandH + s.tgtBandH) / 2, 1)
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
return links;
|
|
561
990
|
});
|
|
991
|
+
/*********************************************************
|
|
992
|
+
* Legend items — one per node (source nodes)
|
|
993
|
+
********************************************************/
|
|
562
994
|
const legendItems = computed(() => {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
995
|
+
const series = props.series?.[0];
|
|
996
|
+
if (!series) return [];
|
|
997
|
+
return layoutNodes.value.map((node, idx) => ({
|
|
998
|
+
series: {
|
|
999
|
+
...series,
|
|
1000
|
+
name: node.name,
|
|
1001
|
+
data: [node.value],
|
|
1002
|
+
visible: true
|
|
1003
|
+
},
|
|
1004
|
+
index: idx,
|
|
1005
|
+
color: node.color,
|
|
1006
|
+
visible: true
|
|
1007
|
+
}));
|
|
576
1008
|
});
|
|
1009
|
+
/*********************************************************
|
|
1010
|
+
* Node label positioning
|
|
1011
|
+
********************************************************/
|
|
577
1012
|
const numColumns = computed(() => {
|
|
578
|
-
|
|
579
|
-
|
|
1013
|
+
if (!layoutNodes.value.length) return 1;
|
|
1014
|
+
return Math.max(...layoutNodes.value.map((n) => n.column)) + 1;
|
|
580
1015
|
});
|
|
581
1016
|
const nodeLabelX = (node) => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
1017
|
+
if (node.column === 0) return node.x - 6;
|
|
1018
|
+
if (node.column === numColumns.value - 1) return node.x + props.nodeWidth + 6;
|
|
1019
|
+
return node.x + props.nodeWidth + 6;
|
|
585
1020
|
};
|
|
586
1021
|
const nodeLabelAnchor = (node) => {
|
|
587
|
-
|
|
588
|
-
|
|
1022
|
+
if (node.column === 0) return "end";
|
|
1023
|
+
return "start";
|
|
589
1024
|
};
|
|
590
|
-
|
|
1025
|
+
/*********************************************************
|
|
1026
|
+
* Hover / tooltip
|
|
1027
|
+
********************************************************/
|
|
1028
|
+
const mousePos = ref({
|
|
1029
|
+
x: 0,
|
|
1030
|
+
y: 0
|
|
1031
|
+
});
|
|
591
1032
|
const hoveredNodeName = ref(null);
|
|
592
1033
|
const hoveredLinkIndex = ref(null);
|
|
593
1034
|
const hoveredPoint = computed(() => {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
1035
|
+
if (hoveredNodeName.value !== null) {
|
|
1036
|
+
const node = layoutNodes.value.find((n) => n.name === hoveredNodeName.value);
|
|
1037
|
+
if (!node || !props.series?.[0]) return null;
|
|
1038
|
+
return {
|
|
1039
|
+
seriesIndex: 0,
|
|
1040
|
+
seriesName: props.series[0].name,
|
|
1041
|
+
dataIndex: 0,
|
|
1042
|
+
x: node.name,
|
|
1043
|
+
y: node.value,
|
|
1044
|
+
color: node.color
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
if (hoveredLinkIndex.value !== null) {
|
|
1048
|
+
const link = layoutLinks.value.find((l) => l.index === hoveredLinkIndex.value);
|
|
1049
|
+
if (!link || !props.series?.[0]) return null;
|
|
1050
|
+
return {
|
|
1051
|
+
seriesIndex: 0,
|
|
1052
|
+
seriesName: `${link.from} → ${link.to}`,
|
|
1053
|
+
dataIndex: link.index,
|
|
1054
|
+
x: `${link.from} → ${link.to}`,
|
|
1055
|
+
y: link.value,
|
|
1056
|
+
color: link.color
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
return null;
|
|
619
1060
|
});
|
|
620
1061
|
const hoveredSeries = computed(() => {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
1062
|
+
if ((hoveredNodeName.value !== null || hoveredLinkIndex.value !== null) && props.series?.[0]) {
|
|
1063
|
+
return props.series[0];
|
|
1064
|
+
}
|
|
1065
|
+
return null;
|
|
625
1066
|
});
|
|
626
1067
|
const hoveredCategory = computed(() => {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1068
|
+
if (hoveredNodeName.value !== null) return hoveredNodeName.value;
|
|
1069
|
+
if (hoveredLinkIndex.value !== null) {
|
|
1070
|
+
const link = layoutLinks.value.find((l) => l.index === hoveredLinkIndex.value);
|
|
1071
|
+
return link ? `${link.from} → ${link.to}` : "";
|
|
1072
|
+
}
|
|
1073
|
+
return "";
|
|
633
1074
|
});
|
|
634
1075
|
const showEmpty = computed(() => {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
1076
|
+
if (!props.series?.length) return true;
|
|
1077
|
+
const first = props.series[0];
|
|
1078
|
+
if (!first?.data?.length) return true;
|
|
1079
|
+
return layoutNodes.value.length === 0;
|
|
639
1080
|
});
|
|
1081
|
+
/*********************************************************
|
|
1082
|
+
* Root classes / styles
|
|
1083
|
+
********************************************************/
|
|
640
1084
|
const rootClasses = computed(() => [
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
1085
|
+
{
|
|
1086
|
+
[`origam-chart-sankey--legend-${props.legendPosition}`]: true,
|
|
1087
|
+
"origam-chart-sankey--no-animation": !props.animated
|
|
1088
|
+
},
|
|
1089
|
+
backgroundColorClasses.value,
|
|
1090
|
+
elevationClasses.value,
|
|
1091
|
+
marginClasses.value,
|
|
1092
|
+
paddingClasses.value,
|
|
1093
|
+
roundedClasses.value,
|
|
1094
|
+
props.class
|
|
651
1095
|
]);
|
|
652
1096
|
const rootStyles = computed(() => {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
1097
|
+
const out = {};
|
|
1098
|
+
if (props.aspectRatio) {
|
|
1099
|
+
out.aspectRatio = props.aspectRatio;
|
|
1100
|
+
}
|
|
1101
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
1102
|
+
return [out, props.style];
|
|
659
1103
|
});
|
|
660
|
-
const bodyClasses = computed(() => ({
|
|
661
|
-
|
|
662
|
-
}));
|
|
663
|
-
const svgClasses = computed(() => ({
|
|
664
|
-
"origam-chart__svg--animated": props.animated
|
|
665
|
-
}));
|
|
1104
|
+
const bodyClasses = computed(() => ({ "origam-chart-sankey__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
1105
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
666
1106
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
1107
|
+
/*********************************************************
|
|
1108
|
+
* ARIA
|
|
1109
|
+
********************************************************/
|
|
667
1110
|
const defaultAriaLabel = computed(() => t("origam.chart.sankey.aria_label"));
|
|
668
1111
|
const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
669
1112
|
const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
|
|
670
1113
|
const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
|
|
671
1114
|
const svgDesc = computed(() => t("origam.chart.sankey.desc", {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1115
|
+
chart: defaultAriaLabel.value,
|
|
1116
|
+
nodes: t("origam.chart.sankey.desc_nodes", layoutNodes.value.length),
|
|
1117
|
+
links: t("origam.chart.sankey.desc_links", layoutLinks.value.length)
|
|
675
1118
|
}));
|
|
676
1119
|
const linkAriaLabel = (link) => t("origam.chart.sankey.link_aria_label", link.from, link.to, link.formatted);
|
|
1120
|
+
/*********************************************************
|
|
1121
|
+
* Interaction
|
|
1122
|
+
********************************************************/
|
|
677
1123
|
const onNodeEnter = (node) => {
|
|
678
|
-
|
|
679
|
-
|
|
1124
|
+
hoveredNodeName.value = node.name;
|
|
1125
|
+
hoveredLinkIndex.value = null;
|
|
680
1126
|
};
|
|
681
1127
|
const onLinkEnter = (link) => {
|
|
682
|
-
|
|
683
|
-
|
|
1128
|
+
hoveredLinkIndex.value = link.index;
|
|
1129
|
+
hoveredNodeName.value = null;
|
|
684
1130
|
};
|
|
685
1131
|
const onHoverLeave = () => {
|
|
686
|
-
|
|
687
|
-
|
|
1132
|
+
hoveredNodeName.value = null;
|
|
1133
|
+
hoveredLinkIndex.value = null;
|
|
688
1134
|
};
|
|
689
1135
|
const onSvgMouseMove = (event) => {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
1136
|
+
const target = svgRef.value;
|
|
1137
|
+
if (!target) return;
|
|
1138
|
+
const rect = target.getBoundingClientRect();
|
|
1139
|
+
mousePos.value = {
|
|
1140
|
+
x: event.clientX - rect.left,
|
|
1141
|
+
y: event.clientY - rect.top
|
|
1142
|
+
};
|
|
697
1143
|
};
|
|
698
1144
|
const onSvgMouseLeave = () => {
|
|
699
|
-
|
|
1145
|
+
onHoverLeave();
|
|
700
1146
|
};
|
|
701
1147
|
const onNodeActivate = (node, event) => {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1148
|
+
hoveredNodeName.value = node.name;
|
|
1149
|
+
const point = {
|
|
1150
|
+
seriesIndex: 0,
|
|
1151
|
+
seriesName: props.series?.[0]?.name ?? "",
|
|
1152
|
+
dataIndex: 0,
|
|
1153
|
+
x: node.name,
|
|
1154
|
+
y: node.value,
|
|
1155
|
+
color: node.color
|
|
1156
|
+
};
|
|
1157
|
+
emit("point-click", point, event);
|
|
712
1158
|
};
|
|
713
1159
|
const onLinkActivate = (link, event) => {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1160
|
+
hoveredLinkIndex.value = link.index;
|
|
1161
|
+
const point = {
|
|
1162
|
+
seriesIndex: 0,
|
|
1163
|
+
seriesName: `${link.from} → ${link.to}`,
|
|
1164
|
+
dataIndex: link.index,
|
|
1165
|
+
x: `${link.from} → ${link.to}`,
|
|
1166
|
+
y: link.value,
|
|
1167
|
+
color: link.color
|
|
1168
|
+
};
|
|
1169
|
+
emit("point-click", point, event);
|
|
724
1170
|
};
|
|
725
1171
|
const onLegendClick = (series, index) => {
|
|
726
|
-
|
|
1172
|
+
emit("legend-click", series, index);
|
|
727
1173
|
};
|
|
728
1174
|
const onSeriesToggle = (series, nextVisible) => {
|
|
729
|
-
|
|
1175
|
+
emit("series-toggle", series, nextVisible);
|
|
730
1176
|
};
|
|
731
1177
|
</script>
|
|
732
1178
|
|