| 1 |
export default Chart; |
| 2 |
export type ChartEvent = import('../types/index.js').ChartEvent; |
| 3 |
export type Point = import('../types/index.js').Point; |
| 4 |
declare class Chart { |
| 5 |
static defaults: import("./core.defaults.js").Defaults; |
| 6 |
static instances: {}; |
| 7 |
static overrides: any; |
| 8 |
static registry: import("./core.registry.js").Registry; |
| 9 |
static version: string; |
| 10 |
static getChart: (key: any) => any; |
| 11 |
static register(...items: any[]): void; |
| 12 |
static unregister(...items: any[]): void; |
| 13 |
constructor(item: any, userConfig: any); |
| 14 |
config: Config; |
| 15 |
platform: any; |
| 16 |
id: number; |
| 17 |
ctx: any; |
| 18 |
canvas: any; |
| 19 |
width: any; |
| 20 |
height: any; |
| 21 |
_options: any; |
| 22 |
_aspectRatio: any; |
| 23 |
_layers: any[]; |
| 24 |
_metasets: any[]; |
| 25 |
_stacks: any; |
| 26 |
boxes: any[]; |
| 27 |
currentDevicePixelRatio: any; |
| 28 |
chartArea: any; |
| 29 |
_active: any[]; |
| 30 |
_lastEvent: import("../types/index.js").ChartEvent; |
| 31 |
_listeners: {}; |
| 32 |
/** @type {?{attach?: function, detach?: function, resize?: function}} */ |
| 33 |
_responsiveListeners: { |
| 34 |
attach?: Function; |
| 35 |
detach?: Function; |
| 36 |
resize?: Function; |
| 37 |
}; |
| 38 |
_sortedMetasets: any[]; |
| 39 |
scales: {}; |
| 40 |
_plugins: PluginService; |
| 41 |
$proxies: {}; |
| 42 |
_hiddenIndices: {}; |
| 43 |
attached: boolean; |
| 44 |
_animationsDisabled: boolean; |
| 45 |
$context: { |
| 46 |
chart: Chart; |
| 47 |
type: string; |
| 48 |
}; |
| 49 |
_doResize: (mode?: any) => number; |
| 50 |
_dataChanges: any[]; |
| 51 |
get aspectRatio(): any; |
| 52 |
set data(arg: any); |
| 53 |
get data(): any; |
| 54 |
set options(arg: any); |
| 55 |
get options(): any; |
| 56 |
get registry(): import("./core.registry.js").Registry; |
| 57 |
/** |
| 58 |
* @private |
| 59 |
*/ |
| 60 |
private _initialize; |
| 61 |
clear(): Chart; |
| 62 |
stop(): Chart; |
| 63 |
/** |
| 64 |
* Resize the chart to its container or to explicit dimensions. |
| 65 |
* @param {number} [width] |
| 66 |
* @param {number} [height] |
| 67 |
*/ |
| 68 |
resize(width?: number, height?: number): void; |
| 69 |
_resizeBeforeDraw: { |
| 70 |
width: number; |
| 71 |
height: number; |
| 72 |
}; |
| 73 |
_resize(width: any, height: any): void; |
| 74 |
ensureScalesHaveIDs(): void; |
| 75 |
/** |
| 76 |
* Builds a map of scale ID to scale object for future lookup. |
| 77 |
*/ |
| 78 |
buildOrUpdateScales(): void; |
| 79 |
/** |
| 80 |
* @private |
| 81 |
*/ |
| 82 |
private _updateMetasets; |
| 83 |
/** |
| 84 |
* @private |
| 85 |
*/ |
| 86 |
private _removeUnreferencedMetasets; |
| 87 |
buildOrUpdateControllers(): any[]; |
| 88 |
/** |
| 89 |
* Reset the elements of all datasets |
| 90 |
* @private |
| 91 |
*/ |
| 92 |
private _resetElements; |
| 93 |
/** |
| 94 |
* Resets the chart back to its state before the initial animation |
| 95 |
*/ |
| 96 |
reset(): void; |
| 97 |
update(mode: any): void; |
| 98 |
_minPadding: number; |
| 99 |
/** |
| 100 |
* @private |
| 101 |
*/ |
| 102 |
private _updateScales; |
| 103 |
/** |
| 104 |
* @private |
| 105 |
*/ |
| 106 |
private _checkEventBindings; |
| 107 |
/** |
| 108 |
* @private |
| 109 |
*/ |
| 110 |
private _updateHiddenIndices; |
| 111 |
/** |
| 112 |
* @private |
| 113 |
*/ |
| 114 |
private _getUniformDataChanges; |
| 115 |
/** |
| 116 |
* Updates the chart layout unless a plugin returns `false` to the `beforeLayout` |
| 117 |
* hook, in which case, plugins will not be called on `afterLayout`. |
| 118 |
* @private |
| 119 |
*/ |
| 120 |
private _updateLayout; |
| 121 |
/** |
| 122 |
* Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate` |
| 123 |
* hook, in which case, plugins will not be called on `afterDatasetsUpdate`. |
| 124 |
* @private |
| 125 |
*/ |
| 126 |
private _updateDatasets; |
| 127 |
/** |
| 128 |
* Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate` |
| 129 |
* hook, in which case, plugins will not be called on `afterDatasetUpdate`. |
| 130 |
* @private |
| 131 |
*/ |
| 132 |
private _updateDataset; |
| 133 |
render(): void; |
| 134 |
draw(): void; |
| 135 |
/** |
| 136 |
* @private |
| 137 |
*/ |
| 138 |
private _getSortedDatasetMetas; |
| 139 |
/** |
| 140 |
* Gets the visible dataset metas in drawing order |
| 141 |
* @return {object[]} |
| 142 |
*/ |
| 143 |
getSortedVisibleDatasetMetas(): object[]; |
| 144 |
/** |
| 145 |
* Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw` |
| 146 |
* hook, in which case, plugins will not be called on `afterDatasetsDraw`. |
| 147 |
* @private |
| 148 |
*/ |
| 149 |
private _drawDatasets; |
| 150 |
/** |
| 151 |
* Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw` |
| 152 |
* hook, in which case, plugins will not be called on `afterDatasetDraw`. |
| 153 |
* @private |
| 154 |
*/ |
| 155 |
private _drawDataset; |
| 156 |
/** |
| 157 |
* Checks whether the given point is in the chart area. |
| 158 |
* @param {Point} point - in relative coordinates (see, e.g., getRelativePosition) |
| 159 |
* @returns {boolean} |
| 160 |
*/ |
| 161 |
isPointInArea(point: Point): boolean; |
| 162 |
getElementsAtEventForMode(e: any, mode: any, options: any, useFinalPosition: any): any; |
| 163 |
getDatasetMeta(datasetIndex: any): any; |
| 164 |
getContext(): { |
| 165 |
chart: Chart; |
| 166 |
type: string; |
| 167 |
}; |
| 168 |
getVisibleDatasetCount(): number; |
| 169 |
isDatasetVisible(datasetIndex: any): boolean; |
| 170 |
setDatasetVisibility(datasetIndex: any, visible: any): void; |
| 171 |
toggleDataVisibility(index: any): void; |
| 172 |
getDataVisibility(index: any): boolean; |
| 173 |
/** |
| 174 |
* @private |
| 175 |
*/ |
| 176 |
private _updateVisibility; |
| 177 |
hide(datasetIndex: any, dataIndex: any): void; |
| 178 |
show(datasetIndex: any, dataIndex: any): void; |
| 179 |
/** |
| 180 |
* @private |
| 181 |
*/ |
| 182 |
private _destroyDatasetMeta; |
| 183 |
_stop(): void; |
| 184 |
destroy(): void; |
| 185 |
toBase64Image(...args: any[]): any; |
| 186 |
/** |
| 187 |
* @private |
| 188 |
*/ |
| 189 |
private bindEvents; |
| 190 |
/** |
| 191 |
* @private |
| 192 |
*/ |
| 193 |
private bindUserEvents; |
| 194 |
/** |
| 195 |
* @private |
| 196 |
*/ |
| 197 |
private bindResponsiveEvents; |
| 198 |
/** |
| 199 |
* @private |
| 200 |
*/ |
| 201 |
private unbindEvents; |
| 202 |
updateHoverStyle(items: any, mode: any, enabled: any): void; |
| 203 |
/** |
| 204 |
* Get active (hovered) elements |
| 205 |
* @returns array |
| 206 |
*/ |
| 207 |
getActiveElements(): any[]; |
| 208 |
/** |
| 209 |
* Set active (hovered) elements |
| 210 |
* @param {array} activeElements New active data points |
| 211 |
*/ |
| 212 |
setActiveElements(activeElements: any[]): void; |
| 213 |
/** |
| 214 |
* Calls enabled plugins on the specified hook and with the given args. |
| 215 |
* This method immediately returns as soon as a plugin explicitly returns false. The |
| 216 |
* returned value can be used, for instance, to interrupt the current action. |
| 217 |
* @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate'). |
| 218 |
* @param {Object} [args] - Extra arguments to apply to the hook call. |
| 219 |
* @param {import('./core.plugins.js').filterCallback} [filter] - Filtering function for limiting which plugins are notified |
| 220 |
* @returns {boolean} false if any of the plugins return false, else returns true. |
| 221 |
*/ |
| 222 |
notifyPlugins(hook: string, args?: any, filter?: import('./core.plugins.js').filterCallback): boolean; |
| 223 |
/** |
| 224 |
* Check if a plugin with the specific ID is registered and enabled |
| 225 |
* @param {string} pluginId - The ID of the plugin of which to check if it is enabled |
| 226 |
* @returns {boolean} |
| 227 |
*/ |
| 228 |
isPluginEnabled(pluginId: string): boolean; |
| 229 |
/** |
| 230 |
* @private |
| 231 |
*/ |
| 232 |
private _updateHoverStyles; |
| 233 |
/** |
| 234 |
* @private |
| 235 |
*/ |
| 236 |
private _eventHandler; |
| 237 |
/** |
| 238 |
* Handle an event |
| 239 |
* @param {ChartEvent} e the event to handle |
| 240 |
* @param {boolean} [replay] - true if the event was replayed by `update` |
| 241 |
* @param {boolean} [inChartArea] - true if the event is inside chartArea |
| 242 |
* @return {boolean} true if the chart needs to re-render |
| 243 |
* @private |
| 244 |
*/ |
| 245 |
private _handleEvent; |
| 246 |
/** |
| 247 |
* @param {ChartEvent} e - The event |
| 248 |
* @param {import('../types/index.js').ActiveElement[]} lastActive - Previously active elements |
| 249 |
* @param {boolean} inChartArea - Is the event inside chartArea |
| 250 |
* @param {boolean} useFinalPosition - Should the evaluation be done with current or final (after animation) element positions |
| 251 |
* @returns {import('../types/index.js').ActiveElement[]} - The active elements |
| 252 |
* @pravate |
| 253 |
*/ |
| 254 |
_getActiveElements(e: ChartEvent, lastActive: import('../types/index.js').ActiveElement[], inChartArea: boolean, useFinalPosition: boolean): import('../types/index.js').ActiveElement[]; |
| 255 |
} |
| 256 |
import Config from "./core.config.js"; |
| 257 |
import PluginService from "./core.plugins.js"; |