diff --git a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
index 99314571805..c815f0d0728 100644
--- a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
+++ b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
@@ -58,7 +58,7 @@ import {
} from "../chart/ChartUtils"
import { AxisConfig } from "../axis/AxisConfig"
import { VerticalAxis } from "../axis/Axis"
-import { VerticalAxisComponent } from "../axis/AxisViews"
+import { VerticalAxisComponent, VerticalAxisGridLines } from "../axis/AxisViews"
import { NoDataSection } from "../scatterCharts/NoDataSection"
import { CategoricalColorAssigner } from "../color/CategoricalColorAssigner"
import { ColorScheme } from "../color/ColorScheme"
@@ -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()
}
}
@@ -1334,10 +1348,7 @@ function Slope({
: NON_FOCUSED_LINE_COLOR
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"
+ />
)
})}
@@ -1448,7 +1453,14 @@ function MarkX({
}) {
return (
<>
-
+