Skip to content

Commit

Permalink
🐛 (discrete bar) fix broken layout
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Feb 26, 2024
1 parent fbd1b4a commit 7f52d6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/@ourworldindata/grapher/src/axis/AxisViews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ export class HorizontalAxisZeroLine extends React.Component<{
}> {
render(): JSX.Element {
const { bounds, horizontalAxis, strokeWidth } = this.props
const axis = horizontalAxis.clone()
axis.range = bounds.xRange()

return (
<g
Expand All @@ -138,9 +136,9 @@ export class HorizontalAxisZeroLine extends React.Component<{
)}
>
<line
x1={axis.place(0)}
x1={horizontalAxis.place(0)}
y1={bounds.bottom.toFixed(2)}
x2={axis.place(0)}
x2={horizontalAxis.place(0)}
y2={bounds.top.toFixed(2)}
stroke={SOLID_TICK_COLOR}
strokeWidth={strokeWidth}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ export class DiscreteBarChart
@computed private get xRange(): [number, number] {
return [
this.boundsWithoutColorLegend.left +
this.seriesLegendWidth +
this.leftValueLabelWidth,
Math.max(this.seriesLegendWidth, this.leftValueLabelWidth),
this.boundsWithoutColorLegend.right - this.rightValueLabelWidth,
]
}
Expand Down

0 comments on commit 7f52d6c

Please sign in to comment.