forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.flot.d.ts
241 lines (207 loc) · 7.68 KB
/
jquery.flot.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
// Type definitions for Flot
// Project: http://www.flotcharts.org/
// Definitions by: Matt Burland <https://github.com/burlandm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare module jquery.flot {
interface plotOptions {
colors?: any[];
series?: seriesOptions;
legend?: legendOptions;
xaxis?: axisOptions;
yaxis?: axisOptions;
xaxes?: axisOptions[];
yaxes?: axisOptions[];
grid?: gridOptions;
interaction?: interaction;
hooks?: hooks;
}
interface hooks {
processOptions: { (plot: plot, options: plotOptions): void; } [];
processRawData: { (plot: plot, series: dataSeries, data: any[], datapoints: datapoints): void; }[];
processDatapoints: { (plot: plot, series: dataSeries, datapoints: datapoints): void; }[];
processOffset: { (plot: plot, offset: canvasPoint): void; }[];
drawBackground: { (plot: plot, context: CanvasRenderingContext2D): void; }[];
drawSeries: { (plot: plot, context: CanvasRenderingContext2D, series: dataSeries): void; }[];
draw: { (plot: plot, context: CanvasRenderingContext2D): void; }[];
bindEvents: { (plot: plot, eventHolder: JQuery): void; }[];
drawOverlay: { (plot: plot, context: CanvasRenderingContext2D): void; }[];
shutdown: { (plot: plot, eventHolder: JQuery): void; }[];
}
interface interaction {
redrawOverlayInterval?: number;
}
interface gridOptions {
show?: boolean;
aboveData?: boolean;
color?: any; // color
backgroundColor?: any; //color/gradient or null
margin?: any; // number or margin object
labelMargin?: number;
axisMargin?: number;
markings?: any; //array of markings or (fn: axes -> array of markings)
borderWidth?: any; // number or width object
borderColor?: any; // color or null
minBorderMargin?: number; // or null
clickable?: boolean;
hoverable?: boolean;
autoHighlight?: boolean;
mouseActiveRadius?: number;
tickColor?: any;
markingsColor?: any;
markingsLineWidth?: number;
}
interface legendOptions {
show?: boolean;
labelFormatter?: (label: string, series: any) => string; // null or (fn: string, series object -> string)
labelBoxBorderColor?: any; //color
noColumns?: number;
position?: string; //"ne" or "nw" or "se" or "sw"
margin?: any; //number of pixels or [x margin, y margin]
backgroundColor?: any; //null or color
backgroundOpacity?: number; // between 0 and 1
container?: JQuery; // null or jQuery object/DOM element/jQuery expression
sorted?: any; //null/false, true, "ascending", "descending" or a comparator
}
interface seriesOptions {
color?: any; // color or number
label?: string;
lines?: linesOptions;
bars?: barsOptions;
points?: pointsOptions;
xaxis?: number;
yaxis?: number;
clickable?: boolean;
hoverable?: boolean;
shadowSize?: number;
highlightColor?: any;
}
interface dataSeries extends seriesOptions {
data: any[];
}
interface axisOptions {
show?: boolean; // null or true/false
position?: string; // "bottom" or "top" or "left" or "right"
color?: any; // null or color spec
tickColor?: any; // null or color spec
font?: any; // null or font spec object
min?: number;
max?: number;
autoscaleMargin?: number;
transform?: (v: number) => number; // null or fn: number -> number
inverseTransform?: (v: number) => number; // null or fn: number -> number
ticks?: any; // null or number or ticks array or (fn: axis -> ticks array)
tickSize?: any; // number or array
minTickSize?: any; // number or array
tickFormatter?: (t: number, a?: axis) => string; // (fn: number, object -> string) or string
tickDecimals?: number;
labelWidth?: number;
labelHeight?: number;
reserveSpace?: boolean;
tickLength?: number;
alignTicksWithAxis?: number;
}
interface seriesTypeBase {
show?: boolean;
lineWidth?: number;
fill?: any; //boolean or number
fillColor?: any; //null or color/gradient
}
interface linesOptions extends seriesTypeBase {
steps?: boolean;
}
interface barsOptions extends seriesTypeBase {
barWidth?: number;
align?: string;
horizontal?: boolean;
}
interface pointsOptions extends seriesTypeBase {
radius?: number;
symbol?: any;
}
interface gradient {
colors: any[];
}
interface item {
datapoint: number[]; // the point, e.g. [0, 2]
dataIndex: number; // the index of the point in the data array
series: dataSeries; //the series object
seriesIndex: number; //the index of the series
pageX: number;
pageY: number; //the global screen coordinates of the point
}
interface datapoints {
points: number[];
pointsize: number;
format: datapointFormat[];
}
interface datapointFormat {
x?: boolean;
y?: boolean;
number: boolean;
required: boolean;
defaultValue?: number;
}
interface point {
x: number;
y: number;
}
interface offset {
left: number;
top: number;
}
interface canvasPoint {
top: number;
left: number;
bottom?: number;
right?: number;
}
interface axes {
xaxis: axis;
yaxis: axis;
x2axis?: axis;
y2axis?: axis;
}
interface axis extends axisOptions {
options: axisOptions;
p2c(point: point):canvasPoint;
c2p(canvasPoint: canvasPoint):point;
}
interface plugin {
init(options: plotOptions): any;
options?: any;
name?: string;
version?: string;
}
interface plot {
highlight(series: dataSeries, datapoint: item): void;
unhighlight(): void;
unhighlight(series: dataSeries, datapoint: item): void;
setData(data: any): void;
setupGrid(): void;
draw(): void;
triggerRedrawOverlay(): void;
width(): number;
height(): number;
offset(): JQueryCoordinates;
pointOffset(point: point): offset;
resize(): void;
shutdown(): void;
getData(): dataSeries[];
getAxes(): axes;
getXAxes(): axis[];
getYAxes(): axis[];
getPlaceholder(): JQuery;
getCanvas(): HTMLCanvasElement;
getPlotOffset(): canvasPoint;
getOptions(): plotOptions;
}
interface plotStatic {
(placeholder: JQuery, data: dataSeries[], options?: plotOptions): plot;
(placeholder: JQuery, data: any[], options?: plotOptions): plot;
plugins: plugin[];
}
}
interface JQueryStatic {
plot: jquery.flot.plotStatic;
}