A platform for community discussion. Free, open, simple.
Build(deps): Bump chart.js from 3.5.1 to 4.5.1 (#35358)
dependabot[bot]e74b46b0c17b
diff --git a/frontend/discourse/admin/components/admin-report-chart.gjs b/frontend/discourse/admin/components/admin-report-chart.gjsindex 4f37f36e3d1..fe78fc6c0b3 100644--- a/frontend/discourse/admin/components/admin-report-chart.gjs+++ b/frontend/discourse/admin/components/admin-report-chart.gjs@@ -52,7 +52,7 @@ export default class AdminReportChart extends Component {tooltip: {callbacks: {title: (tooltipItem) =>- moment(tooltipItem[0].label, "YYYY-MM-DD").format("LL"),+ moment(tooltipItem[0].parsed.x).format("LL"),},},legend: {@@ -74,32 +74,28 @@ export default class AdminReportChart extends Component {},},scales: {- y: [- {- display: true,- ticks: {- callback: (label) => number(label),- sampleSize: 5,- maxRotation: 25,- minRotation: 25,- },+ y: {+ display: true,+ ticks: {+ callback: (label) => number(label),+ sampleSize: 5,+ maxRotation: 25,+ minRotation: 25,},- ],- x: [- {- display: true,- gridLines: { display: false },- type: "time",- time: {- unit: Report.unitForGrouping(options.chartGrouping),- },- ticks: {- sampleSize: 5,- maxRotation: 50,- minRotation: 50,- },+ },+ x: {+ display: true,+ grid: { display: false },+ type: "time",+ time: {+ unit: Report.unitForGrouping(options.chartGrouping),+ },+ ticks: {+ sampleSize: 5,+ maxRotation: 50,+ minRotation: 50,},- ],+ },},},};diff --git a/frontend/discourse/admin/components/admin-report-stacked-chart.gjs b/frontend/discourse/admin/components/admin-report-stacked-chart.gjsindex a7fef33f33d..dcc8dbfd4e6 100644--- a/frontend/discourse/admin/components/admin-report-stacked-chart.gjs+++ b/frontend/discourse/admin/components/admin-report-stacked-chart.gjs@@ -55,7 +55,7 @@ export default class AdminReportStackedChart extends Component {return `= ${total}`;},title: (tooltipItem) =>- moment(tooltipItem[0].label, "YYYY-MM-DD").format("LL"),+ moment(tooltipItem[0].parsed.x).format("LL"),},},},@@ -69,33 +69,30 @@ export default class AdminReportStackedChart extends Component {},},scales: {- y: [- {- stacked: true,- display: true,- ticks: {- callback: (label) => number(label),- sampleSize: 5,- maxRotation: 25,- minRotation: 25,- },+ y: {+ stacked: true,+ display: true,+ ticks: {+ callback: (label) => number(label),+ sampleSize: 5,+ maxRotation: 25,+ minRotation: 25,},- ],- x: [- {- display: true,- gridLines: { display: false },- type: "time",- time: {- unit: Report.unitForDatapoints(data.labels.length),- },- ticks: {- sampleSize: 5,- maxRotation: 50,- minRotation: 50,- },+ },+ x: {+ stacked: true,+ display: true,+ grid: { display: false },+ type: "time",+ time: {+ unit: Report.unitForDatapoints(data.labels.length),+ },+ ticks: {+ sampleSize: 5,+ maxRotation: 50,+ minRotation: 50,},- ],+ },},},};diff --git a/frontend/discourse/admin/components/admin-report-stacked-line-chart.gjs b/frontend/discourse/admin/components/admin-report-stacked-line-chart.gjsindex 9e2abc2e11d..0518b4ce82b 100644--- a/frontend/discourse/admin/components/admin-report-stacked-line-chart.gjs+++ b/frontend/discourse/admin/components/admin-report-stacked-line-chart.gjs@@ -55,7 +55,7 @@ export default class AdminReportStackedLineChart extends Component {return `= ${total}`;},title: (tooltipItem) =>- moment(tooltipItem[0].label, "YYYY-MM-DD").format("LL"),+ moment(tooltipItem[0].parsed.x).format("LL"),},},},@@ -69,33 +69,30 @@ export default class AdminReportStackedLineChart extends Component {},},scales: {- y: [- {- stacked: true,- display: true,- ticks: {- callback: (label) => number(label),- sampleSize: 5,- maxRotation: 25,- minRotation: 25,- },+ y: {+ stacked: true,+ display: true,+ ticks: {+ callback: (label) => number(label),+ sampleSize: 5,+ maxRotation: 25,+ minRotation: 25,},- ],- x: [- {- display: true,- gridLines: { display: false },- type: "time",- time: {- unit: Report.unitForDatapoints(chartData[0].data.length),- },- ticks: {- sampleSize: 5,- maxRotation: 50,- minRotation: 50,- },+ },+ x: {+ stacked: true,+ display: true,+ grid: { display: false },+ type: "time",+ time: {+ unit: Report.unitForDatapoints(chartData[0].data.length),+ },+ ticks: {+ sampleSize: 5,+ maxRotation: 50,+ minRotation: 50,},- ],+ },},},};diff --git a/frontend/discourse/app/lib/load-chart-js.js b/frontend/discourse/app/lib/load-chart-js.jsindex 014b7de543a..3523cddf8f8 100644--- a/frontend/discourse/app/lib/load-chart-js.js+++ b/frontend/discourse/app/lib/load-chart-js.js@@ -1,9 +1,14 @@import { waitForPromise } from "@ember/test-waiters";export default async function loadChartJS() {+ await waitForPromise(import("chartjs-adapter-moment"));return (await waitForPromise(import("chart.js/auto"))).default;}+/**+ *+ * @returns {import("chart.js").Plugin}+ */export async function loadChartJSDatalabels() {return (await waitForPromise(import("chartjs-plugin-datalabels"))).default;}diff --git a/frontend/discourse/package.json b/frontend/discourse/package.jsonindex c370d7a3b23..4e5beffb1d8 100644--- a/frontend/discourse/package.json+++ b/frontend/discourse/package.json@@ -42,7 +42,8 @@"@messageformat/core": "^3.4.0","@messageformat/runtime": "^3.0.2","ace-builds": "^1.43.5",- "chart.js": "3.5.1",+ "chart.js": "4.5.1",+ "chartjs-adapter-moment": "^1.0.1","chartjs-plugin-datalabels": "2.2.0","decorator-transforms": "^2.3.1","diff": "^8.0.2",diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/data-explorer-bar-chart.gjs b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/data-explorer-bar-chart.gjsindex 40e4661a0fb..0e18488789a 100644--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/components/data-explorer-bar-chart.gjs+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/components/data-explorer-bar-chart.gjs@@ -45,35 +45,31 @@ export default class DataExplorerBarChart extends Component {get options() {return {- scales: {+ plugins: {legend: {labels: {- fontColor: this.labelsColor,+ color: this.labelsColor,},},- xAxes: [- {- gridLines: {- color: this.gridColor,- zeroLineColor: this.gridColor,- },- ticks: {- fontColor: this.labelsColor,- },+ },+ scales: {+ x: {+ grid: {+ color: this.gridColor,},- ],- yAxes: [- {- gridLines: {- color: this.gridColor,- zeroLineColor: this.gridColor,- },- ticks: {- beginAtZero: true,- fontColor: this.labelsColor,- },+ ticks: {+ color: this.labelsColor,},- ],+ },+ y: {+ grid: {+ color: this.gridColor,+ },+ ticks: {+ beginAtZero: true,+ color: this.labelsColor,+ },+ },},};}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ff77073709f..c7d7dd2e72b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -281,11 +281,14 @@ importers:specifier: ^1.43.5version: 1.43.5chart.js:- specifier: 3.5.1- version: 3.5.1+ specifier: 4.5.1+ version: 4.5.1+ chartjs-adapter-moment:+ specifier: ^1.0.1+ version: 1.0.1([email protected])([email protected])chartjs-plugin-datalabels:specifier: 2.2.0- version: 2.2.0([email protected])+ version: 2.2.0([email protected])decorator-transforms:specifier: ^2.3.1version: 2.3.1(@babel/[email protected])@@ -2496,6 +2499,9 @@ packages:'@keyv/[email protected]':resolution: {integrity: sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==}+ '@kurkle/[email protected]':+ resolution: {integrity: sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==}+'@lint-todo/[email protected]':resolution: {integrity: sha512-F5z53uvRIF4dYfFfJP3a2Cqg+4P1dgJchJsFnsZE0eZp0LK8X7g2J0CsJHRgns+skpXOlM7n5vFGwkWCWj8qJg==}engines: {node: 12.* || >= 14}@@ -3923,8 +3929,15 @@ packages:resolution: {integrity: sha512-wqW3VdPnlSWT4eRiYX+hcs+C6ViBPUWk1qTCd+37qw9kEm/a5n2qcyQDMBWvSYKN/ctqZzeXNQaeBjOetJJUkw==}- resolution: {integrity: sha512-m5kzt72I1WQ9LILwQC4syla/LD/N413RYv2Dx2nnTkRS9iv/ey1xLTt0DnPc/eWV4zI+BgEgDYBIzbQhZHc/PQ==}+ resolution: {integrity: sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==}+ engines: {pnpm: '>=8'}++ resolution: {integrity: sha512-Uz+nTX/GxocuqXpGylxK19YG4R3OSVf8326D+HwSTsNw1LgzyIGRo+Qujwro1wy6X+soNSnfj5t2vZ+r6EaDmA==}+ peerDependencies:+ chart.js: '>=3.0.0'+ moment: ^2.10.2resolution: {integrity: sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw==}@@ -11198,6 +11211,8 @@ snapshots:'@keyv/[email protected]': {}+ '@kurkle/[email protected]': {}+'@lint-todo/[email protected]':dependencies:'@types/eslint': 8.56.12@@ -13091,11 +13106,18 @@ snapshots:dependencies:inherits: 2.0.4- [email protected]: {}+ dependencies:+ '@kurkle/color': 0.3.4++ dependencies:+ chart.js: 4.5.1+ moment: 2.30.1dependencies:- chart.js: 3.5.1+ chart.js: 4.5.1