diff --git a/packages/@ourworldindata/grapher/src/facetChart/FacetChart.tsx b/packages/@ourworldindata/grapher/src/facetChart/FacetChart.tsx index ef091fb911..e66b7faa5b 100644 --- a/packages/@ourworldindata/grapher/src/facetChart/FacetChart.tsx +++ b/packages/@ourworldindata/grapher/src/facetChart/FacetChart.tsx @@ -799,7 +799,8 @@ export class FacetChart } @action.bound onLegendClick(bin: ColorScaleBin): void { - if (!this.manager.focusArray) return + if (!this.manager.focusArray || !this.isFocusModeSupported) return + // find all series (of all facets) that are contained in the bin const seriesNames = uniq( this.intermediateChartInstances.flatMap((chartInstance) => @@ -817,6 +818,13 @@ export class FacetChart return new this.LegendClass({ manager: this }) } + @computed private get isFocusModeSupported(): boolean { + return ( + this.chartTypeName === GRAPHER_CHART_TYPES.LineChart || + this.chartTypeName === GRAPHER_CHART_TYPES.SlopeChart + ) + } + /** * In order to display a potentially long facet label in the potentially tight space, we * shrink and shorten the label as follows to prevent overlap between neighbouring labels: