Skip to content

Commit 1da5e2a

Browse files
committed
Typescript declaration file added to JS API.
1 parent b31b67d commit 1da5e2a

File tree

1 file changed

+169
-0
lines changed

1 file changed

+169
-0
lines changed

src/apps/weblib/js-api/vizzu.d.ts

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
interface DataSeries {
2+
name: string,
3+
type: 'categories'|'values';
4+
values: string[]|number[];
5+
}
6+
7+
interface DataSet {
8+
series: DataSeries[];
9+
filter: (record: any) => boolean;
10+
}
11+
12+
interface Channel {
13+
title: string|null;
14+
attach: string[];
15+
detach: string[];
16+
range: string;
17+
labelLevel: number;
18+
}
19+
20+
interface Descriptor {
21+
channels: {
22+
x: Channel;
23+
y: Channel;
24+
color: Channel;
25+
lightness: Channel;
26+
size: Channel;
27+
shape: Channel;
28+
label: Channel;
29+
};
30+
title: string|null;
31+
legend: 'color'|'lightness'|'size'|null;
32+
coordSystem: 'cartesian'|'polar';
33+
rotation: number;
34+
geometry: 'rectangle'|'circle'|'area'|'line';
35+
orientation: 'horizontal'|'vertical';
36+
sort: 'none'|'experimental';
37+
reverse: boolean;
38+
align: 'none'|'min'|'center'|'max'|'stretch';
39+
split: boolean;
40+
}
41+
42+
interface Padding {
43+
paddingTop: number|string;
44+
paddingRight: number|string;
45+
paddingBottom: number|string;
46+
paddingLeft: number|string;
47+
}
48+
49+
interface Font {
50+
fontFamily: string;
51+
fontStyle: 'normal'|'italic'|'oblique';
52+
fontWeight: 'normal'|'bold'|number;
53+
fontSize: number|string;
54+
}
55+
56+
interface Box {
57+
backgroundColor: string;
58+
borderColor: string;
59+
borderWidth: number;
60+
}
61+
62+
interface Text {
63+
color: string;
64+
textAlign: 'center'|'left'|'right';
65+
backgroundColor: string;
66+
overflow: 'visible'|'hidden';
67+
numberFormat: 'none'|'groupped'|'prefixed';
68+
}
69+
70+
interface MarkerLabel extends Label {
71+
position: 'below'|'center'|'above';
72+
filter: string;
73+
format: 'valueFirst'|'categoriesFirst';
74+
}
75+
76+
interface Marker {
77+
borderWidth: number;
78+
borderOpacity: number;
79+
borderOpacityMode: 'straight'|'premultiplied';
80+
fillOpacity: number;
81+
guides: {
82+
color: string;
83+
lineWidth: number;
84+
};
85+
label: MarkerLabel;
86+
}
87+
88+
interface Axis {
89+
color: string;
90+
title: Label;
91+
label: Label;
92+
ticks: {
93+
color: string;
94+
lineWidth: number;
95+
length: number|string;
96+
position: 'outside'|'inside'|'center';
97+
};
98+
guides: {
99+
color: string;
100+
lineWidth: number;
101+
};
102+
interlaceing: {
103+
color: string;
104+
};
105+
}
106+
107+
interface Plot extends Padding, Box {
108+
marker: Marker;
109+
axis: Axis;
110+
}
111+
112+
interface Legend extends Padding, Box {
113+
width: number|string;
114+
title: Label;
115+
label: Label;
116+
marker: {
117+
type: 'circle'|'square';
118+
size: number|string;
119+
};
120+
}
121+
122+
interface Data {
123+
colorGradient: string;
124+
colorPalette: string;
125+
minLightness: number;
126+
maxLightness: number;
127+
lineWidth: number;
128+
lineMinWidth: number;
129+
lineMaxWidth: number;
130+
circleMinRadius: number;
131+
circleMaxRadius: number;
132+
barMaxPadding: number;
133+
barPaddingDecrease: number;
134+
columnMaxPadding: number;
135+
columnPaddingDecrease: number;
136+
}
137+
138+
type Label = Padding & Font & Text;
139+
140+
interface Styles extends Padding, Box, Font {
141+
plot: Plot;
142+
legend: Legend;
143+
title: Label;
144+
data: Data;
145+
}
146+
147+
interface AnimationTarget {
148+
data: DataSet;
149+
descriptor: Descriptor;
150+
style: Styles;
151+
}
152+
153+
interface AnimControl {
154+
seek(value: string): void;
155+
pause(): void;
156+
play(): void;
157+
stop(): void;
158+
reverse(): void;
159+
}
160+
161+
export default class Vizzu {
162+
constructor(container: any);
163+
initializing: Promise<Vizzu>;
164+
on(eventName: string, handler: any): void;
165+
off(eventName: string, handler: any): void;
166+
animate(obj: AnimationTarget): Promise<Vizzu>;
167+
get animation(): AnimControl;
168+
version(): string;
169+
}

0 commit comments

Comments
 (0)