diff --git a/packages/@ourworldindata/grapher/src/mapCharts/MapChart.tsx b/packages/@ourworldindata/grapher/src/mapCharts/MapChart.tsx index 9a350623a8..37b81c26b9 100644 --- a/packages/@ourworldindata/grapher/src/mapCharts/MapChart.tsx +++ b/packages/@ourworldindata/grapher/src/mapCharts/MapChart.tsx @@ -633,14 +633,21 @@ export class MapChart } renderMapLegend(): React.ReactElement { + const onMouseLeave = this.manager.isStatic + ? undefined + : this.onLegendMouseLeave + const onMouseOver = this.manager.isStatic + ? undefined + : this.onLegendMouseOver + return ( <> {this.numericLegend && ( )} {this.categoryLegend && ( @@ -649,8 +656,8 @@ export class MapChart x={this.legendX} y={this.categoryLegendY} swatchStrokeColor={this.categoricalBinStroke} - onMouseLeave={this.onLegendMouseLeave} - onMouseOver={this.onLegendMouseOver} + onMouseLeave={onMouseLeave} + onMouseOver={onMouseOver} /> )} diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx index c82b789795..21d92aacbd 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx @@ -1030,6 +1030,13 @@ export class MarimekkoChart const footer = excludeUndefined([toleranceNotice, roundingNotice]) + const onLegendMouseLeave = this.manager.isStatic + ? undefined + : this.onLegendMouseLeave + const onLegendMouseOver = this.manager.isStatic + ? undefined + : this.onLegendMouseOver + return ( {this.renderBars()} {target && ( diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx index fc64ac6b2c..aaf95496be 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx @@ -727,13 +727,21 @@ export class StackedDiscreteBarChart renderLegend(): React.ReactElement | void { if (!this.showLegend) return + + const onMouseLeave = this.manager.isStatic + ? undefined + : this.onLegendMouseLeave + const onMouseOver = this.manager.isStatic + ? undefined + : this.onLegendMouseOver + return ( ) }