|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import { onMounted } from 'vue' |
| 3 | +import type { |
| 4 | + VueUiXy} from 'vue-data-ui/vue-ui-xy'; |
3 | 5 | import { |
4 | | - VueUiXy, |
5 | 6 | type VueUiXyConfig, |
6 | 7 | type VueUiXyDatasetBarItem, |
7 | 8 | type VueUiXyDatasetItem, |
@@ -30,7 +31,7 @@ const props = defineProps<{ |
30 | 31 |
|
31 | 32 | const { settings } = useSettings() |
32 | 33 | const route = useRoute('timeline') |
33 | | -
|
| 34 | +const chart = ref<typeof VueUiXy | null>(null) |
34 | 35 | const activeVersion = computed(() => route.params.version) |
35 | 36 |
|
36 | 37 | const packageName = computed(() => |
@@ -83,6 +84,14 @@ const convertedData = computed(() => { |
83 | 84 | return addEvaluationFlags(entries, props.versionSubEvents).toReversed() |
84 | 85 | }) |
85 | 86 |
|
| 87 | +watch( |
| 88 | + () => convertedData.value, |
| 89 | + () => { |
| 90 | + chart.value?.resetZoom() |
| 91 | + }, |
| 92 | + { flush: 'post' }, |
| 93 | +) |
| 94 | +
|
86 | 95 | const versions = computed(() => convertedData.value.map(d => d.version)) |
87 | 96 |
|
88 | 97 | const activeVersionIndex = computed(() => { |
@@ -377,6 +386,7 @@ const config = computed<VueUiXyConfig>(() => { |
377 | 386 | maxWidth: isMobile.value ? 350 : 500, |
378 | 387 | highlightColor: colors.value.bgElevated, |
379 | 388 | useResetSlot: true, |
| 389 | + keepState: true, |
380 | 390 | minimap: { |
381 | 391 | show: true, |
382 | 392 | lineColor: '#FAFAFA', |
@@ -526,7 +536,12 @@ const indexSelection = computed(() => { |
526 | 536 | </div> |
527 | 537 | </div> |
528 | 538 | <ClientOnly> |
529 | | - <VueUiXy :dataset="datasets[activeTab]" :config :selected-x-index="indexSelection"> |
| 539 | + <VueUiXy |
| 540 | + ref="chart" |
| 541 | + :dataset="datasets[activeTab]" |
| 542 | + :config |
| 543 | + :selected-x-index="indexSelection" |
| 544 | + > |
530 | 545 | <!-- Custom tooltip --> |
531 | 546 | <template #tooltip="{ timeLabel }"> |
532 | 547 | <div class="font-mono text-xs flex flex-col"> |
@@ -826,12 +841,12 @@ const indexSelection = computed(() => { |
826 | 841 | " |
827 | 842 | /> |
828 | 843 | </template> |
829 | | - </ClientOnly> |
830 | 844 |
|
831 | | - <!-- Sizes loading indicator --> |
832 | | - <div v-if="loading" class="h-0.5 rounded-full bg-bg-muted overflow-hidden"> |
833 | | - <div class="h-full w-1/3 bg-accent rounded-full animate-indeterminate" /> |
834 | | - </div> |
| 845 | + <!-- Sizes loading indicator --> |
| 846 | + <div v-if="loading" class="h-0.5 rounded-full bg-bg-muted overflow-hidden"> |
| 847 | + <div class="h-full w-1/3 bg-accent rounded-full animate-indeterminate" /> |
| 848 | + </div> |
| 849 | + </ClientOnly> |
835 | 850 | </div> |
836 | 851 | </template> |
837 | 852 |
|
|
0 commit comments