Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plugin.tooltip.d.ts 9.7KB

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