uninstall?(chart: Chart, args: EmptyObject, options: O): void;
}
-export declare type ChartComponentLike = ChartComponent | ChartComponent[] | { [key: string]: ChartComponent };
+export declare type ChartComponentLike = ChartComponent | ChartComponent[] | { [key: string]: ChartComponent } | Plugin | Plugin[];
/**
* Please use the module's default export which provides a singleton instance
onClick(event: ChartEvent, elements: ActiveElement[], chart: Chart): void;
layout: {
- padding: Scriptable<number | ChartArea, ScriptableContext<TType>>;
+ padding: Scriptable<number | Partial<ChartArea>, ScriptableContext<TType>>;
};
}
* @default 'rgba(0, 0, 0, 0.8)'
*/
backgroundColor: Scriptable<Color, ScriptableTooltipContext<TType>>;
+ /**
+ * Padding between the color box and the text.
+ * @default 1
+ */
+ boxPadding: number;
/**
* Color of title
* @default '#fff'
family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
size: 10
};
+
+Chart.defaults.layout = {
+ padding: {
+ bottom: 10,
+ },
+};
+
+Chart.defaults.plugins.tooltip.boxPadding = 3;
--- /dev/null
+import { Chart } from '../../index.esm';
+
+Chart.register({
+ id: 'my-plugin',
+ afterDraw: (chart: Chart) => {
+ // noop
+ }
+});
+
+Chart.register([{
+ id: 'my-plugin',
+ afterDraw: (chart: Chart) => {
+ // noop
+ },
+}]);
+
+// @ts-expect-error not assignable
+Chart.register({
+ id: 'fail',
+ noComponentHasThisMethod: () => 'test'
+});
+
+// @ts-expect-error missing id
+Chart.register([{
+ afterDraw: (chart: Chart) => {
+ // noop
+ },
+}]);