From 3a5b01ab3f862ecb5f322b5bacb3e5847c644d66 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Wed, 1 May 2024 14:54:38 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(marimekko)=20do=20not=20show=20?= =?UTF-8?q?lone=20legend=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grapher/src/stackedCharts/MarimekkoChart.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx index 5b40d4c5d30..560dd36cfad 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx @@ -824,7 +824,7 @@ export class MarimekkoChart // legend props @computed get legendPaddingTop(): number { - return this.baseFontSize + return this.legend.height > 0 ? this.baseFontSize : 0 } @computed get legendX(): number { @@ -857,19 +857,19 @@ export class MarimekkoChart @computed get categoricalLegendData(): CategoricalBin[] { const { colorColumnSlug, colorScale, series } = this - const customHiddenCategories = - this.colorScaleConfig?.customHiddenCategories - if (colorColumnSlug) return colorScale.categoricalLegendBins - else + if (colorColumnSlug) { + return colorScale.categoricalLegendBins + } else if (series.length > 0) { return series.map((series, index) => { return new CategoricalBin({ index, value: series.seriesName, label: series.seriesName, color: series.color, - isHidden: !!customHiddenCategories?.[series.seriesName], }) }) + } + return [] } @action.bound onLegendMouseOver(bin: ColorScaleBin): void {