origam 2.38.1 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +6 -6
|
@@ -192,10 +192,7 @@
|
|
|
192
192
|
|
|
193
193
|
<script lang="ts" setup>
|
|
194
194
|
import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
|
|
195
|
-
import {
|
|
196
|
-
computed,
|
|
197
|
-
ref
|
|
198
|
-
} from "vue";
|
|
195
|
+
import { computed, ref } from "vue";
|
|
199
196
|
import OrigamChartLegend from "./OrigamChartLegend.vue";
|
|
200
197
|
import OrigamChartTooltip from "./OrigamChartTooltip.vue";
|
|
201
198
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
@@ -211,76 +208,449 @@ import { useMargin } from "../../composables/Commons/margin.composable";
|
|
|
211
208
|
import { usePadding } from "../../composables/Commons/padding.composable";
|
|
212
209
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
213
210
|
import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
/*********************************************************
|
|
212
|
+
* Global
|
|
213
|
+
*
|
|
214
|
+
* @description
|
|
215
|
+
* Financial OHLC candlestick chart. Renders one candle per datum:
|
|
216
|
+
* a rectangular body between open and close, plus a thin wick
|
|
217
|
+
* from low to high.
|
|
218
|
+
*
|
|
219
|
+
* - Bullish (close ≥ open): body filled with `bullishColor`
|
|
220
|
+
* - Bearish (close < open): body filled with `bearishColor`
|
|
221
|
+
*
|
|
222
|
+
* Y scale: auto from min(low)/max(high) + 5% padding, or
|
|
223
|
+
* overridden via `yMin`/`yMax` props.
|
|
224
|
+
*
|
|
225
|
+
* `withDefaults` literals only, per CLAUDE.md.
|
|
226
|
+
********************************************************/
|
|
227
|
+
defineOptions({ name: "OrigamChartCandlestick" });
|
|
217
228
|
const props = defineProps({
|
|
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
|
-
|
|
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
|
-
|
|
229
|
+
height: {
|
|
230
|
+
type: [Number, String],
|
|
231
|
+
required: false,
|
|
232
|
+
default: 400
|
|
233
|
+
},
|
|
234
|
+
bullishColor: {
|
|
235
|
+
type: null,
|
|
236
|
+
required: false,
|
|
237
|
+
default: "success"
|
|
238
|
+
},
|
|
239
|
+
bearishColor: {
|
|
240
|
+
type: null,
|
|
241
|
+
required: false,
|
|
242
|
+
default: "danger"
|
|
243
|
+
},
|
|
244
|
+
candleWidth: {
|
|
245
|
+
type: Number,
|
|
246
|
+
required: false,
|
|
247
|
+
default: .6
|
|
248
|
+
},
|
|
249
|
+
wickWidth: {
|
|
250
|
+
type: Number,
|
|
251
|
+
required: false,
|
|
252
|
+
default: 1
|
|
253
|
+
},
|
|
254
|
+
showLegend: {
|
|
255
|
+
type: Boolean,
|
|
256
|
+
required: false,
|
|
257
|
+
default: false
|
|
258
|
+
},
|
|
259
|
+
showTooltip: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
required: false,
|
|
262
|
+
default: true
|
|
263
|
+
},
|
|
264
|
+
showGrid: {
|
|
265
|
+
type: Boolean,
|
|
266
|
+
required: false,
|
|
267
|
+
default: true
|
|
268
|
+
},
|
|
269
|
+
showAxis: {
|
|
270
|
+
type: Boolean,
|
|
271
|
+
required: false,
|
|
272
|
+
default: true
|
|
273
|
+
},
|
|
274
|
+
yMin: {
|
|
275
|
+
type: Number,
|
|
276
|
+
required: false,
|
|
277
|
+
default: undefined
|
|
278
|
+
},
|
|
279
|
+
yMax: {
|
|
280
|
+
type: Number,
|
|
281
|
+
required: false,
|
|
282
|
+
default: undefined
|
|
283
|
+
},
|
|
284
|
+
xAxisFormat: {
|
|
285
|
+
type: Function,
|
|
286
|
+
required: false,
|
|
287
|
+
default: undefined
|
|
288
|
+
},
|
|
289
|
+
yAxisFormat: {
|
|
290
|
+
type: Function,
|
|
291
|
+
required: false,
|
|
292
|
+
default: undefined
|
|
293
|
+
},
|
|
294
|
+
series: {
|
|
295
|
+
type: Array,
|
|
296
|
+
required: true
|
|
297
|
+
},
|
|
298
|
+
title: {
|
|
299
|
+
type: String,
|
|
300
|
+
required: false,
|
|
301
|
+
default: undefined
|
|
302
|
+
},
|
|
303
|
+
subtitle: {
|
|
304
|
+
type: String,
|
|
305
|
+
required: false,
|
|
306
|
+
default: undefined
|
|
307
|
+
},
|
|
308
|
+
legendPosition: {
|
|
309
|
+
type: null,
|
|
310
|
+
required: false,
|
|
311
|
+
default: "bottom"
|
|
312
|
+
},
|
|
313
|
+
animated: {
|
|
314
|
+
type: Boolean,
|
|
315
|
+
required: false,
|
|
316
|
+
default: true
|
|
317
|
+
},
|
|
318
|
+
animationDuration: {
|
|
319
|
+
type: Number,
|
|
320
|
+
required: false,
|
|
321
|
+
default: 600
|
|
322
|
+
},
|
|
323
|
+
colorScheme: {
|
|
324
|
+
type: Array,
|
|
325
|
+
required: false,
|
|
326
|
+
default: () => []
|
|
327
|
+
},
|
|
328
|
+
aspectRatio: {
|
|
329
|
+
type: String,
|
|
330
|
+
required: false,
|
|
331
|
+
default: undefined
|
|
332
|
+
},
|
|
333
|
+
id: {
|
|
334
|
+
type: String,
|
|
335
|
+
required: false
|
|
336
|
+
},
|
|
337
|
+
class: {
|
|
338
|
+
type: [
|
|
339
|
+
String,
|
|
340
|
+
Array,
|
|
341
|
+
Object
|
|
342
|
+
],
|
|
343
|
+
required: false
|
|
344
|
+
},
|
|
345
|
+
style: {
|
|
346
|
+
type: [
|
|
347
|
+
String,
|
|
348
|
+
Array,
|
|
349
|
+
Object,
|
|
350
|
+
Boolean,
|
|
351
|
+
null
|
|
352
|
+
],
|
|
353
|
+
required: false,
|
|
354
|
+
skipCheck: true
|
|
355
|
+
},
|
|
356
|
+
maxHeight: {
|
|
357
|
+
type: [Number, String],
|
|
358
|
+
required: false
|
|
359
|
+
},
|
|
360
|
+
maxWidth: {
|
|
361
|
+
type: [Number, String],
|
|
362
|
+
required: false
|
|
363
|
+
},
|
|
364
|
+
minHeight: {
|
|
365
|
+
type: [Number, String],
|
|
366
|
+
required: false
|
|
367
|
+
},
|
|
368
|
+
minWidth: {
|
|
369
|
+
type: [Number, String],
|
|
370
|
+
required: false
|
|
371
|
+
},
|
|
372
|
+
width: {
|
|
373
|
+
type: [Number, String],
|
|
374
|
+
required: false
|
|
375
|
+
},
|
|
376
|
+
margin: {
|
|
377
|
+
type: [
|
|
378
|
+
Boolean,
|
|
379
|
+
Number,
|
|
380
|
+
String
|
|
381
|
+
],
|
|
382
|
+
required: false
|
|
383
|
+
},
|
|
384
|
+
marginTop: {
|
|
385
|
+
type: [
|
|
386
|
+
Boolean,
|
|
387
|
+
Number,
|
|
388
|
+
String
|
|
389
|
+
],
|
|
390
|
+
required: false
|
|
391
|
+
},
|
|
392
|
+
marginLeft: {
|
|
393
|
+
type: [
|
|
394
|
+
Boolean,
|
|
395
|
+
Number,
|
|
396
|
+
String
|
|
397
|
+
],
|
|
398
|
+
required: false
|
|
399
|
+
},
|
|
400
|
+
marginBottom: {
|
|
401
|
+
type: [
|
|
402
|
+
Boolean,
|
|
403
|
+
Number,
|
|
404
|
+
String
|
|
405
|
+
],
|
|
406
|
+
required: false
|
|
407
|
+
},
|
|
408
|
+
marginRight: {
|
|
409
|
+
type: [
|
|
410
|
+
Boolean,
|
|
411
|
+
Number,
|
|
412
|
+
String
|
|
413
|
+
],
|
|
414
|
+
required: false
|
|
415
|
+
},
|
|
416
|
+
marginBlock: {
|
|
417
|
+
type: [
|
|
418
|
+
Boolean,
|
|
419
|
+
Number,
|
|
420
|
+
String
|
|
421
|
+
],
|
|
422
|
+
required: false
|
|
423
|
+
},
|
|
424
|
+
marginInline: {
|
|
425
|
+
type: [
|
|
426
|
+
Boolean,
|
|
427
|
+
Number,
|
|
428
|
+
String
|
|
429
|
+
],
|
|
430
|
+
required: false
|
|
431
|
+
},
|
|
432
|
+
marginInlineStart: {
|
|
433
|
+
type: [
|
|
434
|
+
Boolean,
|
|
435
|
+
Number,
|
|
436
|
+
String
|
|
437
|
+
],
|
|
438
|
+
required: false
|
|
439
|
+
},
|
|
440
|
+
marginInlineEnd: {
|
|
441
|
+
type: [
|
|
442
|
+
Boolean,
|
|
443
|
+
Number,
|
|
444
|
+
String
|
|
445
|
+
],
|
|
446
|
+
required: false
|
|
447
|
+
},
|
|
448
|
+
marginBlockStart: {
|
|
449
|
+
type: [
|
|
450
|
+
Boolean,
|
|
451
|
+
Number,
|
|
452
|
+
String
|
|
453
|
+
],
|
|
454
|
+
required: false
|
|
455
|
+
},
|
|
456
|
+
marginBlockEnd: {
|
|
457
|
+
type: [
|
|
458
|
+
Boolean,
|
|
459
|
+
Number,
|
|
460
|
+
String
|
|
461
|
+
],
|
|
462
|
+
required: false
|
|
463
|
+
},
|
|
464
|
+
padding: {
|
|
465
|
+
type: [
|
|
466
|
+
Boolean,
|
|
467
|
+
Number,
|
|
468
|
+
String
|
|
469
|
+
],
|
|
470
|
+
required: false
|
|
471
|
+
},
|
|
472
|
+
paddingTop: {
|
|
473
|
+
type: [
|
|
474
|
+
Boolean,
|
|
475
|
+
Number,
|
|
476
|
+
String
|
|
477
|
+
],
|
|
478
|
+
required: false
|
|
479
|
+
},
|
|
480
|
+
paddingLeft: {
|
|
481
|
+
type: [
|
|
482
|
+
Boolean,
|
|
483
|
+
Number,
|
|
484
|
+
String
|
|
485
|
+
],
|
|
486
|
+
required: false
|
|
487
|
+
},
|
|
488
|
+
paddingBottom: {
|
|
489
|
+
type: [
|
|
490
|
+
Boolean,
|
|
491
|
+
Number,
|
|
492
|
+
String
|
|
493
|
+
],
|
|
494
|
+
required: false
|
|
495
|
+
},
|
|
496
|
+
paddingRight: {
|
|
497
|
+
type: [
|
|
498
|
+
Boolean,
|
|
499
|
+
Number,
|
|
500
|
+
String
|
|
501
|
+
],
|
|
502
|
+
required: false
|
|
503
|
+
},
|
|
504
|
+
paddingBlock: {
|
|
505
|
+
type: [
|
|
506
|
+
Boolean,
|
|
507
|
+
Number,
|
|
508
|
+
String
|
|
509
|
+
],
|
|
510
|
+
required: false
|
|
511
|
+
},
|
|
512
|
+
paddingInline: {
|
|
513
|
+
type: [
|
|
514
|
+
Boolean,
|
|
515
|
+
Number,
|
|
516
|
+
String
|
|
517
|
+
],
|
|
518
|
+
required: false
|
|
519
|
+
},
|
|
520
|
+
paddingInlineStart: {
|
|
521
|
+
type: [
|
|
522
|
+
Boolean,
|
|
523
|
+
Number,
|
|
524
|
+
String
|
|
525
|
+
],
|
|
526
|
+
required: false
|
|
527
|
+
},
|
|
528
|
+
paddingInlineEnd: {
|
|
529
|
+
type: [
|
|
530
|
+
Boolean,
|
|
531
|
+
Number,
|
|
532
|
+
String
|
|
533
|
+
],
|
|
534
|
+
required: false
|
|
535
|
+
},
|
|
536
|
+
paddingBlockStart: {
|
|
537
|
+
type: [
|
|
538
|
+
Boolean,
|
|
539
|
+
Number,
|
|
540
|
+
String
|
|
541
|
+
],
|
|
542
|
+
required: false
|
|
543
|
+
},
|
|
544
|
+
paddingBlockEnd: {
|
|
545
|
+
type: [
|
|
546
|
+
Boolean,
|
|
547
|
+
Number,
|
|
548
|
+
String
|
|
549
|
+
],
|
|
550
|
+
required: false
|
|
551
|
+
},
|
|
552
|
+
rounded: {
|
|
553
|
+
type: [
|
|
554
|
+
Boolean,
|
|
555
|
+
Number,
|
|
556
|
+
String,
|
|
557
|
+
null
|
|
558
|
+
],
|
|
559
|
+
required: false,
|
|
560
|
+
skipCheck: true
|
|
561
|
+
},
|
|
562
|
+
roundedTopRight: {
|
|
563
|
+
type: [
|
|
564
|
+
Boolean,
|
|
565
|
+
Number,
|
|
566
|
+
String
|
|
567
|
+
],
|
|
568
|
+
required: false
|
|
569
|
+
},
|
|
570
|
+
roundedTopLeft: {
|
|
571
|
+
type: [
|
|
572
|
+
Boolean,
|
|
573
|
+
Number,
|
|
574
|
+
String
|
|
575
|
+
],
|
|
576
|
+
required: false
|
|
577
|
+
},
|
|
578
|
+
roundedBottomLeft: {
|
|
579
|
+
type: [
|
|
580
|
+
Boolean,
|
|
581
|
+
Number,
|
|
582
|
+
String
|
|
583
|
+
],
|
|
584
|
+
required: false
|
|
585
|
+
},
|
|
586
|
+
roundedBottomRight: {
|
|
587
|
+
type: [
|
|
588
|
+
Boolean,
|
|
589
|
+
Number,
|
|
590
|
+
String
|
|
591
|
+
],
|
|
592
|
+
required: false
|
|
593
|
+
},
|
|
594
|
+
roundedStartStart: {
|
|
595
|
+
type: [
|
|
596
|
+
Boolean,
|
|
597
|
+
Number,
|
|
598
|
+
String
|
|
599
|
+
],
|
|
600
|
+
required: false
|
|
601
|
+
},
|
|
602
|
+
roundedStartEnd: {
|
|
603
|
+
type: [
|
|
604
|
+
Boolean,
|
|
605
|
+
Number,
|
|
606
|
+
String
|
|
607
|
+
],
|
|
608
|
+
required: false
|
|
609
|
+
},
|
|
610
|
+
roundedEndStart: {
|
|
611
|
+
type: [
|
|
612
|
+
Boolean,
|
|
613
|
+
Number,
|
|
614
|
+
String
|
|
615
|
+
],
|
|
616
|
+
required: false
|
|
617
|
+
},
|
|
618
|
+
roundedEndEnd: {
|
|
619
|
+
type: [
|
|
620
|
+
Boolean,
|
|
621
|
+
Number,
|
|
622
|
+
String
|
|
623
|
+
],
|
|
624
|
+
required: false
|
|
625
|
+
},
|
|
626
|
+
elevation: {
|
|
627
|
+
type: [Number, String],
|
|
628
|
+
required: false
|
|
629
|
+
},
|
|
630
|
+
bgColor: {
|
|
631
|
+
type: [
|
|
632
|
+
String,
|
|
633
|
+
Object,
|
|
634
|
+
Boolean,
|
|
635
|
+
null
|
|
636
|
+
],
|
|
637
|
+
required: false,
|
|
638
|
+
skipCheck: true
|
|
639
|
+
},
|
|
640
|
+
fontSize: {
|
|
641
|
+
type: null,
|
|
642
|
+
required: false
|
|
643
|
+
},
|
|
644
|
+
fontWeight: {
|
|
645
|
+
type: null,
|
|
646
|
+
required: false
|
|
647
|
+
}
|
|
282
648
|
});
|
|
283
|
-
const emit = defineEmits([
|
|
649
|
+
const emit = defineEmits([
|
|
650
|
+
"point-click",
|
|
651
|
+
"legend-click",
|
|
652
|
+
"series-toggle"
|
|
653
|
+
]);
|
|
284
654
|
defineSlots();
|
|
285
655
|
const { t } = useLocale();
|
|
286
656
|
const { dimensionStyles } = useDimension(props);
|
|
@@ -291,238 +661,288 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
291
661
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
292
662
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
293
663
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
664
|
+
/*********************************************************
|
|
665
|
+
* Static SVG box — fixed coordinate space, CSS scales it.
|
|
666
|
+
********************************************************/
|
|
294
667
|
const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.candlestick);
|
|
295
668
|
const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
|
|
296
|
-
const PADDING = {
|
|
669
|
+
const PADDING = {
|
|
670
|
+
top: 20,
|
|
671
|
+
right: 20,
|
|
672
|
+
bottom: 36,
|
|
673
|
+
left: 56
|
|
674
|
+
};
|
|
297
675
|
const Y_TICK_COUNT = 5;
|
|
298
|
-
const Y_PAD_FRACTION =
|
|
676
|
+
const Y_PAD_FRACTION = .05;
|
|
299
677
|
const MAX_X_LABELS = 10;
|
|
678
|
+
/*********************************************************
|
|
679
|
+
* Color resolution
|
|
680
|
+
********************************************************/
|
|
300
681
|
const resolveColor = (raw) => {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
682
|
+
if (!raw) return "currentColor";
|
|
683
|
+
if (/^(#|rgb|hsl|var|currentColor|transparent|linear-gradient|radial-gradient|conic-gradient)/i.test(raw)) {
|
|
684
|
+
return raw;
|
|
685
|
+
}
|
|
686
|
+
if (isIntent(raw)) {
|
|
687
|
+
return intentBgExpr(raw, "default");
|
|
688
|
+
}
|
|
689
|
+
return "currentColor";
|
|
309
690
|
};
|
|
310
691
|
const bullishColorResolved = computed(() => resolveColor(props.bullishColor));
|
|
311
692
|
const bearishColorResolved = computed(() => resolveColor(props.bearishColor));
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
)
|
|
693
|
+
/*********************************************************
|
|
694
|
+
* useUnsupportedProp
|
|
695
|
+
*
|
|
696
|
+
* @description
|
|
697
|
+
* ⛔ #426 — `colorScheme` is inherited from `IChartBaseProps` but has no
|
|
698
|
+
* effect here: candle colour is a BINARY choice (bullishColor / bearishColor),
|
|
699
|
+
* not a per-series identity a rotating palette could drive. See #426 decision:
|
|
700
|
+
* neither wiring a fake behaviour nor removing the prop — warn instead.
|
|
701
|
+
********************************************************/
|
|
702
|
+
useUnsupportedProp("OrigamChartCandlestick", "colorScheme", "candle colour is binary (bullishColor / bearishColor) — there is no per-series identity for a rotating palette to drive.", () => !!props.colorScheme?.length);
|
|
703
|
+
/*********************************************************
|
|
704
|
+
* Data access helpers
|
|
705
|
+
********************************************************/
|
|
318
706
|
const rawData = computed(() => {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
707
|
+
const series = props.series?.[0];
|
|
708
|
+
if (!series?.data?.length) return [];
|
|
709
|
+
return series.data;
|
|
322
710
|
});
|
|
323
|
-
const validData = computed(
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
);
|
|
711
|
+
const validData = computed(() => rawData.value.filter((d) => d && typeof d.open === "number" && typeof d.high === "number" && typeof d.low === "number" && typeof d.close === "number" && Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close)));
|
|
712
|
+
/*********************************************************
|
|
713
|
+
* Y scale
|
|
714
|
+
********************************************************/
|
|
328
715
|
const yDomain = computed(() => {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
716
|
+
if (!validData.value.length) return {
|
|
717
|
+
min: 0,
|
|
718
|
+
max: 1
|
|
719
|
+
};
|
|
720
|
+
const allLows = validData.value.map((d) => d.low);
|
|
721
|
+
const allHighs = validData.value.map((d) => d.high);
|
|
722
|
+
const rawMin = Math.min(...allLows);
|
|
723
|
+
const rawMax = Math.max(...allHighs);
|
|
724
|
+
const range = rawMax - rawMin || 1;
|
|
725
|
+
const pad = range * Y_PAD_FRACTION;
|
|
726
|
+
return {
|
|
727
|
+
min: props.yMin !== undefined ? props.yMin : rawMin - pad,
|
|
728
|
+
max: props.yMax !== undefined ? props.yMax : rawMax + pad
|
|
729
|
+
};
|
|
340
730
|
});
|
|
341
731
|
const plotTop = PADDING.top;
|
|
342
732
|
const plotBottom = computed(() => svgHeight.value - PADDING.bottom);
|
|
343
733
|
const plotHeight = computed(() => plotBottom.value - plotTop);
|
|
344
734
|
const yToSvg = (value) => {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
735
|
+
const { min, max } = yDomain.value;
|
|
736
|
+
const range = max - min || 1;
|
|
737
|
+
return plotBottom.value - (value - min) / range * plotHeight.value;
|
|
348
738
|
};
|
|
739
|
+
/*********************************************************
|
|
740
|
+
* Y ticks
|
|
741
|
+
********************************************************/
|
|
349
742
|
const yTicks = computed(() => {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
743
|
+
const { min, max } = yDomain.value;
|
|
744
|
+
const range = max - min || 1;
|
|
745
|
+
const step = range / (Y_TICK_COUNT - 1);
|
|
746
|
+
return Array.from({ length: Y_TICK_COUNT }, (_, i) => {
|
|
747
|
+
const value = min + i * step;
|
|
748
|
+
return {
|
|
749
|
+
value,
|
|
750
|
+
position: yToSvg(value),
|
|
751
|
+
label: props.yAxisFormat ? props.yAxisFormat(value) : value.toFixed(0)
|
|
752
|
+
};
|
|
753
|
+
});
|
|
361
754
|
});
|
|
755
|
+
/*********************************************************
|
|
756
|
+
* Candle geometry
|
|
757
|
+
********************************************************/
|
|
362
758
|
const candles = computed(() => {
|
|
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
|
-
|
|
759
|
+
const data = validData.value;
|
|
760
|
+
const count = data.length;
|
|
761
|
+
if (!count) return [];
|
|
762
|
+
const plotLeft = PADDING.left;
|
|
763
|
+
const plotRight = svgWidth.value - PADDING.right;
|
|
764
|
+
const plotWidth = plotRight - plotLeft;
|
|
765
|
+
const slotW = plotWidth / count;
|
|
766
|
+
const candleHalfW = slotW * props.candleWidth / 2;
|
|
767
|
+
return data.map((datum, index) => {
|
|
768
|
+
const cx = plotLeft + (index + .5) * slotW;
|
|
769
|
+
const isBullish = datum.close >= datum.open;
|
|
770
|
+
const yOpen = yToSvg(datum.open);
|
|
771
|
+
const yClose = yToSvg(datum.close);
|
|
772
|
+
const yHigh = yToSvg(datum.high);
|
|
773
|
+
const yLow = yToSvg(datum.low);
|
|
774
|
+
const bodyY = Math.min(yOpen, yClose);
|
|
775
|
+
const bodyHeight = Math.abs(yClose - yOpen);
|
|
776
|
+
const change = datum.close - datum.open;
|
|
777
|
+
const changePct = datum.open !== 0 ? change / datum.open * 100 : 0;
|
|
778
|
+
return {
|
|
779
|
+
index,
|
|
780
|
+
datum,
|
|
781
|
+
cx,
|
|
782
|
+
bodyX: cx - candleHalfW,
|
|
783
|
+
bodyY,
|
|
784
|
+
bodyWidth: candleHalfW * 2,
|
|
785
|
+
bodyHeight,
|
|
786
|
+
wickTop: yHigh,
|
|
787
|
+
wickBottom: yLow,
|
|
788
|
+
color: isBullish ? bullishColorResolved.value : bearishColorResolved.value,
|
|
789
|
+
isBullish,
|
|
790
|
+
change,
|
|
791
|
+
changePct
|
|
792
|
+
};
|
|
793
|
+
});
|
|
398
794
|
});
|
|
795
|
+
/*********************************************************
|
|
796
|
+
* X-axis label formatting (show up to MAX_X_LABELS)
|
|
797
|
+
********************************************************/
|
|
399
798
|
const formatXLabel = (date, index) => {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
799
|
+
const count = candles.value.length;
|
|
800
|
+
if (count > MAX_X_LABELS) {
|
|
801
|
+
const step = Math.ceil(count / MAX_X_LABELS);
|
|
802
|
+
if (index % step !== 0 && index !== count - 1) return "";
|
|
803
|
+
}
|
|
804
|
+
if (props.xAxisFormat) return props.xAxisFormat(date);
|
|
805
|
+
return date;
|
|
407
806
|
};
|
|
807
|
+
/*********************************************************
|
|
808
|
+
* Legend — one entry per series (not per candle)
|
|
809
|
+
********************************************************/
|
|
408
810
|
const legendItems = computed(() => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
811
|
+
if (!props.series?.length) return [];
|
|
812
|
+
return props.series.map((s, i) => ({
|
|
813
|
+
series: s,
|
|
814
|
+
index: i,
|
|
815
|
+
color: bullishColorResolved.value,
|
|
816
|
+
visible: s.visible !== false
|
|
817
|
+
}));
|
|
818
|
+
});
|
|
819
|
+
/*********************************************************
|
|
820
|
+
* Hover / tooltip
|
|
821
|
+
********************************************************/
|
|
822
|
+
const mousePos = ref({
|
|
823
|
+
x: 0,
|
|
824
|
+
y: 0
|
|
416
825
|
});
|
|
417
|
-
const mousePos = ref({ x: 0, y: 0 });
|
|
418
826
|
const hoveredIndex = ref(null);
|
|
419
827
|
const hoveredCandle = computed(() => {
|
|
420
|
-
|
|
421
|
-
|
|
828
|
+
if (hoveredIndex.value === null) return null;
|
|
829
|
+
return candles.value.find((c) => c.index === hoveredIndex.value) ?? null;
|
|
422
830
|
});
|
|
423
831
|
const hoveredPoint = computed(() => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
832
|
+
const c = hoveredCandle.value;
|
|
833
|
+
if (!c || !props.series?.[0]) return null;
|
|
834
|
+
return {
|
|
835
|
+
seriesIndex: 0,
|
|
836
|
+
seriesName: props.series[0].name,
|
|
837
|
+
dataIndex: c.index,
|
|
838
|
+
x: c.datum.date,
|
|
839
|
+
y: c.datum.close,
|
|
840
|
+
color: c.color
|
|
841
|
+
};
|
|
434
842
|
});
|
|
435
843
|
const hoveredSeries = computed(() => {
|
|
436
|
-
|
|
437
|
-
|
|
844
|
+
if (!hoveredCandle.value || !props.series?.[0]) return null;
|
|
845
|
+
return props.series[0];
|
|
438
846
|
});
|
|
439
|
-
const hoveredCategory = computed(
|
|
440
|
-
|
|
441
|
-
|
|
847
|
+
const hoveredCategory = computed(() => hoveredCandle.value?.datum.date ?? "");
|
|
848
|
+
/*********************************************************
|
|
849
|
+
* enrichedTooltipBindings
|
|
850
|
+
*
|
|
851
|
+
* @description
|
|
852
|
+
* Builds the `IChartCandlestickSlots['tooltip']` scope. The
|
|
853
|
+
* template only invokes this while `v-if="$slots.tooltip &&
|
|
854
|
+
* hoveredCandle"` holds, so `hoveredCandle.value` is non-null here
|
|
855
|
+
* — the `!` reflects that guard, not an unchecked assumption.
|
|
856
|
+
********************************************************/
|
|
442
857
|
const enrichedTooltipBindings = (bindings) => {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
858
|
+
const c = hoveredCandle.value;
|
|
859
|
+
return {
|
|
860
|
+
...bindings,
|
|
861
|
+
datum: c.datum,
|
|
862
|
+
change: c.change,
|
|
863
|
+
changePct: c.changePct,
|
|
864
|
+
isBullish: c.isBullish
|
|
865
|
+
};
|
|
451
866
|
};
|
|
452
867
|
const showEmpty = computed(() => {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
868
|
+
if (!props.series?.length) return true;
|
|
869
|
+
const first = props.series[0];
|
|
870
|
+
if (!first?.data?.length) return true;
|
|
871
|
+
return validData.value.length === 0;
|
|
457
872
|
});
|
|
873
|
+
/*********************************************************
|
|
874
|
+
* Root classes / styles
|
|
875
|
+
********************************************************/
|
|
458
876
|
const rootClasses = computed(() => [
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
877
|
+
{
|
|
878
|
+
[`origam-chart-candlestick--legend-${props.legendPosition}`]: true,
|
|
879
|
+
"origam-chart-candlestick--no-animation": !props.animated
|
|
880
|
+
},
|
|
881
|
+
backgroundColorClasses.value,
|
|
882
|
+
elevationClasses.value,
|
|
883
|
+
marginClasses.value,
|
|
884
|
+
paddingClasses.value,
|
|
885
|
+
roundedClasses.value,
|
|
886
|
+
props.class
|
|
469
887
|
]);
|
|
470
888
|
const rootStyles = computed(() => {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
889
|
+
const out = {};
|
|
890
|
+
if (props.aspectRatio) {
|
|
891
|
+
out.aspectRatio = props.aspectRatio;
|
|
892
|
+
}
|
|
893
|
+
Object.assign(out, chartAnimationStyle.value);
|
|
894
|
+
return [out, props.style];
|
|
477
895
|
});
|
|
478
|
-
const bodyClasses = computed(() => ({
|
|
479
|
-
|
|
480
|
-
}));
|
|
481
|
-
const svgClasses = computed(() => ({
|
|
482
|
-
"origam-chart__svg--animated": props.animated
|
|
483
|
-
}));
|
|
896
|
+
const bodyClasses = computed(() => ({ "origam-chart-candlestick__body--with-side-legend": props.showLegend && (props.legendPosition === "left" || props.legendPosition === "right") }));
|
|
897
|
+
const svgClasses = computed(() => ({ "origam-chart__svg--animated": props.animated }));
|
|
484
898
|
const hasTitleBlock = computed(() => Boolean(props.title || props.subtitle));
|
|
899
|
+
/*********************************************************
|
|
900
|
+
* ARIA
|
|
901
|
+
********************************************************/
|
|
485
902
|
const ariaLabel = computed(() => props.title ?? t("origam.chart.candlestick.aria_label"));
|
|
486
903
|
const svgAriaLabel = computed(() => props.title ?? t("origam.chart.candlestick.aria_label"));
|
|
487
904
|
const svgTitle = computed(() => props.title ?? t("origam.chart.candlestick.aria_label"));
|
|
488
905
|
const svgDesc = computed(() => {
|
|
489
|
-
|
|
490
|
-
|
|
906
|
+
const n = candles.value.length;
|
|
907
|
+
return t("origam.chart.candlestick.desc", n);
|
|
491
908
|
});
|
|
492
909
|
const candleAriaLabel = (candle) => {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
910
|
+
const d = candle.datum;
|
|
911
|
+
const direction = candle.isBullish ? t("origam.chart.candlestick.direction_bullish") : t("origam.chart.candlestick.direction_bearish");
|
|
912
|
+
return t("origam.chart.candlestick.candle_aria_label", d.date, direction, d.open, d.high, d.low, d.close);
|
|
496
913
|
};
|
|
914
|
+
/*********************************************************
|
|
915
|
+
* Interaction
|
|
916
|
+
********************************************************/
|
|
497
917
|
const onCandleEnter = (candle) => {
|
|
498
|
-
|
|
918
|
+
hoveredIndex.value = candle.index;
|
|
499
919
|
};
|
|
500
920
|
const onCandleLeave = () => {
|
|
501
|
-
|
|
921
|
+
hoveredIndex.value = null;
|
|
502
922
|
};
|
|
503
923
|
const onSvgMouseMove = (event) => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
924
|
+
const target = svgRef.value;
|
|
925
|
+
if (!target) return;
|
|
926
|
+
const rect = target.getBoundingClientRect();
|
|
927
|
+
mousePos.value = {
|
|
928
|
+
x: event.clientX - rect.left,
|
|
929
|
+
y: event.clientY - rect.top
|
|
930
|
+
};
|
|
511
931
|
};
|
|
512
932
|
const onSvgMouseLeave = () => {
|
|
513
|
-
|
|
933
|
+
onCandleLeave();
|
|
514
934
|
};
|
|
515
935
|
const onCandleActivate = (candle, event) => {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
936
|
+
hoveredIndex.value = candle.index;
|
|
937
|
+
if (hoveredPoint.value) {
|
|
938
|
+
emit("point-click", hoveredPoint.value, event);
|
|
939
|
+
}
|
|
520
940
|
};
|
|
521
941
|
const onLegendClick = (series, index) => {
|
|
522
|
-
|
|
942
|
+
emit("legend-click", series, index);
|
|
523
943
|
};
|
|
524
944
|
const onSeriesToggle = (series, nextVisible) => {
|
|
525
|
-
|
|
945
|
+
emit("series-toggle", series, nextVisible);
|
|
526
946
|
};
|
|
527
947
|
</script>
|
|
528
948
|
|