-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.tooltip.d.ts
288 lines (288 loc) · 9.73 KB
/
plugin.tooltip.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
export class Tooltip extends Element<import("../types/basic.js").AnyObject, import("../types/basic.js").AnyObject> {
/**
* @namespace Chart.Tooltip.positioners
*/
static positioners: {
/**
* Average mode places the tooltip at the average position of the elements shown
*/
average(items: any): false | {
x: number;
y: number;
};
/**
* Gets the tooltip position nearest of the item nearest to the event position
*/
nearest(items: any, eventPosition: any): false | {
x: any;
y: any;
};
};
constructor(config: any);
opacity: number;
_active: any[];
_eventPosition: any;
_size: {
width: number;
height: number;
};
_cachedAnimations: Readonly<Animations>;
_tooltipItems: any[];
$animations: any;
$context: any;
chart: any;
options: any;
dataPoints: {
chart: import("../core/core.controller.js").default;
label: any;
parsed: any;
raw: any;
formattedValue: any;
dataset: any;
dataIndex: number;
datasetIndex: number;
element: Element<import("../types/basic.js").AnyObject, import("../types/basic.js").AnyObject>;
}[];
title: any;
beforeBody: any;
body: any[];
afterBody: any;
footer: any;
xAlign: any;
yAlign: any;
x: any;
y: any;
height: number;
width: number;
caretX: any;
caretY: any;
labelColors: any[];
labelPointStyles: any[];
labelTextColors: any[];
initialize(options: any): void;
/**
* @private
*/
private _resolveAnimations;
/**
* @protected
*/
protected getContext(): any;
getTitle(context: any, options: any): any;
getBeforeBody(tooltipItems: any, options: any): any;
getBody(tooltipItems: any, options: any): any[];
getAfterBody(tooltipItems: any, options: any): any;
getFooter(tooltipItems: any, options: any): any;
/**
* @private
*/
private _createItems;
update(changed: any, replay: any): void;
drawCaret(tooltipPoint: any, ctx: any, size: any, options: any): void;
getCaretPosition(tooltipPoint: any, size: any, options: any): {
x1: any;
x2: any;
x3: any;
y1: any;
y2: any;
y3: any;
};
drawTitle(pt: any, ctx: any, options: any): void;
/**
* @private
*/
private _drawColorBox;
drawBody(pt: any, ctx: any, options: any): void;
drawFooter(pt: any, ctx: any, options: any): void;
drawBackground(pt: any, ctx: any, tooltipSize: any, options: any): void;
/**
* Update x/y animation targets when _active elements are animating too
* @private
*/
private _updateAnimationTarget;
/**
* Determine if the tooltip will draw anything
* @returns {boolean} True if the tooltip will render
*/
_willRender(): boolean;
draw(ctx: any): void;
/**
* Get active elements in the tooltip
* @returns {Array} Array of elements that are active in the tooltip
*/
getActiveElements(): any[];
/**
* Set active elements in the tooltip
* @param {array} activeElements Array of active datasetIndex/index pairs.
* @param {object} eventPosition Synthetic event position used in positioning
*/
setActiveElements(activeElements: any[], eventPosition: object): void;
_ignoreReplayEvents: boolean;
/**
* Handle an event
* @param {ChartEvent} e - The event to handle
* @param {boolean} [replay] - This is a replayed event (from update)
* @param {boolean} [inChartArea] - The event is inside chartArea
* @returns {boolean} true if the tooltip changed
*/
handleEvent(e: ChartEvent, replay?: boolean, inChartArea?: boolean): boolean;
/**
* Helper for determining the active elements for event
* @param {ChartEvent} e - The event to handle
* @param {InteractionItem[]} lastActive - Previously active elements
* @param {boolean} [replay] - This is a replayed event (from update)
* @param {boolean} [inChartArea] - The event is inside chartArea
* @returns {InteractionItem[]} - Active elements
* @private
*/
private _getActiveElements;
/**
* Determine if the active elements + event combination changes the
* tooltip position
* @param {array} active - Active elements
* @param {ChartEvent} e - Event that triggered the position change
* @returns {boolean} True if the position has changed
*/
_positionChanged(active: any[], e: ChartEvent): boolean;
}
declare namespace _default {
export const id: string;
export { Tooltip as _element };
export { positioners };
export function afterInit(chart: any, _args: any, options: any): void;
export function beforeUpdate(chart: any, _args: any, options: any): void;
export function reset(chart: any, _args: any, options: any): void;
export function afterDraw(chart: any): void;
export function afterEvent(chart: any, args: any): void;
export namespace defaults {
export const enabled: boolean;
export const external: any;
export const position: string;
export const backgroundColor: string;
export const titleColor: string;
export namespace titleFont {
const weight: string;
}
export const titleSpacing: number;
export const titleMarginBottom: number;
export const titleAlign: string;
export const bodyColor: string;
export const bodySpacing: number;
export const bodyFont: {};
export const bodyAlign: string;
export const footerColor: string;
export const footerSpacing: number;
export const footerMarginTop: number;
export namespace footerFont {
const weight_1: string;
export { weight_1 as weight };
}
export const footerAlign: string;
export const padding: number;
export const caretPadding: number;
export const caretSize: number;
export const cornerRadius: number;
export function boxHeight(ctx: any, opts: any): any;
export function boxWidth(ctx: any, opts: any): any;
export const multiKeyBackground: string;
export const displayColors: boolean;
export const boxPadding: number;
export const borderColor: string;
export const borderWidth: number;
export namespace animation {
const duration: number;
const easing: string;
}
export namespace animations {
namespace numbers {
const type: string;
const properties: string[];
}
namespace opacity {
const easing_1: string;
export { easing_1 as easing };
const duration_1: number;
export { duration_1 as duration };
}
}
export { defaultCallbacks as callbacks };
}
export namespace defaultRoutes {
const bodyFont_1: string;
export { bodyFont_1 as bodyFont };
const footerFont_1: string;
export { footerFont_1 as footerFont };
const titleFont_1: string;
export { titleFont_1 as titleFont };
}
export namespace descriptors {
export function _scriptable(name: any): boolean;
export const _indexable: boolean;
export namespace callbacks {
const _scriptable_1: boolean;
export { _scriptable_1 as _scriptable };
const _indexable_1: boolean;
export { _indexable_1 as _indexable };
}
export namespace animation_1 {
const _fallback: boolean;
}
export { animation_1 as animation };
export namespace animations_1 {
const _fallback_1: string;
export { _fallback_1 as _fallback };
}
export { animations_1 as animations };
}
export const additionalOptionScopes: string[];
}
export default _default;
export type Chart = import('../platform/platform.base.js').Chart;
export type ChartEvent = import('../types/index.js').ChartEvent;
export type ActiveElement = import('../types/index.js').ActiveElement;
export type InteractionItem = import('../core/core.interaction.js').InteractionItem;
import Element from "../core/core.element.js";
import Animations from "../core/core.animations.js";
declare namespace positioners {
/**
* Average mode places the tooltip at the average position of the elements shown
*/
function average(items: any): false | {
x: number;
y: number;
};
/**
* Gets the tooltip position nearest of the item nearest to the event position
*/
function nearest(items: any, eventPosition: any): false | {
x: any;
y: any;
};
}
declare namespace defaultCallbacks {
export { noop as beforeTitle };
export function title(tooltipItems: any): any;
export { noop as afterTitle };
export { noop as beforeBody };
export { noop as beforeLabel };
export function label(tooltipItem: any): any;
export function labelColor(tooltipItem: any): {
borderColor: any;
backgroundColor: any;
borderWidth: any;
borderDash: any;
borderDashOffset: any;
borderRadius: number;
};
export function labelTextColor(): any;
export function labelPointStyle(tooltipItem: any): {
pointStyle: any;
rotation: any;
};
export { noop as afterLabel };
export { noop as afterBody };
export { noop as beforeFooter };
export { noop as footer };
export { noop as afterFooter };
}
import { noop } from "../helpers/helpers.core.js";