Skip to content

Commit

Permalink
🐛 (static-chart) prevent DoD from overflowing
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Dec 4, 2023
1 parent c15d0c6 commit ec64f36
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,12 @@ export class Grapher
return uniqueDetails
}

// Used for static exports. Defined at this level because they need to
// Used for static charts. Defined at this level because they need to
// be accessed by CaptionedChart and DownloadModal
@computed get detailRenderers(): MarkdownTextWrap[] {
const activeBounds = this.isExportingToSvgOrPng
? this.boundsForExport
: this.tabBounds
return [...this.detailsOrderedByReference].map((term, i) => {
let text = `**${i + 1}.** `
const detail: EnrichedDetail = window.details?.[term]
Expand All @@ -1263,9 +1266,7 @@ export class Grapher
text,
fontSize: 12,
// leave room for padding on the left and right
maxWidth:
this.boundsForExport.width -
2 * this.framePaddingHorizontal,
maxWidth: activeBounds.width - 2 * this.framePaddingHorizontal,
lineHeight: 1.2,
style: {
fill: GRAPHER_DARK_TEXT,
Expand Down

0 comments on commit ec64f36

Please sign in to comment.