Skip to content

Commit a93bdb6

Browse files
committed
Fix - VueUiXy - Fix issues related to zoom when startIndex & endIndex are set
1 parent cb67e12 commit a93bdb6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

TestingArena/ArenaVueUiXy.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ const model = ref([
647647
{ key: 'chart.zoom.minimap.indicatorColor', def: '#1A1A1A', type: 'color' },
648648
{ key: 'chart.zoom.minimap.verticalHandles', def: false, type: 'checkbox' },
649649
650-
{ key: 'chart.zoom.startIndex', def: null, type: 'number', min: 0, max: 100 },
650+
{ key: 'chart.zoom.startIndex', def: 50, type: 'number', min: 0, max: 100 },
651651
{ key: 'chart.zoom.endIndex', def: null, type: 'number', min: 0, max: 100 },
652652
{ key: 'chart.zoom.preview.enable', def: true, type: 'checkbox'},
653653
{ key: 'chart.zoom.preview.stroke', def: '#1f77b4', type: 'color'},
@@ -1148,6 +1148,7 @@ const config = computed(() => {
11481148
zoom: {
11491149
...c.chart.zoom,
11501150
useDefaultFormat: true,
1151+
timeFormat: 'yyyy-MM-dd HH:mm:ss',
11511152
// customFormat: ({ absoluteIndex }) => {
11521153
// return String(absoluteIndex) + 'TEST'
11531154
// }

src/components/vue-ui-xy.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,22 @@ async function setupSlicer() {
10061006
10071007
const max = Math.max(...FINAL_DATASET.value.map(dp => lttb(dp.series).length));
10081008
1009+
slicer.value = { start: 0, end: max };
1010+
10091011
if ((startIndex != null || endIndex != null) && comp) {
10101012
if (startIndex != null) {
10111013
slicer.value.start = startIndex;
10121014
comp.setStartValue(startIndex);
1015+
} else {
1016+
slicer.value.start = 0;
1017+
comp.setStartValue(0);
10131018
}
10141019
if (endIndex != null) {
10151020
slicer.value.end = endIndex + 1
10161021
comp.setEndValue(validSlicerEnd(endIndex + 1));
1022+
} else {
1023+
slicer.value.end = max;
1024+
comp.setEndValue(max);
10171025
}
10181026
} else {
10191027
slicer.value = { start: 0, end: max };
@@ -2103,6 +2111,7 @@ const preciseAllTimeLabels = computed(() => {
21032111
21042112
// Simple Slicer labels
21052113
const useSlicerCustomFormat = ref(false);
2114+
21062115
const slicerLabels = computed(() => {
21072116
let left = '', right = '';
21082117
if (FINAL_CONFIG.value.chart.zoom.preview.enable) {
@@ -2134,13 +2143,13 @@ const slicerLabels = computed(() => {
21342143
}
21352144
21362145
if (!useSlicerCustomFormat.value) {
2137-
left = FINAL_CONFIG.value.chart.grid.labels.xAxisLabels.datetimeFormatter.enable
2146+
left = FINAL_CONFIG.value.chart.grid.labels.xAxisLabels.datetimeFormatter.enable && !FINAL_CONFIG.value.chart.zoom.useDefaultFormat
21382147
? (preciseAllTimeLabels.value[slicer.value.start]?.text || '')
21392148
: (timeLabels.value[0]?.text || '');
21402149
21412150
const endAbs = Math.max(slicer.value.start, slicer.value.end - 1)
21422151
2143-
right = FINAL_CONFIG.value.chart.grid.labels.xAxisLabels.datetimeFormatter.enable
2152+
right = FINAL_CONFIG.value.chart.grid.labels.xAxisLabels.datetimeFormatter.enable && !FINAL_CONFIG.value.chart.zoom.useDefaultFormat
21442153
? (preciseAllTimeLabels.value[endAbs]?.text || '')
21452154
: (timeLabels.value.at(-1)?.text || '')
21462155
}

0 commit comments

Comments
 (0)