Browse Source

next upd

main
gsd 11 hours ago
parent
commit
9ad8284716
  1. 7
      chartGenerator.js
  2. 8
      utils.js

7
chartGenerator.js

@ -72,7 +72,7 @@ const customLabelsPlugin = {
ctx.save(); ctx.save();
labels.forEach((label, i) => { labels.forEach((label, i) => {
const p = r.getPointPosition(i, r.drawingArea + 50); const p = r.getPointPosition(i, r.drawingArea + 40);
const align = getTextAlignByPoint(p, r); const align = getTextAlignByPoint(p, r);
const lines = Array.isArray(label) ? label : [label]; const lines = Array.isArray(label) ? label : [label];
@ -160,7 +160,7 @@ function generateChartData(d) {
responsive: false, responsive: false,
maintainAspectRatio: false, maintainAspectRatio: false,
layout: { layout: {
padding: 110 padding: 130
}, },
plugins: { plugins: {
legend: { legend: {
@ -217,4 +217,5 @@ function test() {
out.on('finish', () => console.log('The chart image was saved.')); out.on('finish', () => console.log('The chart image was saved.'));
} }
//test() if (process.env.TEST)
test()

8
utils.js

@ -29,14 +29,14 @@ function formatSeconds(totalSeconds) {
const lastTwoDigits = days % 100; const lastTwoDigits = days % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 14) { if (lastTwoDigits >= 11 && lastTwoDigits <= 14) {
dayWord = ней"; dayWord = "д";
} else { } else {
switch (lastDigit) { switch (lastDigit) {
case 1: dayWord = ень"; break; case 1: dayWord = "д"; break;
case 2: case 2:
case 3: case 3:
case 4: dayWord = ня"; break; case 4: dayWord = "д"; break;
default: dayWord = ней"; default: dayWord = "д";
} }
} }

Loading…
Cancel
Save