Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ (facets) improve svg structure for figma #4539

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/@ourworldindata/grapher/src/facetChart/FacetChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
HorizontalAlign,
Color,
uniq,
makeIdForHumanConsumption,
} from "@ourworldindata/utils"
import { shortenForTargetWidth } from "@ourworldindata/components"
import { action, computed, observable } from "mobx"
Expand Down Expand Up @@ -143,6 +144,10 @@ export class FacetChart
return this.props.chartTypeName ?? GRAPHER_CHART_TYPES.LineChart
}

@computed get isStatic(): boolean {
return !!this.manager.isStatic
}

@computed get failMessage(): string {
return ""
}
Expand Down Expand Up @@ -267,6 +272,7 @@ export class FacetChart
missingDataStrategy,
backgroundColor,
focusArray,
isStatic,
} = manager

// Use compact labels, e.g. 50k instead of 50,000.
Expand Down Expand Up @@ -324,6 +330,7 @@ export class FacetChart
backgroundColor,
hideNoDataSection,
focusArray,
isStatic,
...series.manager,
xAxisConfig: {
...globalXAxisConfig,
Expand Down Expand Up @@ -896,10 +903,12 @@ export class FacetChart
{shortenedLabel}
<title>{seriesName}</title>
</text>
<ChartClass
bounds={bounds}
manager={facetChart.manager}
/>
<g id={makeIdForHumanConsumption(seriesName)}>
<ChartClass
bounds={bounds}
manager={facetChart.manager}
/>
</g>
</React.Fragment>
)
})}
Expand Down