Skip to content

Commit def5a4d

Browse files
authored
Merge pull request #176 from PublicHealthEngland/development
Adjustment to the moving average No conflict detected.
2 parents c5fb446 + 7f1f2b4 commit def5a4d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "covid-public",
3-
"version": "1.7.1",
3+
"version": "1.7.2",
44
"private": true,
55
"homepage": "https://coronavirus.data.gov.uk/",
66
"dependencies": {

src/components/StackedBarChart/StackedBarChart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const getBarChartData = ({ previous, change }) => {
2020
const
2121
previousSorted = fillDateGaps(previous),
2222
changeData = fillDateGaps(change),
23-
sum = previousSorted.map(({ value }, index) => value + changeData[index].value);
23+
filteredChangeData = changeData.map(({ value }) => value > 0 ? value : 0),
24+
sum = previousSorted.map(({ value }, index) => value + filteredChangeData[index] );
2425

2526
return {
2627
labels: previousSorted.map(d => d.date),
@@ -50,8 +51,7 @@ const getBarChartData = ({ previous, change }) => {
5051
{
5152
label: "Newly reported",
5253
backgroundColor: '#5c1955',
53-
data: changeData
54-
.map(({ value }) => value > 0 ? value : 0)
54+
data: filteredChangeData
5555
}
5656
]
5757
}

0 commit comments

Comments
 (0)