mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
move option to correct namespace (#10613)
* move option to correct namespace * change plugin name from snake_case to camelCase
This commit is contained in:
parent
b0a06d1652
commit
432d1e6a60
@ -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,8 +51,10 @@ const config = {
|
||||
data: data,
|
||||
options: {
|
||||
plugins: {
|
||||
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;
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user