@@ -3,8 +3,10 @@ import {
3
3
ChartComponent ,
4
4
DatasetController ,
5
5
Element ,
6
+ VisualElement ,
6
7
FontSpec
7
8
} from 'chart.js' ;
9
+ import { AnyObject } from 'chart.js/types/basic' ;
8
10
9
11
declare module 'chart.js' {
10
12
@@ -78,36 +80,40 @@ declare module 'chart.js' {
78
80
datasetOptions : SankeyControllerDatasetOptions ;
79
81
defaultDataPoint : SankeyDataPoint ;
80
82
parsedDataType : SankeyParsedData ;
81
- metaExtensions :{ }
83
+ metaExtensions : AnyObject
82
84
/* TODO: define sankey chart options */
83
- chartOptions : any ;
85
+ chartOptions : AnyObject ;
84
86
scales : keyof CartesianScaleTypeRegistry ;
85
87
} ;
86
88
}
87
89
}
88
90
89
- type FlowOptions = {
91
+ export interface FlowOptions {
90
92
colorMode : 'gradient' | 'from' | 'to' ;
91
93
colorFrom : string
92
94
colorTo : string
93
95
}
94
96
95
- type FlowConfig = {
97
+ export interface FlowConfig {
96
98
x : number ;
97
99
y : number ;
98
100
x2 : number ;
99
101
y2 : number ;
100
102
height : number ;
101
103
options : FlowOptions
102
- } ;
104
+ }
103
105
104
106
export type SankeyController = DatasetController
105
107
export const SankeyController : ChartComponent & {
106
108
prototype : SankeyController ;
107
109
new ( chart : Chart , datasetIndex : number ) : SankeyController ;
108
110
} ;
109
111
110
- export type Flow = Element < FlowConfig , FlowOptions >
112
+ export interface Flow <
113
+ T extends FlowConfig = FlowConfig ,
114
+ O extends FlowOptions = FlowOptions
115
+ > extends Element < T , O > , VisualElement { }
116
+
111
117
export const Flow : ChartComponent & {
112
118
prototype : Flow ;
113
119
new ( cfg : FlowConfig ) : Flow ;
0 commit comments