-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
673 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 0 additions & 169 deletions
169
client/src/components/WorkflowInvocationState/MetricsBoxPlots.vue
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
client/src/components/WorkflowInvocationState/VegaWrapper.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div ref="chartContainer" class="chart"></div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import embed, { type VisualizationSpec } from "vega-embed"; | ||
import { onBeforeUnmount, onMounted, ref, watch } from "vue"; | ||
export interface VisSpec { | ||
spec: VisualizationSpec; | ||
} | ||
const props = defineProps<VisSpec>(); | ||
const chartContainer = ref<HTMLDivElement | null>(null); | ||
let vegaView: any; | ||
async function embedChart() { | ||
if (vegaView) { | ||
vegaView.finalize(); | ||
} | ||
if (chartContainer.value !== null) { | ||
const result = await embed(chartContainer.value, props.spec, { renderer: "svg" }); | ||
vegaView = result.view; | ||
} | ||
} | ||
onMounted(embedChart); | ||
watch(props, embedChart, { immediate: true, deep: true }); | ||
// Cleanup the chart when the component is unmounted | ||
onBeforeUnmount(() => { | ||
if (vegaView) { | ||
vegaView.finalize(); | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
.chart { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> |
Oops, something went wrong.