diff --git a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx index 843c307b7b8..8e8695c7a19 100644 --- a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx +++ b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx @@ -95,6 +95,8 @@ export class SlopeChart // currently hovered legend color @observable hoverColor?: string + private hasInteractedWithChart = false + transformTable(table: OwidTable) { if (!table.has(this.yColumnSlug)) return table @@ -164,7 +166,7 @@ export class SlopeChart if (!isEntitySelectionEnabled || hoverKey === undefined) { return } - + this.hasInteractedWithChart = true this.selectionArray.toggleSelection(hoverKey) } @@ -201,6 +203,8 @@ export class SlopeChart const { hoverColor, isEntitySelectionEnabled } = this if (!isEntitySelectionEnabled || hoverColor === undefined) return + this.hasInteractedWithChart = true + const seriesNamesToToggle = this.series .filter((g) => g.color === hoverColor) .map((g) => g.seriesName) @@ -545,6 +549,7 @@ export class SlopeChart if ( this.isEntitySelectionEnabled && + this.hasInteractedWithChart && !this.hoverKey && !this.hoverColor && !this.manager.isModalOpen &&