DEV: updates chart.js to 3.5.1 (#14107)

This commit is contained in:
Joffrey JAFFEUX
2021-08-23 13:49:49 +02:00
committed by GitHub
parent cb59681d86
commit d7c185bf3d
16 changed files with 160 additions and 118 deletions
@@ -27,14 +27,16 @@ export default Component.extend({
data: data,
options: {
responsive: true,
tooltips: {
callbacks: {
title: (context) =>
moment(context[0].xLabel, "YYYY-MM-DD").format("LL"),
plugins: {
tooltip: {
callbacks: {
title: (context) =>
moment(context[0].label, "YYYY-MM-DD").format("LL"),
},
},
},
scales: {
yAxes: [
y: [
{
display: true,
ticks: {
@@ -112,14 +112,16 @@ export default Component.extend({
type: "line",
data,
options: {
tooltips: {
callbacks: {
title: (tooltipItem) =>
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"),
plugins: {
tooltip: {
callbacks: {
title: (tooltipItem) =>
moment(tooltipItem[0].label, "YYYY-MM-DD").format("LL"),
},
},
legend: {
display: false,
},
},
legend: {
display: false,
},
responsive: true,
maintainAspectRatio: false,
@@ -136,15 +138,10 @@ export default Component.extend({
},
},
scales: {
yAxes: [
y: [
{
display: true,
ticks: {
userCallback: (label) => {
if (Math.floor(label) === label) {
return label;
}
},
callback: (label) => number(label),
sampleSize: 5,
maxRotation: 25,
@@ -152,7 +149,7 @@ export default Component.extend({
},
},
],
xAxes: [
x: [
{
display: true,
gridLines: { display: false },
@@ -89,21 +89,24 @@ export default Component.extend({
animation: {
duration: 0,
},
tooltips: {
mode: "index",
intersect: false,
callbacks: {
beforeFooter: (tooltipItem) => {
let total = 0;
tooltipItem.forEach(
(item) => (total += parseInt(item.yLabel || 0, 10))
);
return `= ${total}`;
plugins: {
tooltip: {
mode: "index",
intersect: false,
callbacks: {
beforeFooter: (tooltipItem) => {
let total = 0;
tooltipItem.forEach(
(item) => (total += parseInt(item.parsed.y || 0, 10))
);
return `= ${total}`;
},
title: (tooltipItem) =>
moment(tooltipItem[0].label, "YYYY-MM-DD").format("LL"),
},
title: (tooltipItem) =>
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"),
},
},
layout: {
padding: {
left: 0,
@@ -113,16 +116,11 @@ export default Component.extend({
},
},
scales: {
yAxes: [
y: [
{
stacked: true,
display: true,
ticks: {
userCallback: (label) => {
if (Math.floor(label) === label) {
return label;
}
},
callback: (label) => number(label),
sampleSize: 5,
maxRotation: 25,
@@ -130,8 +128,7 @@ export default Component.extend({
},
},
],
xAxes: [
x: [
{
display: true,
gridLines: { display: false },