Skip to content

Commit

Permalink
Handle minus one in data
Browse files Browse the repository at this point in the history
  • Loading branch information
tituomin committed Feb 11, 2022
1 parent e3104c1 commit 3042960
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion analytics/client/src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ export function TransportModeShareMap({ areaType,
const id = d.properties.id;
const area = areasById.get(id);
const val = area.properties.find(v => v.identifier === statisticsKey);
return (val.value - statisticsBoundaries.min) / (statisticsBoundaries.max - statisticsBoundaries.min) * 1000;
if (val.value < 0) {
return 0;
}
const result = 1000 * (val.value - statisticsBoundaries.min) / (
statisticsBoundaries.max - statisticsBoundaries.min);
return result;
};
getFillColor = (d) => {
const id = d.properties.id;
Expand Down
2 changes: 1 addition & 1 deletion analytics/client/src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export function areaTypeStatsBoundaries(areaType, statisticsKey) {
continue;
}
if (value > boundaries.max) { boundaries.max = value; }
if (value < boundaries.min) { boundaries.min = value; }
if (value != -1 && value < boundaries.min) { boundaries.min = value; }
if (identifier === statisticsKey) {
break;
}
Expand Down

0 comments on commit 3042960

Please sign in to comment.