diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx index 6628f52f762..ea07c48e5ab 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx @@ -825,7 +825,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 { @@ -858,19 +858,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 {