]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
move option to correct namespace (#10613)
authorJacco van den Berg <jaccoberg2281@gmail.com>
Mon, 22 Aug 2022 20:44:04 +0000 (22:44 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Aug 2022 20:44:04 +0000 (22:44 +0200)
* move option to correct namespace

* change plugin name from snake_case to camelCase

docs/configuration/canvas-background.md
docs/developers/plugins.md

index da937ded13ce6c8480f0e8ffbed7c9a6370edda9..60e6b03162502c77ac378bd096240efff9bf6064 100644 (file)
@@ -33,7 +33,7 @@ const data = {
 // <block:plugin:2>
 // Note: changes to the plugin code is not reflected to the chart, because the plugin is loaded at chart construction time and editor changes only trigger an chart.update().
 const plugin = {
-  id: 'custom_canvas_background_color',
+  id: 'customCanvasBackgroundColor',
   beforeDraw: (chart, args, options) => {
     const {ctx} = chart;
     ctx.save();
@@ -51,7 +51,9 @@ const config = {
   data: data,
   options: {
     plugins: {
-      color: 'lightGreen',
+      customCanvasBackgroundColor: {
+        color: 'lightGreen',
+      }
     }
   },
   plugins: [plugin],
@@ -95,7 +97,7 @@ const image = new Image();
 image.src = 'https://www.chartjs.org/img/chartjs-logo.svg';
 
 const plugin = {
-  id: 'custom_canvas_background_image',
+  id: 'customCanvasBackgroundImage',
   beforeDraw: (chart) => {
     if (image.complete) {
       const ctx = chart.ctx;
index bc4cbeb9e73bc032da6378c1af0250717a4c8038..9e967a8874a26ae7f381b2b311e6e5ab5d2667b6 100644 (file)
@@ -195,7 +195,7 @@ import {ChartType, Plugin} from 'chart.js';
 
 declare module 'chart.js' {
   interface PluginOptionsByType<TType extends ChartType> {
-    custom_canvas_background_color?: {
+    customCanvasBackgroundColor?: {
       color?: string
     }
   }