diff --git a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
index 5c9ff86d523..a524cdfea3f 100644
--- a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
+++ b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
@@ -1141,7 +1141,7 @@ export class SlopeChart
private renderSlopes() {
return (
- <>
+
{this.renderSeries.map((series) => (
))}
- >
+
+ )
+ }
+
+ private renderInteractiveSlopes(): React.ReactElement {
+ return (
+
+
+ {this.renderSlopes()}
+
)
}
@@ -1176,7 +1197,7 @@ export class SlopeChart
const { xDomain, startX, endX } = this
return (
- <>
+
- >
- )
- }
-
- private renderChartArea() {
- return (
-
- {this.renderYAxis()}
- {this.renderXAxis()}
-
-
- {this.renderSlopes()}
-
)
}
@@ -1284,6 +1279,30 @@ export class SlopeChart
)
}
+ private renderInteractive(): React.ReactElement {
+ return (
+ <>
+ {this.renderYAxis()}
+ {this.renderXAxis()}
+ {this.renderInteractiveSlopes()}
+ {this.renderLineLegends()}
+ {this.renderNoDataSection()}
+ {this.tooltip}
+ >
+ )
+ }
+
+ private renderStatic(): React.ReactElement {
+ return (
+ <>
+ {this.renderYAxis()}
+ {this.renderXAxis()}
+ {this.renderSlopes()}
+ {this.renderLineLegends()}
+ >
+ )
+ }
+
render() {
if (this.failMessage)
return (
@@ -1297,14 +1316,9 @@ export class SlopeChart
>
)
- return (
-
- {this.renderChartArea()}
- {this.renderLineLegends()}
- {this.renderNoDataSection()}
- {this.tooltip}
-
- )
+ return this.manager.isStatic
+ ? this.renderStatic()
+ : this.renderInteractive()
}
}
@@ -1338,10 +1352,7 @@ function Slope({
: strokeWidth
return (
-
+
{showOutline && (
{
const y = yAxis.place(tick.value)
return (
-
-
-
+ x1={bounds.left + yAxis.width}
+ y1={y}
+ x2={bounds.right}
+ y2={y}
+ stroke="#ddd"
+ strokeDasharray="3,2"
+ />
)
})}
@@ -1452,7 +1457,14 @@ function MarkX({
}) {
return (
<>
-
+