Bump chart.js from 2.9.4 to 3.0.2 (#13244)

* Bump chart.js from 2.9.4 to 3.0.2

Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 3.0.2.
- [Release notes](https://github.com/chartjs/Chart.js/releases)
- [Commits](https://github.com/chartjs/Chart.js/compare/v2.9.4...v3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix issues in migration to 3x of chart.js

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
This commit is contained in:
dependabot[bot] 2021-04-08 10:46:32 +02:00 committed by GitHub
parent aa0423cf1b
commit 1522b6d41e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 45 deletions

View file

@ -40,8 +40,10 @@ function writeCards(data, timeRangeLabel) {
function drawChart({ canvas, title, labels, datasets }) {
const options = {
legend: {
position: 'bottom',
plugins: {
legend: {
position: 'top',
},
},
responsive: true,
title: {
@ -49,28 +51,46 @@ function drawChart({ canvas, title, labels, datasets }) {
text: title,
},
scales: {
yAxes: [
{
ticks: {
suggestedMin: 0,
precision: 0,
},
y: {
type: 'linear',
suggestedMin: 0,
ticks: {
precision: 0,
},
],
},
},
};
import('chart.js').then(({ Chart }) => {
// eslint-disable-next-line no-new
new Chart(canvas, {
type: 'line',
data: {
labels,
datasets,
options,
},
});
});
import('chart.js').then(
({
Chart,
LineController,
LinearScale,
CategoryScale,
PointElement,
LineElement,
Legend,
}) => {
Chart.register(
LineController,
LinearScale,
CategoryScale,
PointElement,
LineElement,
Legend,
);
// eslint-disable-next-line no-new
new Chart(canvas, {
type: 'line',
data: {
labels,
datasets,
options,
},
});
},
);
}
function drawCharts(data, timeRangeLabel) {
@ -94,6 +114,7 @@ function drawCharts(data, timeRangeLabel) {
data: reactions,
fill: false,
borderColor: 'rgb(75, 192, 192)',
backgroundColor: 'rgb(75, 192, 192)',
lineTension: 0.1,
},
{
@ -101,6 +122,7 @@ function drawCharts(data, timeRangeLabel) {
data: likes,
fill: false,
borderColor: 'rgb(229, 100, 100)',
backgroundColor: 'rgb(229, 100, 100)',
lineTension: 0.1,
},
{
@ -108,6 +130,7 @@ function drawCharts(data, timeRangeLabel) {
data: unicorns,
fill: false,
borderColor: 'rgb(157, 57, 233)',
backgroundColor: 'rgb(157, 57, 233)',
lineTension: 0.1,
},
{
@ -115,6 +138,7 @@ function drawCharts(data, timeRangeLabel) {
data: readingList,
fill: false,
borderColor: 'rgb(10, 133, 255)',
backgroundColor: 'rgb(10, 133, 255)',
lineTension: 0.1,
},
],
@ -130,6 +154,7 @@ function drawCharts(data, timeRangeLabel) {
data: comments,
fill: false,
borderColor: 'rgb(75, 192, 192)',
backgroundColor: 'rgb(75, 192, 192)',
lineTension: 0.1,
},
],
@ -145,6 +170,7 @@ function drawCharts(data, timeRangeLabel) {
data: followers,
fill: false,
borderColor: 'rgb(10, 133, 255)',
backgroundColor: 'rgb(10, 133, 255)',
lineTension: 0.1,
},
],
@ -160,6 +186,7 @@ function drawCharts(data, timeRangeLabel) {
data: readers,
fill: false,
borderColor: 'rgb(157, 57, 233)',
backgroundColor: 'rgb(157, 57, 233)',
lineTension: 0.1,
},
],

View file

@ -158,7 +158,7 @@
"autoprefixer": "^10.2.5",
"babel-preset-preact": "^2.0.0",
"canvas": "^2.7.0",
"chart.js": "^2.9.4",
"chart.js": "^3.0.2",
"clipboard-polyfill": "^3.0.2",
"core-js": "3",
"file-loader": "^6.2.0",

View file

@ -6448,28 +6448,10 @@ charenc@0.0.2:
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
chart.js@^2.9.4:
version "2.9.4"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.9.4.tgz#0827f9563faffb2dc5c06562f8eb10337d5b9684"
integrity sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==
dependencies:
chartjs-color "^2.1.0"
moment "^2.10.2"
chartjs-color-string@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz#1df096621c0e70720a64f4135ea171d051402f71"
integrity sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==
dependencies:
color-name "^1.0.0"
chartjs-color@^2.1.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.4.1.tgz#6118bba202fe1ea79dd7f7c0f9da93467296c3b0"
integrity sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==
dependencies:
chartjs-color-string "^0.6.0"
color-convert "^1.9.3"
chart.js@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-3.0.2.tgz#5893b0548714445b5190cbda9ac307357a56a0c7"
integrity sha512-DR0GmFSlxcFJp/w//ZmbxSduAkH/AqwxoiZxK97KHnWZf6gvsKWS3160WvNMMHYvzW9OXqGWjPjVh1Qu+xDabg==
check-more-types@^2.24.0:
version "2.24.0"
@ -6748,7 +6730,7 @@ collection-visit@^1.0.0:
map-visit "^1.0.0"
object-visit "^1.0.0"
color-convert@^1.3.0, color-convert@^1.8.2, color-convert@^1.9.0, color-convert@^1.9.1, color-convert@^1.9.3:
color-convert@^1.3.0, color-convert@^1.8.2, color-convert@^1.9.0, color-convert@^1.9.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
@ -13331,7 +13313,7 @@ mobx@^6.0.4:
resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.1.8.tgz#5d03cb76d8f7694dd82bfb2578d886945b66450d"
integrity sha512-U4yCvUeh6yKXRwFxm2lyJjXPVekOEar/R8ZKWAXem/3fthJqYflViawfjDAUh7lZEvbKqljC3NT/pSaUKpE+gg==
moment@^2.10.2, moment@^2.29.1:
moment@^2.29.1:
version "2.29.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==