diff options
Diffstat (limited to 'assets/main.js')
-rw-r--r-- | assets/main.js | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/assets/main.js b/assets/main.js index 4662482..bc5d65c 100644 --- a/assets/main.js +++ b/assets/main.js @@ -209,44 +209,34 @@ function show_statistics() { }, options: { - responsive: true, - tooltips: { - mode: 'nearest', + interaction: { intersect: false, - callbacks: { - title: (tooltipItem, data) => { - return capitalize(prettyPrintMonth(tooltipItem[0].xLabel)) - }, - label: (tooltipItem, data) => { - let label = data.datasets[tooltipItem.datasetIndex].label || '' - if (label) { - label += ': ' - } - label += `${tooltipItem.yLabel} €` - return label - } - } - }, - hover: { - mode: 'nearest', - intersect: true }, scales: { - xAxes: [ - { - ticks: { - callback: prettyPrintMonth - } + x: { + ticks: { + callback: index => prettyPrintMonth(dates[index]) } - ], - yAxes: [ - { - ticks: { - beginAtZero: true, - callback: value => `${value} €` + }, + y: { + ticks: { + beginAtZero: true, + callback: value => `${value.toLocaleString('fr-FR')} €` + } + } + }, + plugins: { + tooltip: { + callbacks: { + title: items => capitalize(prettyPrintMonth(items[0].label)), + label: item => { + let label = item.dataset.label || '' + if (label) label += ': ' + label += `${item.raw.toLocaleString('fr-FR')} €` + return label } } - ] + } } } }) |