Skip to content

Commit

Permalink
Merge pull request COVID19Tracking#1648 from COVID19Tracking/kevee/ch…
Browse files Browse the repository at this point in the history
…art-map-fix

fix: Change to new positives for map
  • Loading branch information
kevee authored Dec 1, 2020
2 parents 864a33b + c961682 commit fd4fc27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/components/pages/data/charts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ const ChartMap = ({ history, current }) => {
const stateStatus = {}
history.forEach(row => {
const today = current.find(item => item.state === row.state)
stateStatus[row.state] = (today.positive - row.positive) / row.positive
stateStatus[row.state] =
(today.positiveIncrease - row.positiveIncrease) / row.positiveIncrease
})
const totalRising = Object.values(stateStatus).filter(item => item > 0.1)
.length
const totalFalling = Object.values(stateStatus).filter(item => item < 0)
const totalFalling = Object.values(stateStatus).filter(item => item < -0.1)
.length
const totalUnchanged =
Object.keys(stateStatus).length - totalRising - totalFalling
Expand All @@ -170,7 +171,7 @@ const ChartMap = ({ history, current }) => {
mapStyles.state,
state && mapStyles.hasState,
stateStatus[state] > 0.1 && mapStyles.rising,
stateStatus[state] < 0 && mapStyles.falling,
stateStatus[state] < 0.1 && mapStyles.falling,
)}
>
{state && (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/data/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ export const query = graphql`
) {
nodes {
state
positive
positiveIncrease
}
}
allCovidState {
nodes {
state
positive
positiveIncrease
}
}
}
Expand Down

0 comments on commit fd4fc27

Please sign in to comment.