Skip to content
Snippets Groups Projects
Commit d59b75af authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

plot width depending on html container

parent fb068cce
No related branches found
No related tags found
No related merge requests found
Pipeline #129352 failed
...@@ -4,6 +4,7 @@ import { computed, toValue, ref, onMounted, watchEffect, unref } from 'vue' ...@@ -4,6 +4,7 @@ import { computed, toValue, ref, onMounted, watchEffect, unref } from 'vue'
import * as d3 from "d3"; import * as d3 from "d3";
import * as Plot from "@observablehq/plot"; import * as Plot from "@observablehq/plot";
import { useDisplay } from "vuetify"; import { useDisplay } from "vuetify";
import { useElementSize } from '@vueuse/core'
export interface PlotMargin { export interface PlotMargin {
marginTop: number, marginTop: number,
...@@ -14,7 +15,7 @@ export interface PlotMargin { ...@@ -14,7 +15,7 @@ export interface PlotMargin {
const margin = ref<PlotMargin>({ const margin = ref<PlotMargin>({
marginTop: 50, marginTop: 50,
marginRight: 50, marginRight: 20,
marginBottom: 100, marginBottom: 100,
marginLeft: 40 marginLeft: 40
...@@ -62,9 +63,11 @@ onMounted(() => { ...@@ -62,9 +63,11 @@ onMounted(() => {
}) })
const plotContainer = ref(null)
const computedWidth = computed(() => { const computedWidth = computed(() => {
const screenWidth = toValue(width) > 1280 ? 1280 : toValue(width) const screenWidth = useElementSize(plotContainer, { width: 500, height: 0 }, { box: 'border-box' }).width.value
// const screenWidth = toValue(width) > 1280 ? 1280 : toValue(width)
return Math.max(screenWidth, 550); return Math.max(screenWidth, 550);
}); });
...@@ -225,7 +228,7 @@ async function fetchRefSeqTaxo() { ...@@ -225,7 +228,7 @@ async function fetchRefSeqTaxo() {
</v-card-text> </v-card-text>
<v-card variant="elevated" elevation="1" :loading="pending"> <v-card variant="elevated" elevation="1" :loading="pending">
<v-card-text> <v-card-text ref="plotContainer">
<v-row no-gutters> <v-row no-gutters>
<v-col> <v-col>
<v-select v-model="selectedTaxoRank" :items="taxoRanks" density="compact" <v-select v-model="selectedTaxoRank" :items="taxoRanks" density="compact"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment