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

Try some options and facet

parent f5e40544
No related branches found
No related tags found
No related merge requests found
Pipeline #112541 canceled
...@@ -9,7 +9,8 @@ const drawer = ref(true); ...@@ -9,7 +9,8 @@ const drawer = ref(true);
// const { data } = await useAsyncData("refseq", () => // const { data } = await useAsyncData("refseq", () =>
// queryContent("/refseq").find() // queryContent("/refseq").find()
// ); // );
const facet = ref(false);
const facetDistriSystem = ref(false);
// console.log(data.value); // console.log(data.value);
const { const {
data: refseqData, data: refseqData,
...@@ -76,40 +77,87 @@ function filterOnlyCapsText(value, query, item) { ...@@ -76,40 +77,87 @@ function filterOnlyCapsText(value, query, item) {
return false; return false;
} }
const computedDistriTaxoOptions = computed(() => { const computedDistriSystemOptions = computed(() => {
const groupYOption = facetDistriSystem.value
? {
fy: "type",
y: selectedTaxoRank.value,
fill: selectedTaxoRank.value,
tip: true,
sort: { y: "-x" },
}
: {
y: "type",
tip: true,
fill: selectedTaxoRank.value,
sort: { y: "-x" },
};
return { return {
style: { marginLeft: facetDistriSystem.value ? 120 : 112,
width: "100%", x: { label: null },
"max-width": "100%",
},
marginBottom: 100,
x: { label: null, tickRotate: 90 },
y: { grid: true }, y: { grid: true },
color: { legend: true }, color: { legend: true },
width: computedWidth.value, width: computedWidth.value,
height: height.value, height: facetDistriSystem.value ? height.value * 8 : height.value * 2,
marks: [ marks: [
Plot.barY( Plot.frame(),
Plot.barX(
unref(selectedRefSeq.value), unref(selectedRefSeq.value),
// [ Plot.groupY(
// { species: "test", type: "Gao" }, { x: facetDistriSystem.value ? "proportion-facet" : "count" },
// { species: "test", type: "Gao" }, groupYOption
// { species: "species2", type: "AVAST" },
// ],
Plot.groupX(
{ y: "count" },
{
x: selectedTaxoRank.value,
// x: "genus",
fill: "type",
tip: true,
}
) )
), ),
], ],
}; };
}); });
const computedDistriTaxoOptions = computed(() => {
const groupYOption = facet.value
? {
y: "type",
fy: selectedTaxoRank.value,
fill: "type",
tip: true,
sort: { x: "-y" },
}
: {
y: selectedTaxoRank.value,
tip: true,
fill: "type",
offset: "normalize",
sort: { y: "x", reverse: true },
};
return {
// style: {
// width: "100%",
// "max-width": "100%",
// },
marginLeft: 110,
marginRight: facet.value ? 110 : 20,
marginBottom: 100,
grid: true,
x: { percent: true },
// x: { label: facet.value ? "Count" : null, tickRotate: 90 },
// y: { nice: true },
color: { legend: true },
width: computedWidth.value,
height: facet.value ? height.value * 4.3 : height.value,
marks: [
Plot.frame(),
Plot.barX(
unref(selectedRefSeq.value),
Plot.groupY(
{ x: facet.value ? "proportion-facet" : "count"},
groupYOption
)
),
],
};
});
</script> </script>
<template> <template>
...@@ -146,33 +194,13 @@ const computedDistriTaxoOptions = computed(() => { ...@@ -146,33 +194,13 @@ const computedDistriTaxoOptions = computed(() => {
><v-toolbar-title> Distribution Systems</v-toolbar-title></v-toolbar ><v-toolbar-title> Distribution Systems</v-toolbar-title></v-toolbar
> >
<v-card-text> <v-card-text>
<v-switch
v-model="facetDistriSystem"
label="Facet"
color="primary"
></v-switch>
<PlotFigure <PlotFigure
:options="{ :options="unref(computedDistriSystemOptions)"
style: {
width: '100%',
'max-width': '100%',
},
marginBottom: 100,
x: { label: null, tickRotate: 50 },
y: { grid: true },
color: { legend: true },
width: computedWidth,
height,
marks: [
Plot.barY(
unref(selectedRefSeq),
Plot.groupX(
{ y: 'count' },
{
x: 'type',
fill: 'species',
tip: true,
sort: { x: '-y' },
}
)
),
],
}"
defer defer
></PlotFigure> ></PlotFigure>
</v-card-text> </v-card-text>
...@@ -188,6 +216,7 @@ const computedDistriTaxoOptions = computed(() => { ...@@ -188,6 +216,7 @@ const computedDistriTaxoOptions = computed(() => {
density="compact" density="compact"
label="Select taxonomic rank" label="Select taxonomic rank"
></v-select> ></v-select>
<v-switch v-model="facet" label="Facet" color="primary"></v-switch>
<PlotFigure <PlotFigure
defer defer
:options="unref(computedDistriTaxoOptions)" :options="unref(computedDistriTaxoOptions)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment