Skip to content

Commit 757af7a

Browse files
committed
👌 IMPROVE: Single or Stacked bars
1 parent 0a1c934 commit 757af7a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

utils/getBar.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ module.exports = async (spinner, countryName, states, { bar, log, sortBy, limit,
3838
}
3939
// Format Stack Data
4040
barCountries = {};
41-
allCountries.map((country, count)=>{
42-
barCountries[country.country]=[
43-
logScale(country.cases),
44-
logScale(country.deaths),
45-
logScale(country.recovered)
46-
];
47-
});
41+
allCountries.map(country => {
42+
if (customSort) {
43+
barCountries[country.country] = [
44+
logScale(country[sortingKeys[sortBy]])
45+
];
46+
} else {
47+
barCountries[country.country] = [
48+
logScale(country.cases),
49+
logScale(country.deaths),
50+
logScale(country.recovered)
51+
];
52+
}
53+
});
4854

4955
const names = Object.keys(barCountries);
5056
const data = Object.values(barCountries);

0 commit comments

Comments
 (0)