We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8b25a5f + 2203ad0 commit 3698ef3Copy full SHA for 3698ef3
lib/cli/chart.js
@@ -1,11 +1,13 @@
1
const chart = require('asciichart');
2
3
-// generate chart for caes or deaths
+// generate chart for cases or deaths
4
exports.generate = (data, type = 'cases') => {
5
+ const maxLength = Object.values(data.timeline[type])
6
+ .reduce((a,c) => Math.max(a, c.toFixed().length), 0)
7
const config = {
8
height: 7,
- format: (x, i) => (' ' + x.toFixed(0)).slice(-' '.length)
9
+ format: (x, i) => x.toFixed().padStart(maxLength)
10
};
11
chartData = Object.values(data.timeline[type]).flat();
12
return chart.plot(chartData, config);
-}
13
+}
0 commit comments