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
|
@@ -217,10 +217,7 @@
|
|
|
217
217
|
|
|
218
218
|
<script lang="ts" setup>
|
|
219
219
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
220
|
-
import {
|
|
221
|
-
computed,
|
|
222
|
-
ref
|
|
223
|
-
} from "vue";
|
|
220
|
+
import { computed, ref } from "vue";
|
|
224
221
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
225
222
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
226
223
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
@@ -237,75 +234,449 @@ import { usePadding } from "../../composables/Commons/padding.composable";
|
|
|
237
234
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
238
235
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
239
236
|
import { DIRECTION } from "../../enums/Commons/direction.enum";
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
/*********************************************************
|
|
238
|
+
* Global
|
|
239
|
+
*
|
|
240
|
+
* @description
|
|
241
|
+
* Bullet chart (Stephen Few) — compact KPI display.
|
|
242
|
+
*
|
|
243
|
+
* Each series entry renders one bullet: qualitative range
|
|
244
|
+
* bands (poor / acceptable / good) as the background,
|
|
245
|
+
* an actual-value bar overlaid on top, and a thin target
|
|
246
|
+
* marker tick for the comparative measure.
|
|
247
|
+
*
|
|
248
|
+
* Supports `orientation='horizontal'` (default, label left,
|
|
249
|
+
* bar right) and `orientation='vertical'` (label bottom,
|
|
250
|
+
* bar upward).
|
|
251
|
+
*
|
|
252
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
253
|
+
********************************************************/
|
|
254
|
+
defineOptions({ name: "OrigamChartBullet" });
|
|
243
255
|
const props = defineProps({
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
256
|
+
categories: {
|
|
257
|
+
type: Array,
|
|
258
|
+
required: false,
|
|
259
|
+
default: () => []
|
|
260
|
+
},
|
|
261
|
+
barColor: {
|
|
262
|
+
type: null,
|
|
263
|
+
required: false,
|
|
264
|
+
default: "primary"
|
|
265
|
+
},
|
|
266
|
+
targetColor: {
|
|
267
|
+
type: null,
|
|
268
|
+
required: false,
|
|
269
|
+
default: "danger"
|
|
270
|
+
},
|
|
271
|
+
rangeColors: {
|
|
272
|
+
type: Array,
|
|
273
|
+
required: false,
|
|
274
|
+
default: () => [
|
|
275
|
+
"danger",
|
|
276
|
+
"warning",
|
|
277
|
+
"success"
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
orientation: {
|
|
281
|
+
type: null,
|
|
282
|
+
required: false,
|
|
283
|
+
default: "horizontal"
|
|
284
|
+
},
|
|
285
|
+
barThickness: {
|
|
286
|
+
type: Number,
|
|
287
|
+
required: false,
|
|
288
|
+
default: .45
|
|
289
|
+
},
|
|
290
|
+
showAxis: {
|
|
291
|
+
type: Boolean,
|
|
292
|
+
required: false,
|
|
293
|
+
default: true
|
|
294
|
+
},
|
|
295
|
+
xAxisFormat: {
|
|
296
|
+
type: Function,
|
|
297
|
+
required: false,
|
|
298
|
+
default: undefined
|
|
299
|
+
},
|
|
300
|
+
yAxisFormat: {
|
|
301
|
+
type: Function,
|
|
302
|
+
required: false,
|
|
303
|
+
default: undefined
|
|
304
|
+
},
|
|
305
|
+
series: {
|
|
306
|
+
type: Array,
|
|
307
|
+
required: true
|
|
308
|
+
},
|
|
309
|
+
title: {
|
|
310
|
+
type: String,
|
|
311
|
+
required: false,
|
|
312
|
+
default: undefined
|
|
313
|
+
},
|
|
314
|
+
subtitle: {
|
|
315
|
+
type: String,
|
|
316
|
+
required: false,
|
|
317
|
+
default: undefined
|
|
318
|
+
},
|
|
319
|
+
showLegend: {
|
|
320
|
+
type: Boolean,
|
|
321
|
+
required: false,
|
|
322
|
+
default: false
|
|
323
|
+
},
|
|
324
|
+
legendPosition: {
|
|
325
|
+
type: null,
|
|
326
|
+
required: false,
|
|
327
|
+
default: "bottom"
|
|
328
|
+
},
|
|
329
|
+
showTooltip: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
required: false,
|
|
332
|
+
default: true
|
|
333
|
+
},
|
|
334
|
+
animated: {
|
|
335
|
+
type: Boolean,
|
|
336
|
+
required: false,
|
|
337
|
+
default: true
|
|
338
|
+
},
|
|
339
|
+
animationDuration: {
|
|
340
|
+
type: Number,
|
|
341
|
+
required: false,
|
|
342
|
+
default: 600
|
|
343
|
+
},
|
|
344
|
+
colorScheme: {
|
|
345
|
+
type: Array,
|
|
346
|
+
required: false,
|
|
347
|
+
default: () => []
|
|
348
|
+
},
|
|
349
|
+
aspectRatio: {
|
|
350
|
+
type: String,
|
|
351
|
+
required: false,
|
|
352
|
+
default: undefined
|
|
353
|
+
},
|
|
354
|
+
id: {
|
|
355
|
+
type: String,
|
|
356
|
+
required: false
|
|
357
|
+
},
|
|
358
|
+
class: {
|
|
359
|
+
type: [
|
|
360
|
+
String,
|
|
361
|
+
Array,
|
|
362
|
+
Object
|
|
363
|
+
],
|
|
364
|
+
required: false
|
|
365
|
+
},
|
|
366
|
+
style: {
|
|
367
|
+
type: [
|
|
368
|
+
String,
|
|
369
|
+
Array,
|
|
370
|
+
Object,
|
|
371
|
+
Boolean,
|
|
372
|
+
null
|
|
373
|
+
],
|
|
374
|
+
required: false,
|
|
375
|
+
skipCheck: true
|
|
376
|
+
},
|
|
377
|
+
height: {
|
|
378
|
+
type: [Number, String],
|
|
379
|
+
required: false,
|
|
380
|
+
default: 280
|
|
381
|
+
},
|
|
382
|
+
maxHeight: {
|
|
383
|
+
type: [Number, String],
|
|
384
|
+
required: false
|
|
385
|
+
},
|
|
386
|
+
maxWidth: {
|
|
387
|
+
type: [Number, String],
|
|
388
|
+
required: false
|
|
389
|
+
},
|
|
390
|
+
minHeight: {
|
|
391
|
+
type: [Number, String],
|
|
392
|
+
required: false
|
|
393
|
+
},
|
|
394
|
+
minWidth: {
|
|
395
|
+
type: [Number, String],
|
|
396
|
+
required: false
|
|
397
|
+
},
|
|
398
|
+
width: {
|
|
399
|
+
type: [Number, String],
|
|
400
|
+
required: false
|
|
401
|
+
},
|
|
402
|
+
margin: {
|
|
403
|
+
type: [
|
|
404
|
+
Boolean,
|
|
405
|
+
Number,
|
|
406
|
+
String
|
|
407
|
+
],
|
|
408
|
+
required: false
|
|
409
|
+
},
|
|
410
|
+
marginTop: {
|
|
411
|
+
type: [
|
|
412
|
+
Boolean,
|
|
413
|
+
Number,
|
|
414
|
+
String
|
|
415
|
+
],
|
|
416
|
+
required: false
|
|
417
|
+
},
|
|
418
|
+
marginLeft: {
|
|
419
|
+
type: [
|
|
420
|
+
Boolean,
|
|
421
|
+
Number,
|
|
422
|
+
String
|
|
423
|
+
],
|
|
424
|
+
required: false
|
|
425
|
+
},
|
|
426
|
+
marginBottom: {
|
|
427
|
+
type: [
|
|
428
|
+
Boolean,
|
|
429
|
+
Number,
|
|
430
|
+
String
|
|
431
|
+
],
|
|
432
|
+
required: false
|
|
433
|
+
},
|
|
434
|
+
marginRight: {
|
|
435
|
+
type: [
|
|
436
|
+
Boolean,
|
|
437
|
+
Number,
|
|
438
|
+
String
|
|
439
|
+
],
|
|
440
|
+
required: false
|
|
441
|
+
},
|
|
442
|
+
marginBlock: {
|
|
443
|
+
type: [
|
|
444
|
+
Boolean,
|
|
445
|
+
Number,
|
|
446
|
+
String
|
|
447
|
+
],
|
|
448
|
+
required: false
|
|
449
|
+
},
|
|
450
|
+
marginInline: {
|
|
451
|
+
type: [
|
|
452
|
+
Boolean,
|
|
453
|
+
Number,
|
|
454
|
+
String
|
|
455
|
+
],
|
|
456
|
+
required: false
|
|
457
|
+
},
|
|
458
|
+
marginInlineStart: {
|
|
459
|
+
type: [
|
|
460
|
+
Boolean,
|
|
461
|
+
Number,
|
|
462
|
+
String
|
|
463
|
+
],
|
|
464
|
+
required: false
|
|
465
|
+
},
|
|
466
|
+
marginInlineEnd: {
|
|
467
|
+
type: [
|
|
468
|
+
Boolean,
|
|
469
|
+
Number,
|
|
470
|
+
String
|
|
471
|
+
],
|
|
472
|
+
required: false
|
|
473
|
+
},
|
|
474
|
+
marginBlockStart: {
|
|
475
|
+
type: [
|
|
476
|
+
Boolean,
|
|
477
|
+
Number,
|
|
478
|
+
String
|
|
479
|
+
],
|
|
480
|
+
required: false
|
|
481
|
+
},
|
|
482
|
+
marginBlockEnd: {
|
|
483
|
+
type: [
|
|
484
|
+
Boolean,
|
|
485
|
+
Number,
|
|
486
|
+
String
|
|
487
|
+
],
|
|
488
|
+
required: false
|
|
489
|
+
},
|
|
490
|
+
padding: {
|
|
491
|
+
type: [
|
|
492
|
+
Boolean,
|
|
493
|
+
Number,
|
|
494
|
+
String
|
|
495
|
+
],
|
|
496
|
+
required: false
|
|
497
|
+
},
|
|
498
|
+
paddingTop: {
|
|
499
|
+
type: [
|
|
500
|
+
Boolean,
|
|
501
|
+
Number,
|
|
502
|
+
String
|
|
503
|
+
],
|
|
504
|
+
required: false
|
|
505
|
+
},
|
|
506
|
+
paddingLeft: {
|
|
507
|
+
type: [
|
|
508
|
+
Boolean,
|
|
509
|
+
Number,
|
|
510
|
+
String
|
|
511
|
+
],
|
|
512
|
+
required: false
|
|
513
|
+
},
|
|
514
|
+
paddingBottom: {
|
|
515
|
+
type: [
|
|
516
|
+
Boolean,
|
|
517
|
+
Number,
|
|
518
|
+
String
|
|
519
|
+
],
|
|
520
|
+
required: false
|
|
521
|
+
},
|
|
522
|
+
paddingRight: {
|
|
523
|
+
type: [
|
|
524
|
+
Boolean,
|
|
525
|
+
Number,
|
|
526
|
+
String
|
|
527
|
+
],
|
|
528
|
+
required: false
|
|
529
|
+
},
|
|
530
|
+
paddingBlock: {
|
|
531
|
+
type: [
|
|
532
|
+
Boolean,
|
|
533
|
+
Number,
|
|
534
|
+
String
|
|
535
|
+
],
|
|
536
|
+
required: false
|
|
537
|
+
},
|
|
538
|
+
paddingInline: {
|
|
539
|
+
type: [
|
|
540
|
+
Boolean,
|
|
541
|
+
Number,
|
|
542
|
+
String
|
|
543
|
+
],
|
|
544
|
+
required: false
|
|
545
|
+
},
|
|
546
|
+
paddingInlineStart: {
|
|
547
|
+
type: [
|
|
548
|
+
Boolean,
|
|
549
|
+
Number,
|
|
550
|
+
String
|
|
551
|
+
],
|
|
552
|
+
required: false
|
|
553
|
+
},
|
|
554
|
+
paddingInlineEnd: {
|
|
555
|
+
type: [
|
|
556
|
+
Boolean,
|
|
557
|
+
Number,
|
|
558
|
+
String
|
|
559
|
+
],
|
|
560
|
+
required: false
|
|
561
|
+
},
|
|
562
|
+
paddingBlockStart: {
|
|
563
|
+
type: [
|
|
564
|
+
Boolean,
|
|
565
|
+
Number,
|
|
566
|
+
String
|
|
567
|
+
],
|
|
568
|
+
required: false
|
|
569
|
+
},
|
|
570
|
+
paddingBlockEnd: {
|
|
571
|
+
type: [
|
|
572
|
+
Boolean,
|
|
573
|
+
Number,
|
|
574
|
+
String
|
|
575
|
+
],
|
|
576
|
+
required: false
|
|
577
|
+
},
|
|
578
|
+
rounded: {
|
|
579
|
+
type: [
|
|
580
|
+
Boolean,
|
|
581
|
+
Number,
|
|
582
|
+
String,
|
|
583
|
+
null
|
|
584
|
+
],
|
|
585
|
+
required: false,
|
|
586
|
+
skipCheck: true
|
|
587
|
+
},
|
|
588
|
+
roundedTopRight: {
|
|
589
|
+
type: [
|
|
590
|
+
Boolean,
|
|
591
|
+
Number,
|
|
592
|
+
String
|
|
593
|
+
],
|
|
594
|
+
required: false
|
|
595
|
+
},
|
|
596
|
+
roundedTopLeft: {
|
|
597
|
+
type: [
|
|
598
|
+
Boolean,
|
|
599
|
+
Number,
|
|
600
|
+
String
|
|
601
|
+
],
|
|
602
|
+
required: false
|
|
603
|
+
},
|
|
604
|
+
roundedBottomLeft: {
|
|
605
|
+
type: [
|
|
606
|
+
Boolean,
|
|
607
|
+
Number,
|
|
608
|
+
String
|
|
609
|
+
],
|
|
610
|
+
required: false
|
|
611
|
+
},
|
|
612
|
+
roundedBottomRight: {
|
|
613
|
+
type: [
|
|
614
|
+
Boolean,
|
|
615
|
+
Number,
|
|
616
|
+
String
|
|
617
|
+
],
|
|
618
|
+
required: false
|
|
619
|
+
},
|
|
620
|
+
roundedStartStart: {
|
|
621
|
+
type: [
|
|
622
|
+
Boolean,
|
|
623
|
+
Number,
|
|
624
|
+
String
|
|
625
|
+
],
|
|
626
|
+
required: false
|
|
627
|
+
},
|
|
628
|
+
roundedStartEnd: {
|
|
629
|
+
type: [
|
|
630
|
+
Boolean,
|
|
631
|
+
Number,
|
|
632
|
+
String
|
|
633
|
+
],
|
|
634
|
+
required: false
|
|
635
|
+
},
|
|
636
|
+
roundedEndStart: {
|
|
637
|
+
type: [
|
|
638
|
+
Boolean,
|
|
639
|
+
Number,
|
|
640
|
+
String
|
|
641
|
+
],
|
|
642
|
+
required: false
|
|
643
|
+
},
|
|
644
|
+
roundedEndEnd: {
|
|
645
|
+
type: [
|
|
646
|
+
Boolean,
|
|
647
|
+
Number,
|
|
648
|
+
String
|
|
649
|
+
],
|
|
650
|
+
required: false
|
|
651
|
+
},
|
|
652
|
+
elevation: {
|
|
653
|
+
type: [Number, String],
|
|
654
|
+
required: false
|
|
655
|
+
},
|
|
656
|
+
bgColor: {
|
|
657
|
+
type: [
|
|
658
|
+
String,
|
|
659
|
+
Object,
|
|
660
|
+
Boolean,
|
|
661
|
+
null
|
|
662
|
+
],
|
|
663
|
+
required: false,
|
|
664
|
+
skipCheck: true
|
|
665
|
+
},
|
|
666
|
+
fontSize: {
|
|
667
|
+
type: null,
|
|
668
|
+
required: false
|
|
669
|
+
},
|
|
670
|
+
fontWeight: {
|
|
671
|
+
type: null,
|
|
672
|
+
required: false
|
|
673
|
+
}
|
|
307
674
|
});
|
|
308
|
-
const emit = defineEmits([
|
|
675
|
+
const emit = defineEmits([
|
|
676
|
+
"point-click",
|
|
677
|
+
"legend-click",
|
|
678
|
+
"series-toggle"
|
|
679
|
+
]);
|
|
309
680
|
defineSlots();
|
|
310
681
|
const { t } = useLocale();
|
|
311
682
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -316,302 +687,346 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
316
687
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
317
688
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
318
689
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
690
|
+
/*********************************************************
|
|
691
|
+
* Static SVG coordinate space — CSS scales to fit.
|
|
692
|
+
********************************************************/
|
|
319
693
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.bullet);
|
|
320
694
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
321
695
|
const AXIS_TICK_COUNT = 5;
|
|
322
|
-
const TARGET_TICK_FRACTION =
|
|
696
|
+
const TARGET_TICK_FRACTION = .7;
|
|
323
697
|
const LABEL_GAP = 6;
|
|
324
698
|
const isHorizontal = computed(() => props.orientation !== DIRECTION.VERTICAL);
|
|
325
|
-
const PADDING = computed(
|
|
326
|
-
|
|
327
|
-
|
|
699
|
+
const PADDING = computed(() => isHorizontal.value ? {
|
|
700
|
+
top: 12,
|
|
701
|
+
right: 24,
|
|
702
|
+
bottom: 32,
|
|
703
|
+
left: 120
|
|
704
|
+
} : {
|
|
705
|
+
top: 24,
|
|
706
|
+
right: 24,
|
|
707
|
+
bottom: 48,
|
|
708
|
+
left: 40
|
|
709
|
+
});
|
|
328
710
|
const plotW = computed(() => svgWidth.value - PADDING.value.left - PADDING.value.right);
|
|
329
711
|
const plotH = computed(() => svgHeight.value - PADDING.value.top - PADDING.value.bottom);
|
|
712
|
+
/*********************************************************
|
|
713
|
+
* Colour resolution helpers
|
|
714
|
+
********************************************************/
|
|
330
715
|
const resolveColor = (raw) => {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
716
|
+
if (!raw) return "currentColor";
|
|
717
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
718
|
+
return raw;
|
|
719
|
+
}
|
|
720
|
+
if (isIntent(raw)) {
|
|
721
|
+
return intentBgExpr(raw, "default");
|
|
722
|
+
}
|
|
723
|
+
return "currentColor";
|
|
339
724
|
};
|
|
340
725
|
const resolveRangeColor = (raw, bandIndex) => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
726
|
+
if (raw) return resolveColor(raw);
|
|
727
|
+
const palette = props.rangeColors?.length ? props.rangeColors : [
|
|
728
|
+
"danger",
|
|
729
|
+
"warning",
|
|
730
|
+
"success"
|
|
731
|
+
];
|
|
732
|
+
return resolveColor(palette[bandIndex % palette.length]);
|
|
344
733
|
};
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
)
|
|
734
|
+
/*********************************************************
|
|
735
|
+
* useUnsupportedProp
|
|
736
|
+
*
|
|
737
|
+
* @description
|
|
738
|
+
* ⛔ #426 — `colorScheme` is inherited from `IChartBaseProps` but has no
|
|
739
|
+
* effect here: the value bar is a single UNIFORM fill (`barColor`) shared
|
|
740
|
+
* by every bullet, and the qualitative range bands use their own dedicated
|
|
741
|
+
* palette (`rangeColors`) — there is no per-series identity a rotating
|
|
742
|
+
* palette could drive. See #426 decision: neither wiring a fake behaviour
|
|
743
|
+
* nor removing the prop — warn instead.
|
|
744
|
+
********************************************************/
|
|
745
|
+
useUnsupportedProp("OrigamChartBullet", "colorScheme", "the value bar uses a single uniform fill (barColor) and range bands use their own palette (rangeColors) — there is no per-series identity for a rotating palette to drive.", () => !!props.colorScheme?.length);
|
|
746
|
+
/*********************************************************
|
|
747
|
+
* Bullet geometry
|
|
748
|
+
********************************************************/
|
|
351
749
|
const bulletCount = computed(() => props.series?.length ?? 0);
|
|
352
750
|
const bullets = computed(() => {
|
|
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
|
-
slotW,
|
|
401
|
-
slotH,
|
|
402
|
-
maxRange
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
return result;
|
|
751
|
+
if (!bulletCount.value) return [];
|
|
752
|
+
const pad = PADDING.value;
|
|
753
|
+
const count = bulletCount.value;
|
|
754
|
+
const result = [];
|
|
755
|
+
for (let i = 0; i < count; i++) {
|
|
756
|
+
const ser = props.series[i];
|
|
757
|
+
if (!ser) continue;
|
|
758
|
+
const rawDatum = ser.data?.[0];
|
|
759
|
+
if (!rawDatum || typeof rawDatum !== "object" || !("value" in rawDatum)) continue;
|
|
760
|
+
const datum = rawDatum;
|
|
761
|
+
if (!datum.ranges?.length) continue;
|
|
762
|
+
const maxRange = Math.max(datum.ranges.reduce((m, r) => Math.max(m, r.to), 0), datum.target, datum.value);
|
|
763
|
+
const cat = props.categories[i] ?? ser.name ?? `Bullet ${i + 1}`;
|
|
764
|
+
const barFill = resolveColor(props.barColor);
|
|
765
|
+
const targetStroke = resolveColor(props.targetColor);
|
|
766
|
+
const rangeFills = datum.ranges.map((r, ri) => resolveRangeColor(r.color, ri));
|
|
767
|
+
let slotX;
|
|
768
|
+
let slotY;
|
|
769
|
+
let slotW;
|
|
770
|
+
let slotH;
|
|
771
|
+
if (isHorizontal.value) {
|
|
772
|
+
slotW = plotW.value;
|
|
773
|
+
slotH = plotH.value / count;
|
|
774
|
+
slotX = pad.left;
|
|
775
|
+
slotY = pad.top + i * slotH;
|
|
776
|
+
} else {
|
|
777
|
+
slotW = plotW.value / count;
|
|
778
|
+
slotH = plotH.value;
|
|
779
|
+
slotX = pad.left + i * slotW;
|
|
780
|
+
slotY = pad.top;
|
|
781
|
+
}
|
|
782
|
+
result.push({
|
|
783
|
+
index: i,
|
|
784
|
+
category: cat,
|
|
785
|
+
datum,
|
|
786
|
+
visible: ser.visible !== false,
|
|
787
|
+
barFill,
|
|
788
|
+
targetStroke,
|
|
789
|
+
rangeFills,
|
|
790
|
+
slotX,
|
|
791
|
+
slotY,
|
|
792
|
+
slotW,
|
|
793
|
+
slotH,
|
|
794
|
+
maxRange
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
return result;
|
|
406
798
|
});
|
|
407
799
|
const visibleBullets = computed(() => bullets.value.filter((b) => b.visible));
|
|
800
|
+
/*********************************************************
|
|
801
|
+
* Geometry helpers — each returns an SVG attribute value.
|
|
802
|
+
* Horizontal: bars extend left→right from slotX.
|
|
803
|
+
* Vertical: bars extend bottom→top from slotY + slotH.
|
|
804
|
+
********************************************************/
|
|
408
805
|
const scaleX = (bullet, v) => {
|
|
409
|
-
|
|
410
|
-
|
|
806
|
+
if (bullet.maxRange <= 0) return 0;
|
|
807
|
+
return isHorizontal.value ? v / bullet.maxRange * bullet.slotW : v / bullet.maxRange * bullet.slotH;
|
|
411
808
|
};
|
|
412
809
|
const rangeX = (bullet, ri) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
810
|
+
if (!isHorizontal.value) return bullet.slotX + rangePad(bullet);
|
|
811
|
+
const bandFrom = ri === 0 ? 0 : bullet.datum.ranges[ri - 1].to;
|
|
812
|
+
return bullet.slotX + scaleX(bullet, bandFrom);
|
|
416
813
|
};
|
|
417
|
-
const rangePad = (bullet) => isHorizontal.value ? bullet.slotH *
|
|
814
|
+
const rangePad = (bullet) => isHorizontal.value ? bullet.slotH * .1 : bullet.slotW * .1;
|
|
418
815
|
const rangeY = (bullet, ri) => {
|
|
419
|
-
|
|
420
|
-
|
|
816
|
+
if (isHorizontal.value) return bullet.slotY + rangePad(bullet);
|
|
817
|
+
return bullet.slotY + bullet.slotH - scaleX(bullet, bullet.datum.ranges[ri].to);
|
|
421
818
|
};
|
|
422
819
|
const rangeW = (bullet, ri) => {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
820
|
+
if (!isHorizontal.value) return bullet.slotW - rangePad(bullet) * 2;
|
|
821
|
+
const bandFrom = ri === 0 ? 0 : bullet.datum.ranges[ri - 1].to;
|
|
822
|
+
const bandTo = bullet.datum.ranges[ri].to;
|
|
823
|
+
return Math.max(0, scaleX(bullet, bandTo) - scaleX(bullet, bandFrom));
|
|
427
824
|
};
|
|
428
825
|
const rangeH = (bullet, ri) => {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
826
|
+
if (isHorizontal.value) return bullet.slotH - rangePad(bullet) * 2;
|
|
827
|
+
const bandFrom = ri === 0 ? 0 : bullet.datum.ranges[ri - 1].to;
|
|
828
|
+
const bandTo = bullet.datum.ranges[ri].to;
|
|
829
|
+
return Math.max(0, scaleX(bullet, bandTo) - scaleX(bullet, bandFrom));
|
|
433
830
|
};
|
|
434
831
|
const barX = (bullet) => {
|
|
435
|
-
|
|
832
|
+
return isHorizontal.value ? bullet.slotX : bullet.slotX + bullet.slotW * (1 - props.barThickness) / 2;
|
|
436
833
|
};
|
|
437
834
|
const barY = (bullet) => {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
835
|
+
if (isHorizontal.value) {
|
|
836
|
+
const barThick = bullet.slotH * props.barThickness;
|
|
837
|
+
return bullet.slotY + (bullet.slotH - barThick) / 2;
|
|
838
|
+
}
|
|
839
|
+
return bullet.slotY + bullet.slotH - scaleX(bullet, bullet.datum.value);
|
|
443
840
|
};
|
|
444
841
|
const barW = (bullet) => {
|
|
445
|
-
|
|
842
|
+
return isHorizontal.value ? scaleX(bullet, bullet.datum.value) : bullet.slotW * props.barThickness;
|
|
446
843
|
};
|
|
447
844
|
const barH = (bullet) => {
|
|
448
|
-
|
|
845
|
+
return isHorizontal.value ? bullet.slotH * props.barThickness : scaleX(bullet, bullet.datum.value);
|
|
449
846
|
};
|
|
450
847
|
const targetX1 = (bullet) => {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
848
|
+
if (isHorizontal.value) return bullet.slotX + scaleX(bullet, bullet.datum.target);
|
|
849
|
+
const barThick = bullet.slotW * props.barThickness;
|
|
850
|
+
const center = bullet.slotX + bullet.slotW / 2;
|
|
851
|
+
return center - barThick * TARGET_TICK_FRACTION;
|
|
455
852
|
};
|
|
456
853
|
const targetY1 = (bullet) => {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
854
|
+
if (isHorizontal.value) {
|
|
855
|
+
const pad = bullet.slotH * (1 - TARGET_TICK_FRACTION) / 2;
|
|
856
|
+
return bullet.slotY + pad;
|
|
857
|
+
}
|
|
858
|
+
return bullet.slotY + bullet.slotH - scaleX(bullet, bullet.datum.target);
|
|
462
859
|
};
|
|
463
860
|
const targetX2 = (bullet) => {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
861
|
+
if (isHorizontal.value) return bullet.slotX + scaleX(bullet, bullet.datum.target);
|
|
862
|
+
const barThick = bullet.slotW * props.barThickness;
|
|
863
|
+
const center = bullet.slotX + bullet.slotW / 2;
|
|
864
|
+
return center + barThick * TARGET_TICK_FRACTION;
|
|
468
865
|
};
|
|
469
866
|
const targetY2 = (bullet) => {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
867
|
+
if (isHorizontal.value) {
|
|
868
|
+
const pad = bullet.slotH * (1 - TARGET_TICK_FRACTION) / 2;
|
|
869
|
+
return bullet.slotY + bullet.slotH - pad;
|
|
870
|
+
}
|
|
871
|
+
return bullet.slotY + bullet.slotH - scaleX(bullet, bullet.datum.target);
|
|
475
872
|
};
|
|
873
|
+
/*********************************************************
|
|
874
|
+
* Axis ticks
|
|
875
|
+
********************************************************/
|
|
476
876
|
const globalMax = computed(() => {
|
|
477
|
-
|
|
478
|
-
|
|
877
|
+
if (!visibleBullets.value.length) return 1;
|
|
878
|
+
return visibleBullets.value.reduce((m, b) => Math.max(m, b.maxRange), 0) || 1;
|
|
479
879
|
});
|
|
480
880
|
const axisTicks = computed(() => {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
881
|
+
const ticks = [];
|
|
882
|
+
const max = globalMax.value;
|
|
883
|
+
for (let i = 0; i <= AXIS_TICK_COUNT; i++) {
|
|
884
|
+
const v = i / AXIS_TICK_COUNT * max;
|
|
885
|
+
const label = props.xAxisFormat ? props.xAxisFormat(v) : props.yAxisFormat ? props.yAxisFormat(v) : String(Math.round(v * 10) / 10);
|
|
886
|
+
const pad = PADDING.value;
|
|
887
|
+
const x = isHorizontal.value ? pad.left + v / max * plotW.value : pad.left;
|
|
888
|
+
const y = isHorizontal.value ? pad.top + plotH.value + 8 : pad.top + plotH.value - v / max * plotH.value;
|
|
889
|
+
ticks.push({
|
|
890
|
+
value: v,
|
|
891
|
+
label,
|
|
892
|
+
x,
|
|
893
|
+
y
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
return ticks;
|
|
897
|
+
});
|
|
898
|
+
/*********************************************************
|
|
899
|
+
* Legend — one item per series / bullet
|
|
900
|
+
********************************************************/
|
|
901
|
+
const hiddenNames = ref(new Set());
|
|
902
|
+
const legendItems = computed(() => bullets.value.map((b) => ({
|
|
903
|
+
series: {
|
|
904
|
+
...props.series[b.index],
|
|
905
|
+
name: b.category,
|
|
906
|
+
visible: b.visible
|
|
907
|
+
},
|
|
908
|
+
index: b.index,
|
|
909
|
+
color: b.barFill,
|
|
910
|
+
visible: b.visible
|
|
911
|
+
})));
|
|
912
|
+
/*********************************************************
|
|
913
|
+
* Hover / tooltip
|
|
914
|
+
********************************************************/
|
|
915
|
+
const mousePos = ref({
|
|
916
|
+
x: 0,
|
|
917
|
+
y: 0
|
|
492
918
|
});
|
|
493
|
-
const hiddenNames = ref(/* @__PURE__ */ new Set());
|
|
494
|
-
const legendItems = computed(
|
|
495
|
-
() => bullets.value.map((b) => ({
|
|
496
|
-
series: {
|
|
497
|
-
...props.series[b.index],
|
|
498
|
-
name: b.category,
|
|
499
|
-
visible: b.visible
|
|
500
|
-
},
|
|
501
|
-
index: b.index,
|
|
502
|
-
color: b.barFill,
|
|
503
|
-
visible: b.visible
|
|
504
|
-
}))
|
|
505
|
-
);
|
|
506
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
507
919
|
const hoveredIndex = ref(null);
|
|
508
920
|
const hoveredBullet = computed(() => {
|
|
509
|
-
|
|
510
|
-
|
|
921
|
+
if (hoveredIndex.value === null) return null;
|
|
922
|
+
return visibleBullets.value.find((b) => b.index === hoveredIndex.value) ?? null;
|
|
511
923
|
});
|
|
512
924
|
const hoveredDelta = computed(() => {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
925
|
+
const b = hoveredBullet.value;
|
|
926
|
+
if (!b) return 0;
|
|
927
|
+
const target = b.datum.target;
|
|
928
|
+
if (!target) return 0;
|
|
929
|
+
return Math.round(b.datum.value / target * 100);
|
|
518
930
|
});
|
|
519
931
|
const hoveredPoint = computed(() => {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
932
|
+
const b = hoveredBullet.value;
|
|
933
|
+
if (!b) return null;
|
|
934
|
+
const ser = props.series[b.index];
|
|
935
|
+
if (!ser) return null;
|
|
936
|
+
return {
|
|
937
|
+
seriesIndex: b.index,
|
|
938
|
+
seriesName: ser.name,
|
|
939
|
+
dataIndex: 0,
|
|
940
|
+
x: b.category,
|
|
941
|
+
y: b.datum.value,
|
|
942
|
+
color: b.barFill
|
|
943
|
+
};
|
|
532
944
|
});
|
|
533
945
|
const hoveredSeries = computed(() => {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
946
|
+
const b = hoveredBullet.value;
|
|
947
|
+
if (!b) return null;
|
|
948
|
+
return props.series[b.index] ?? null;
|
|
537
949
|
});
|
|
538
|
-
const hoveredCategory = computed(
|
|
539
|
-
() => hoveredBullet.value?.category ?? ""
|
|
540
|
-
);
|
|
950
|
+
const hoveredCategory = computed(() => hoveredBullet.value?.category ?? "");
|
|
541
951
|
const showEmpty = computed(() => {
|
|
542
|
-
|
|
543
|
-
|
|
952
|
+
if (!props.series?.length) return true;
|
|
953
|
+
return visibleBullets.value.length === 0;
|
|
544
954
|
});
|
|
955
|
+
/*********************************************************
|
|
956
|
+
* Root classes / styles
|
|
957
|
+
********************************************************/
|
|
545
958
|
const rootClasses = computed(() => [
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
959
|
+
{
|
|
960
|
+
[`origam-chart-bullet--${props.orientation}`]: true,
|
|
961
|
+
[`origam-chart-bullet--legend-${props.legendPosition}`]: props.showLegend,
|
|
962
|
+
"origam-chart-bullet--no-animation": !props.animated
|
|
963
|
+
},
|
|
964
|
+
backgroundColorClasses.value,
|
|
965
|
+
elevationClasses.value,
|
|
966
|
+
marginClasses.value,
|
|
967
|
+
paddingClasses.value,
|
|
968
|
+
roundedClasses.value,
|
|
969
|
+
props.class
|
|
557
970
|
]);
|
|
558
971
|
const rootStyles = computed(() => {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
972
|
+
const out = {};
|
|
973
|
+
if (props.aspectRatio) {
|
|
974
|
+
out.aspectRatio = props.aspectRatio;
|
|
975
|
+
}
|
|
976
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
977
|
+
return [out, props.style];
|
|
565
978
|
});
|
|
566
|
-
const bodyClasses = computed(() => ({
|
|
567
|
-
|
|
568
|
-
}));
|
|
569
|
-
const svgClasses = computed(() => ({
|
|
570
|
-
"origam-chart__svg--animated": props.animated
|
|
571
|
-
}));
|
|
979
|
+
const bodyClasses = computed(() => ({ "origam-chart-bullet__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
980
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
572
981
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
982
|
+
/*********************************************************
|
|
983
|
+
* ARIA
|
|
984
|
+
********************************************************/
|
|
573
985
|
const ariaLabel = computed(() => props.title ?? t("origam.chart.bullet.aria_label"));
|
|
574
986
|
const svgAriaLabel = computed(() => props.title ?? t("origam.chart.bullet.aria_label"));
|
|
575
987
|
const svgTitle = computed(() => props.title ?? t("origam.chart.bullet.aria_label"));
|
|
576
988
|
const svgDesc = computed(() => {
|
|
577
|
-
|
|
578
|
-
|
|
989
|
+
const n = visibleBullets.value.length;
|
|
990
|
+
return t("origam.chart.bullet.desc", n);
|
|
579
991
|
});
|
|
580
992
|
const bulletAriaLabel = (bullet) => {
|
|
581
|
-
|
|
582
|
-
|
|
993
|
+
const pct = bullet.datum.target ? Math.round(bullet.datum.value / bullet.datum.target * 100) : 0;
|
|
994
|
+
return t("origam.chart.bullet.bullet_aria_label", bullet.category, bullet.datum.value, bullet.datum.target, pct);
|
|
583
995
|
};
|
|
996
|
+
/*********************************************************
|
|
997
|
+
* Interaction
|
|
998
|
+
********************************************************/
|
|
584
999
|
const onBulletEnter = (bullet) => {
|
|
585
|
-
|
|
1000
|
+
hoveredIndex.value = bullet.index;
|
|
586
1001
|
};
|
|
587
1002
|
const onBulletLeave = () => {
|
|
588
|
-
|
|
1003
|
+
hoveredIndex.value = null;
|
|
589
1004
|
};
|
|
590
1005
|
const onSvgMouseMove = (event) => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
1006
|
+
const target = svgRef.value;
|
|
1007
|
+
if (!target) return;
|
|
1008
|
+
const rect = target.getBoundingClientRect();
|
|
1009
|
+
mousePos.value = {
|
|
1010
|
+
x: event.clientX - rect.left,
|
|
1011
|
+
y: event.clientY - rect.top
|
|
1012
|
+
};
|
|
598
1013
|
};
|
|
599
1014
|
const onSvgMouseLeave = () => {
|
|
600
|
-
|
|
1015
|
+
onBulletLeave();
|
|
601
1016
|
};
|
|
602
1017
|
const onBulletActivate = (bullet, event) => {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
1018
|
+
hoveredIndex.value = bullet.index;
|
|
1019
|
+
if (hoveredPoint.value) {
|
|
1020
|
+
emit("point-click", hoveredPoint.value, event);
|
|
1021
|
+
}
|
|
607
1022
|
};
|
|
608
1023
|
const onLegendClick = (series, index) => {
|
|
609
|
-
|
|
1024
|
+
emit("legend-click", series, index);
|
|
610
1025
|
};
|
|
611
1026
|
const onSeriesToggle = (series, nextVisible) => {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
1027
|
+
if (nextVisible) hiddenNames.value.delete(series.name);
|
|
1028
|
+
else hiddenNames.value.add(series.name);
|
|
1029
|
+
emit("series-toggle", series, nextVisible);
|
|
615
1030
|
};
|
|
616
1031
|
</script>
|
|
617
1032
|
|