Skip to content

Commit

Permalink
馃憣 IMPROVE: Single or Stacked bars
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadawais committed Apr 23, 2020
1 parent 0a1c934 commit 757af7a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions utils/getBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ module.exports = async (spinner, countryName, states, { bar, log, sortBy, limit,
}
// Format Stack Data
barCountries = {};
allCountries.map((country, count)=>{
barCountries[country.country]=[
logScale(country.cases),
logScale(country.deaths),
logScale(country.recovered)
];
});
allCountries.map(country => {
if (customSort) {
barCountries[country.country] = [
logScale(country[sortingKeys[sortBy]])
];
} else {
barCountries[country.country] = [
logScale(country.cases),
logScale(country.deaths),
logScale(country.recovered)
];
}
});

const names = Object.keys(barCountries);
const data = Object.values(barCountries);
Expand Down

0 comments on commit 757af7a

Please sign in to comment.