From 8e88d9fe71bc1e2786e5da5460faed4bfc90b736 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Fri, 8 Apr 2022 22:39:47 +0200 Subject: [PATCH 1/3] require at least chartjs v3.7 --- docs/guide/migrationV2.md | 4 ++++ src/annotation.js | 14 -------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/guide/migrationV2.md b/docs/guide/migrationV2.md index c98540f30..c28a5c0e9 100644 --- a/docs/guide/migrationV2.md +++ b/docs/guide/migrationV2.md @@ -2,6 +2,10 @@ `chartjs-plugin-annotation` plugin version 2 introduces a number of breaking changes. In order to improve performance, offer new features, and improve maintainability, it was necessary to break backwards compatibility, but we aimed to do so only when worth the benefit. +## Chart.js version + +The annotation plugin requires at least version 3.7.0 to work because of some bug fixes that happend within chart.js itself. + ## Options A number of changes were made to the configuration options passed to the plugin configuration. Those changes are documented below. diff --git a/src/annotation.js b/src/annotation.js index 7e4260ecf..d6bf8edc3 100644 --- a/src/annotation.js +++ b/src/annotation.js @@ -14,26 +14,12 @@ export default { version, - /* TODO: enable in v2 beforeRegister() { requireVersion('chart.js', '3.7', Chart.version); }, - */ afterRegister() { Chart.register(annotationTypes); - - // TODO: Remove this check, warning and workaround in v2 - if (!requireVersion('chart.js', '3.7', Chart.version, false)) { - console.warn(`${name} has known issues with chart.js versions prior to 3.7, please consider upgrading.`); - - // Workaround for https://github.com/chartjs/chartjs-plugin-annotation/issues/572 - Chart.defaults.set('elements.lineAnnotation', { - callout: {}, - font: {}, - padding: 6 - }); - } }, afterUnregister() { From 76392e09f6815852b21a2943f4e68c69aabfab95 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Fri, 8 Apr 2022 22:46:29 +0200 Subject: [PATCH 2/3] remove unused var --- src/annotation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/annotation.js b/src/annotation.js index d6bf8edc3..45d25ab69 100644 --- a/src/annotation.js +++ b/src/annotation.js @@ -5,7 +5,7 @@ import {adjustScaleRange, verifyScaleOptions} from './scale'; import {updateElements, resolveType} from './elements'; import {annotationTypes} from './types'; import {requireVersion} from './helpers'; -import {name, version} from '../package.json'; +import {version} from '../package.json'; const chartStates = new Map(); From 0b8dc7b2d89727bb9cea5e0f9176590f921c7a1a Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Fri, 8 Apr 2022 22:58:37 +0200 Subject: [PATCH 3/3] require chart.js v3.7 as peer dependency and dev dependency minimum --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7b7958d8..de1df5e9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@simonbrunel/vuepress-plugin-versions": "^0.2.0", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", - "chart.js": "^3.1.0", + "chart.js": "^3.7.0", "chartjs-plugin-autocolors": "^0.0.5", "chartjs-test-utils": "^0.4.0", "concurrently": "^7.0.0", @@ -44,7 +44,7 @@ "vuepress-theme-chartjs": "^0.2.0" }, "peerDependencies": { - "chart.js": "^3.1.0" + "chart.js": "^3.7.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index 7ade536b1..29b82b0aa 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@simonbrunel/vuepress-plugin-versions": "^0.2.0", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", - "chart.js": "^3.1.0", + "chart.js": "^3.7.0", "chartjs-plugin-autocolors": "^0.0.5", "chartjs-test-utils": "^0.4.0", "concurrently": "^7.0.0", @@ -68,6 +68,6 @@ "vuepress-theme-chartjs": "^0.2.0" }, "peerDependencies": { - "chart.js": "^3.1.0" + "chart.js": "^3.7.0" } }