Skip to content

Commit

Permalink
✨ (grapher) increase padding between line label and annotation (#3994)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann authored Oct 1, 2024
1 parent 1feb245 commit bdb652d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/@ourworldindata/grapher/src/lineLegend/LineLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { darkenColorForText } from "../color/ColorUtils"
const LEGEND_ITEM_MIN_SPACING = 2
// Horizontal distance from the end of the chart to the start of the marker
const MARKER_MARGIN = 4
// Space between the label and the annotation
const ANNOTATION_PADDING = 2

const DEFAULT_FONT_WEIGHT = 400

Expand Down Expand Up @@ -144,7 +146,9 @@ class Label extends React.Component<{
{series.annotationTextWrap &&
series.annotationTextWrap.render(
needsLines ? markerX2 + MARKER_MARGIN : markerX1,
series.bounds.y + series.textWrap.height,
series.bounds.y +
series.textWrap.height +
ANNOTATION_PADDING,
{
id: makeIdForHumanConsumption("annotation"),
textProps: {
Expand Down Expand Up @@ -226,7 +230,9 @@ export class LineLegend extends React.Component<{
),
height:
textWrap.height +
(annotationTextWrap ? annotationTextWrap.height : 0),
(annotationTextWrap
? ANNOTATION_PADDING + annotationTextWrap.height
: 0),
}
})
}
Expand Down

0 comments on commit bdb652d

Please sign in to comment.