]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add colors plugin TS options to be configured (#11115)
authorJacco van den Berg <jaccoberg2281@gmail.com>
Tue, 7 Feb 2023 13:19:00 +0000 (14:19 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Feb 2023 13:19:00 +0000 (08:19 -0500)
src/types/index.d.ts
test/types/plugins/plugin.colors/colors.ts [new file with mode: 0644]

index da4ab6a130cf92a2c8cc3edd8c2871b0a2c38eb3..9dbf5b1debf9140a143e1a663b0f2eff0e715987 100644 (file)
@@ -12,6 +12,7 @@ import {ChartArea, Padding, Point} from './geometric.js';
 import {LayoutItem, LayoutPosition} from './layout.js';
 import {RenderTextOpts} from './helpers/helpers.canvas.js';
 import {CanvasFontSpec} from '../helpers/helpers.options.js';
+import type {ColorsPluginOptions} from '../plugins/plugin.colors.js';
 
 export {EasingFunction} from '../helpers/helpers.easing.js';
 export {default as ArcElement, ArcProps} from '../elements/element.arc.js';
@@ -2791,6 +2792,7 @@ export interface TooltipItem<TType extends ChartType> {
 }
 
 export interface PluginOptionsByType<TType extends ChartType> {
+  colors: ColorsPluginOptions;
   decimation: DecimationOptions;
   filler: FillerOptions;
   legend: LegendOptions<TType>;
diff --git a/test/types/plugins/plugin.colors/colors.ts b/test/types/plugins/plugin.colors/colors.ts
new file mode 100644 (file)
index 0000000..180709b
--- /dev/null
@@ -0,0 +1,19 @@
+import { Chart } from '../../../../src/types.js';
+
+const chart = new Chart('id', {
+  type: 'bubble',
+  data: {
+    labels: [],
+    datasets: [{
+      data: []
+    }]
+  },
+  options: {
+    plugins: {
+      colors: {
+        enabled: true,
+        forceOverride: false,
+      }
+    }
+  }
+});