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

Add y-axis text label to historical chart under country risk watch #254

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/components/domain/HistoricalDataChart/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"hazardFilterPlaceholder": "All Hazards",
"peopleAffectedLabel": "People Affected",
"fundedLabel": "Funding (CHF)",
"fundingCoverageLabel": "Funding Coverage"
"fundingCoverageLabel": "Funding Coverage",
"peopleExposed": "People Exposed / Affected"
}
}
11 changes: 10 additions & 1 deletion src/components/domain/HistoricalDataChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const validDisastersForChart: Record<number, boolean> = {

const X_AXIS_HEIGHT = 32;
const Y_AXIS_WIDTH = 48;
const CHART_OFFSET = 10;
const CHART_OFFSET = 15;

const chartMargin = {
left: Y_AXIS_WIDTH + CHART_OFFSET,
Expand Down Expand Up @@ -339,6 +339,15 @@ function HistoricalDataChart(props: Props) {
className={styles.chartContainer}
>
<svg className={styles.svg}>
<text
className={styles.yAxisLabel}
textAnchor="middle"
transform={`translate(${(chartMargin.left - CHART_OFFSET) / 2},
${(chartBounds.height - chartMargin.bottom - chartMargin.top) / 2})
rotate(-90)`}
>
{strings.peopleExposed}
</text>
<ChartAxes
xAxisPoints={xAxisPoints}
yAxisPoints={yAxisPoints}
Expand Down
4 changes: 4 additions & 0 deletions src/components/domain/HistoricalDataChart/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
height: 100%;
}

.y-axis-label {
font-size: var(--go-ui-font-size-sm);
fill: var(--go-ui-color-gray-80);
}
.point {
position: absolute;
transform: translate(-50%, -50%);
Expand Down
2 changes: 1 addition & 1 deletion src/views/CountryRiskWatch/ReturnPeriodTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ReturnPeriodTable(props: Props) {
),
createNumberColumn<TransformedReturnPeriodData, string | number>(
'numRiskOfDisplacement',
strings.returnPeriodTableReturnPeriodTitle,
strings.returnPeriodTableDisplacementTitle,
(item) => item.displacement,
{
headerInfoTitle: strings.returnPeriodTableDisplacementTitle,
Expand Down