From 9425e0a6b77facf6f4c954a8c69d3757a9f42f0f Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Thu, 4 Apr 2024 11:04:05 +0200 Subject: [PATCH] y axis for genome count --- .../content/ArticleSystemDistributionPlot.vue | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/components/content/ArticleSystemDistributionPlot.vue b/components/content/ArticleSystemDistributionPlot.vue index c644c73c..b5bdbd31 100644 --- a/components/content/ArticleSystemDistributionPlot.vue +++ b/components/content/ArticleSystemDistributionPlot.vue @@ -64,7 +64,7 @@ const computedDistribution = computed(() => { const distribution = [] for (const [taxo, values] of itemsPerGroup.entries()) { if (toValFacetsPerRank[taxo] && toValFacetsPerRank[taxo] > 0) { - distribution.push({ taxo, size: (values.size / toValFacetsPerRank[taxo]) * 100 }) + distribution.push({ taxo, size: values.size, percent: (values.size / toValFacetsPerRank[taxo]) * 100 }) } } return distribution @@ -102,9 +102,16 @@ const distributionOptions = computed(() => { const { marginLeft, marginRight } = toValue(margin) return { ...toValue(margin), - y: { label: `% of genomes encoding ${toValue(page)?.title ?? 'the system'}` }, + y: { label: `Number of genomes encoding ${toValue(page)?.title ?? 'the system'}` }, x: { label: selectedTaxoRank.value, tickRotate: 45 }, - color: { scheme: "plasma", legend: true, reverse: true, domain: [0, 100], marginLeft: 10, label: "percentage" }, + color: { + scheme: "plasma", + legend: true, + reverse: true, + domain: [0, 100], + marginLeft: 10, + label: `% of genomes encoding ${toValue(page)?.title ?? 'the system'}`, + }, width: computedWidth.value - marginRight - marginLeft, marks: [ Plot.barY( @@ -112,7 +119,7 @@ const distributionOptions = computed(() => { { y: "size", x: "taxo", - fill: "size", + fill: "percent", tip: true, sort: { x: "-y" }, }, @@ -136,13 +143,13 @@ async function fetchSystemHits() { query: "", params: { facets: ["*"], - filter: [`type='${toValue(systemName)}'`], + filter: [`type = '${toValue(systemName)}'`], limit: 500000, } }) systemHits.value = data.value if (error.value) { - throw createError(`Cannot get hits on refseq for system: ${toValue(systemName)}`) + throw createError(`Cannot get hits on refseq for system: ${toValue(systemName)} `) } } @@ -158,7 +165,7 @@ async function fetchRefSeqTaxo() { }) refseqTaxo.value = data.value if (error.value) { - throw createError(`Cannot get refseq taxo: ${toValue(systemName)}`) + throw createError(`Cannot get refseq taxo: ${toValue(systemName)} `) } } -- GitLab