]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Bug/Radial linear scale grid get correct options at index (#10010)
authorJacco van den Berg <jaccoberg2281@gmail.com>
Wed, 3 Aug 2022 00:32:02 +0000 (02:32 +0200)
committerGitHub <noreply@github.com>
Wed, 3 Aug 2022 00:32:02 +0000 (02:32 +0200)
* get correct options for index

* update test

* add initial migration guide

docs/.vuepress/config.js
docs/migration/v3-migration.md [moved from docs/getting-started/v3-migration.md with 100% similarity]
docs/migration/v4-migration.md [new file with mode: 0644]
src/scales/scale.radialLinear.js
test/fixtures/scale.radialLinear/gridlines-scriptable.png
test/fixtures/scale.radialLinear/indexable-gridlines.png

index 142122bc3be1e1e5d73f59c984d8b13512236e8d..9da6f6ce967c47f5112763eeb6149836fb765a2e 100644 (file)
@@ -294,7 +294,6 @@ module.exports = {
             'getting-started/installation',
             'getting-started/integration',
             'getting-started/usage',
-            'getting-started/v3-migration'
           ]
         },
         {
@@ -382,6 +381,13 @@ module.exports = {
             'developers/updates',
           ]
         },
+        {
+          title: 'Migration',
+          children: [
+            'migration/v4-migration',
+            'migration/v3-migration',
+          ]
+        },
       ],
     }
   }
diff --git a/docs/migration/v4-migration.md b/docs/migration/v4-migration.md
new file mode 100644 (file)
index 0000000..71810e9
--- /dev/null
@@ -0,0 +1,13 @@
+# 4.x Migration Guide
+
+Chart.js 4.0 introduces a number of breaking changes. We tried keeping the amount of breaking changes to a minimum. For some features and bug fixes it was necessary to break backwars compatibility, but we aimed to do so only when worth the benefit.
+
+## End user migration
+
+### Options
+
+A number of changes were made to the configuration options passed to the `Chart` constructor. Those changes are documented below.
+
+#### Specific changes
+
+* The radialLinear grid indexable and scriptable options don't decrease the index of the specified grid line anymore.
index 724a4be4e6755f45f58b1a9f0cf6b6ac9ba049ce..bd3f47354989ada1a11249e3347b639a667f36b3 100644 (file)
@@ -468,7 +468,7 @@ export default class RadialLinearScale extends LinearScaleBase {
       this.ticks.forEach((tick, index) => {
         if (index !== 0) {
           offset = this.getDistanceFromCenterForValue(tick.value);
-          const optsAtIndex = grid.setContext(this.getContext(index - 1));
+          const optsAtIndex = grid.setContext(this.getContext(index));
           drawRadiusLine(this, optsAtIndex, offset, labelCount);
         }
       });
index c25ff9483a3b8c3419e7d5c8b1e1d9e19ea19b26..7cbf28962de68298ba88bf742ebca58af3c86cea 100644 (file)
Binary files a/test/fixtures/scale.radialLinear/gridlines-scriptable.png and b/test/fixtures/scale.radialLinear/gridlines-scriptable.png differ
index bc6aca2a522adbbf8ab78f87cd28ec6111402bbc..55f39c6991a37913bc0c359a8b3febd1e7d455bb 100644 (file)
Binary files a/test/fixtures/scale.radialLinear/indexable-gridlines.png and b/test/fixtures/scale.radialLinear/indexable-gridlines.png differ