This repository has been archived by the owner on Nov 8, 2021. It is now read-only.
forked from reactchartjs/react-chartjs-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
63 lines (48 loc) · 1.99 KB
/
index.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
// Type definitions for react-chartjs-2 2.0
// Project: https://github.com/jerairrest/react-chartjs-2
// Definitions by: Alexandre Paré <https://github.com/apare>
// Fabien Lavocat <https://github.com/FabienLavocat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as React from "react";
import * as chartjs from "chart.js";
export type ChartDataFunction<T extends chartjs.ChartData> = (
element: HTMLElement
) => T;
export type ChartData<T extends chartjs.ChartData> = ChartDataFunction<T> | T;
export interface ChartComponentProps {
data: ChartData<chartjs.ChartData>;
type?: chartjs.ChartType;
getDatasetAtEvent?(e: any): void;
getElementAtEvent?(e: any): void;
getElementsAtEvent?(e: any): void;
height?: number;
legend?: chartjs.ChartLegendOptions;
onElementsClick?(e: any): void; // alias for getElementsAtEvent (backward compatibility)
options?: chartjs.ChartOptions;
plugins?: object[];
redraw?: boolean;
width?: number;
datasetKeyProvider?: (any: any) => any;
}
export interface LinearComponentProps extends ChartComponentProps {
data: ChartData<chartjs.ChartData>;
}
export default class ChartComponent<
P extends ChartComponentProps
> extends React.Component<P, {}> {
chartInstance: chartjs;
}
export class Doughnut extends ChartComponent<ChartComponentProps> {}
export class Pie extends ChartComponent<ChartComponentProps> {}
export class Line extends ChartComponent<LinearComponentProps> {}
export class Scatter extends ChartComponent<ChartComponentProps> {}
export class Bar extends ChartComponent<LinearComponentProps> {}
export class HorizontalBar extends ChartComponent<ChartComponentProps> {}
export class Radar extends ChartComponent<ChartComponentProps> {}
export class Polar extends ChartComponent<ChartComponentProps> {}
export class Bubble extends ChartComponent<ChartComponentProps> {}
export var defaults: {
global: chartjs.ChartOptions & chartjs.ChartFontOptions;
[key: string]: any;
};