Skip to content

Commit d84eb21

Browse files
authored
Merge pull request #295 from IFRCGo/fix/missing-changes-bugs
Add legends in region risk watch
2 parents b08195d + 68030d1 commit d84eb21

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/views/CountryRiskWatch/RiskBarChart/WildfireChart/i18n.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"average": "Average (2003 - {currentYear})",
55
"year": "Year {currentYear}",
66
"minMax": "Min-max (2003 - {currentYear})",
7-
"minMaxValue": "{min} - {max}"
7+
"minMaxValue": "{min} - {max}",
8+
"monthlySeverityRating": "Monthly Severity Rating"
89
}
910
}

src/views/CountryRiskWatch/RiskBarChart/WildfireChart/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ type GetCountryRisk = paths['/api/v1/country-seasonal/']['get'];
3939
type CountryRiskResponse = GetCountryRisk['responses']['200']['content']['application/json'];
4040
type RiskData = CountryRiskResponse[number];
4141

42-
const X_AXIS_HEIGHT = 24;
43-
const Y_AXIS_WIDTH = 32;
42+
const X_AXIS_HEIGHT = 32;
43+
const Y_AXIS_WIDTH = 48;
4444
const CHART_OFFSET = 0;
4545

4646
const chartMargin = {
@@ -220,6 +220,16 @@ function WildfireChart(props: Props) {
220220
ref={chartContainerRef}
221221
>
222222
<svg className={styles.svg}>
223+
{/* FIXME: Use a separate component for chart label */}
224+
<text
225+
className={styles.yAxisLabel}
226+
textAnchor="middle"
227+
transform={`translate(${(chartMargin.left - CHART_OFFSET) / 3},
228+
${(chartBounds.height - chartMargin.bottom - chartMargin.top) / 2})
229+
rotate(-90)`}
230+
>
231+
{strings.monthlySeverityRating}
232+
</text>
223233
<ChartAxes
224234
xAxisPoints={points.xAxis}
225235
yAxisPoints={points.yAxis}

src/views/CountryRiskWatch/RiskBarChart/WildfireChart/styles.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
width: 100%;
77
height: 100%;
88

9+
.y-axis-label {
10+
font-size: var(--go-ui-font-size-sm);
11+
fill: var(--go-ui-color-gray-80);
12+
}
13+
914
.min-max-path {
1015
fill-opacity: 0.5;
1116
pointer-events: none;

0 commit comments

Comments
 (0)