mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[chart.js] Definition of parameter attributes for custom tooltip method (#39346)
This commit is contained in:
committed by
Wesley Wigham
parent
b02210215e
commit
7c6cf9d1a7
@@ -279,3 +279,17 @@ const linearScaleChart: Chart = new Chart(ctx, {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// custom tooltips
|
||||
const customTooltipsPieChart = new Chart(ctx, {
|
||||
type: 'pie',
|
||||
data: {},
|
||||
options: {
|
||||
tooltips: {
|
||||
enabled: false,
|
||||
custom: (tooltipModel) => {
|
||||
// do whatever
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Vendored
+42
-1
@@ -302,7 +302,7 @@ declare namespace Chart {
|
||||
|
||||
interface ChartTooltipOptions {
|
||||
enabled?: boolean;
|
||||
custom?(a: any): void;
|
||||
custom?: (tooltipModel: ChartTooltipModel) => void;
|
||||
mode?: InteractionMode;
|
||||
intersect?: boolean;
|
||||
backgroundColor?: ChartColor;
|
||||
@@ -341,6 +341,47 @@ declare namespace Chart {
|
||||
borderWidth?: number;
|
||||
}
|
||||
|
||||
interface ChartTooltipModel {
|
||||
backgroundColor: string;
|
||||
bodyFontColor: string;
|
||||
bodyFontSize: number;
|
||||
bodySpacing: number;
|
||||
borderColor: string;
|
||||
borderWidth: number;
|
||||
caretSize: number;
|
||||
caretX: number;
|
||||
caretY: number;
|
||||
cornerRadius: number;
|
||||
displayColors: boolean;
|
||||
footerFontColor: string;
|
||||
footerFontSize: number;
|
||||
footerMarginTop: number;
|
||||
footerSpacing: number;
|
||||
height: number;
|
||||
legendColorBackground: string;
|
||||
opacity: number;
|
||||
titleFontColor: string;
|
||||
titleFontSize: number;
|
||||
titleMarginBottom: number;
|
||||
titleSpacing: number;
|
||||
width: number;
|
||||
x: number;
|
||||
xAlign: string;
|
||||
xPadding: number;
|
||||
y: number;
|
||||
yAlign: string;
|
||||
yPadding: number;
|
||||
_bodyAlign: string;
|
||||
_bodyFontFamily: string;
|
||||
_bodyFontStyle: string;
|
||||
_footerAlign: string;
|
||||
_footerFontFamily: string;
|
||||
_footerFontStyle: string;
|
||||
_titleAlign: string;
|
||||
_titleFontFamily: string;
|
||||
_titleFontStyle: string;
|
||||
}
|
||||
|
||||
// NOTE: declare plugin options as interface instead of inline '{ [plugin: string]: any }'
|
||||
// to allow module augmentation in case some plugins want to strictly type their options.
|
||||
interface ChartPluginsOptions {
|
||||
|
||||
Reference in New Issue
Block a user