Skip to content

Commit

Permalink
Update chart.js
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Feb 12, 2025
1 parent e3ab7cc commit dabdeaa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 59 deletions.
22 changes: 14 additions & 8 deletions assets/js/stats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-new */

import Chart from 'chart.js';
import Chart from 'chart.js/auto';

const { epChartData } = window;

Expand All @@ -25,8 +25,6 @@ const barLabels = [];
const barDocs = [];
const barColors = [];

Chart.defaults.global.legend.labels.usePointStyle = true;

barData.forEach(function (data) {
barLabels.push(data[1].name);
barDocs.push(data[1].docs);
Expand All @@ -36,7 +34,7 @@ barData.forEach(function (data) {
const documentChart = document.getElementById('documentChart');
if (documentChart) {
new Chart(documentChart, {
type: 'horizontalBar',
type: 'bar',
data: {
labels: barLabels,
datasets: [
Expand All @@ -48,8 +46,11 @@ if (documentChart) {
],
},
options: {
legend: {
display: false,
indexAxis: 'y',
plugins: {
legend: {
display: false,
},
},
title: {
display: true,
Expand Down Expand Up @@ -77,8 +78,13 @@ if (queriesTotalChart) {
title: {
display: true,
},
legend: {
position: 'right',
plugins: {
legend: {
position: 'right',
labels: {
usePointStyle: true,
},
},
},
tooltips: {
callbacks: {
Expand Down
81 changes: 31 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@10up/component-tooltip": "^2.0.0",
"@hello-pangea/dnd": "^16.6.0",
"@wordpress/icons": "^10.13.0",
"chart.js": "^2.9.4",
"chart.js": "^4.4.7",
"focus-trap-react": "^11.0.3",
"react-slider": "^2.0.6",
"uuid": "^11.0.5"
Expand Down

0 comments on commit dabdeaa

Please sign in to comment.