UNPKG

8.68 kBJavaScriptView Raw
1/**
2 * This object contains all possible options. It will check if the types are correct, if required if the option is one
3 * of the allowed values.
4 *
5 * __any__ means that the name of the property does not matter.
6 * __type__ is a required field for all objects and contains the allowed types of all objects
7 */
8let string = 'string';
9let bool = 'boolean';
10let number = 'number';
11let array = 'array';
12let date = 'date';
13let object = 'object'; // should only be in a __type__ property
14let dom = 'dom';
15let moment = 'moment';
16let any = 'any';
17
18
19let allOptions = {
20 configure: {
21 enabled: {'boolean': bool},
22 filter: {'boolean': bool,'function': 'function'},
23 container: {dom},
24 __type__: {object,'boolean': bool,'function': 'function'}
25 },
26
27 //globals :
28 alignCurrentTime: {string, 'undefined': 'undefined'},
29 yAxisOrientation: {string:['left','right']},
30 defaultGroup: {string},
31 sort: {'boolean': bool},
32 sampling: {'boolean': bool},
33 stack:{'boolean': bool},
34 graphHeight: {string, number},
35 shaded: {
36 enabled: {'boolean': bool},
37 orientation: {string:['bottom','top','zero','group']}, // top, bottom, zero, group
38 groupId: {object},
39 __type__: {'boolean': bool,object}
40 },
41 style: {string:['line','bar','points']}, // line, bar
42 barChart: {
43 width: {number},
44 minWidth: {number},
45 sideBySide: {'boolean': bool},
46 align: {string:['left','center','right']},
47 __type__: {object}
48 },
49 interpolation: {
50 enabled: {'boolean': bool},
51 parametrization: {string:['centripetal', 'chordal','uniform']}, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
52 alpha: {number},
53 __type__: {object,'boolean': bool}
54 },
55 drawPoints: {
56 enabled: {'boolean': bool},
57 onRender: { 'function': 'function' },
58 size: {number},
59 style: {string:['square','circle']}, // square, circle
60 __type__: {object,'boolean': bool,'function': 'function'}
61 },
62 dataAxis: {
63 showMinorLabels: {'boolean': bool},
64 showMajorLabels: {'boolean': bool},
65 icons: {'boolean': bool},
66 width: {string, number},
67 visible: {'boolean': bool},
68 alignZeros: {'boolean': bool},
69 left:{
70 range: {min:{number,'undefined': 'undefined'},max:{number,'undefined': 'undefined'},__type__: {object}},
71 format: {'function': 'function'},
72 title: {text:{string,number,'undefined': 'undefined'},style:{string,'undefined': 'undefined'},__type__: {object}},
73 __type__: {object}
74 },
75 right:{
76 range: {min:{number,'undefined': 'undefined'},max:{number,'undefined': 'undefined'},__type__: {object}},
77 format: {'function': 'function'},
78 title: {text:{string,number,'undefined': 'undefined'},style:{string,'undefined': 'undefined'},__type__: {object}},
79 __type__: {object}
80 },
81 __type__: {object}
82 },
83 legend: {
84 enabled: {'boolean': bool},
85 icons: {'boolean': bool},
86 left: {
87 visible: {'boolean': bool},
88 position: {string:['top-right','bottom-right','top-left','bottom-left']},
89 __type__: {object}
90 },
91 right: {
92 visible: {'boolean': bool},
93 position: {string:['top-right','bottom-right','top-left','bottom-left']},
94 __type__: {object}
95 },
96 __type__: {object,'boolean': bool}
97 },
98 groups: {
99 visibility: {any},
100 __type__: {object}
101 },
102
103 autoResize: {'boolean': bool},
104 throttleRedraw: {number}, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
105 clickToUse: {'boolean': bool},
106 end: {number, date, string, moment},
107 format: {
108 minorLabels: {
109 millisecond: {string,'undefined': 'undefined'},
110 second: {string,'undefined': 'undefined'},
111 minute: {string,'undefined': 'undefined'},
112 hour: {string,'undefined': 'undefined'},
113 weekday: {string,'undefined': 'undefined'},
114 day: {string,'undefined': 'undefined'},
115 month: {string,'undefined': 'undefined'},
116 quarter: {string,'undefined': 'undefined'},
117 year: {string,'undefined': 'undefined'},
118 __type__: {object}
119 },
120 majorLabels: {
121 millisecond: {string,'undefined': 'undefined'},
122 second: {string,'undefined': 'undefined'},
123 minute: {string,'undefined': 'undefined'},
124 hour: {string,'undefined': 'undefined'},
125 weekday: {string,'undefined': 'undefined'},
126 day: {string,'undefined': 'undefined'},
127 month: {string,'undefined': 'undefined'},
128 quarter: {string,'undefined': 'undefined'},
129 year: {string,'undefined': 'undefined'},
130 __type__: {object}
131 },
132 __type__: {object}
133 },
134 moment: {'function': 'function'},
135 height: {string, number},
136 hiddenDates: {
137 start: {date, number, string, moment},
138 end: {date, number, string, moment},
139 repeat: {string},
140 __type__: {object, array}
141 },
142 locale:{string},
143 locales:{
144 __any__: {any},
145 __type__: {object}
146 },
147 max: {date, number, string, moment},
148 maxHeight: {number, string},
149 maxMinorChars: {number},
150 min: {date, number, string, moment},
151 minHeight: {number, string},
152 moveable: {'boolean': bool},
153 multiselect: {'boolean': bool},
154 orientation: {string},
155 showCurrentTime: {'boolean': bool},
156 showMajorLabels: {'boolean': bool},
157 showMinorLabels: {'boolean': bool},
158 start: {date, number, string, moment},
159 timeAxis: {
160 scale: {string,'undefined': 'undefined'},
161 step: {number,'undefined': 'undefined'},
162 __type__: {object}
163 },
164 width: {string, number},
165 zoomable: {'boolean': bool},
166 zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
167 zoomMax: {number},
168 zoomMin: {number},
169 zIndex: {number},
170 __type__: {object}
171};
172
173let configureOptions = {
174 global: {
175 alignCurrentTime: ['none', 'year', 'month', 'quarter', 'week', 'isoWeek', 'day', 'date', 'hour', 'minute', 'second'],
176 //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly
177 sort: true,
178 sampling: true,
179 stack:false,
180 shaded: {
181 enabled: false,
182 orientation: ['zero','top','bottom','group'] // zero, top, bottom
183 },
184 style: ['line','bar','points'], // line, bar
185 barChart: {
186 width: [50,5,100,5],
187 minWidth: [50,5,100,5],
188 sideBySide: false,
189 align: ['left','center','right'] // left, center, right
190 },
191 interpolation: {
192 enabled: true,
193 parametrization: ['centripetal','chordal','uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
194 },
195 drawPoints: {
196 enabled: true,
197 size: [6,2,30,1],
198 style: ['square', 'circle'] // square, circle
199 },
200 dataAxis: {
201 showMinorLabels: true,
202 showMajorLabels: true,
203 icons: false,
204 width: [40,0,200,1],
205 visible: true,
206 alignZeros: true,
207 left:{
208 //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
209 //format: function (value) {return value;},
210 title: {text:'',style:''}
211 },
212 right:{
213 //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
214 //format: function (value) {return value;},
215 title: {text:'',style:''}
216 }
217 },
218 legend: {
219 enabled: false,
220 icons: true,
221 left: {
222 visible: true,
223 position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
224 },
225 right: {
226 visible: true,
227 position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
228 }
229 },
230
231 autoResize: true,
232 clickToUse: false,
233 end: '',
234 format: {
235 minorLabels: {
236 millisecond:'SSS',
237 second: 's',
238 minute: 'HH:mm',
239 hour: 'HH:mm',
240 weekday: 'ddd D',
241 day: 'D',
242 month: 'MMM',
243 quarter: '[Q]Q',
244 year: 'YYYY'
245 },
246 majorLabels: {
247 millisecond:'HH:mm:ss',
248 second: 'D MMMM HH:mm',
249 minute: 'ddd D MMMM',
250 hour: 'ddd D MMMM',
251 weekday: 'MMMM YYYY',
252 day: 'MMMM YYYY',
253 month: 'YYYY',
254 quarter: 'YYYY',
255 year: ''
256 }
257 },
258
259 height: '',
260 locale: '',
261 max: '',
262 maxHeight: '',
263 maxMinorChars: [7, 0, 20, 1],
264 min: '',
265 minHeight: '',
266 moveable:true,
267 orientation: ['both', 'bottom', 'top'],
268 showCurrentTime: false,
269 showMajorLabels: true,
270 showMinorLabels: true,
271 start: '',
272 width: '100%',
273 zoomable: true,
274 zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
275 zoomMax: [315360000000000, 10, 315360000000000, 1],
276 zoomMin: [10, 10, 315360000000000, 1],
277 zIndex: 0
278 }
279};
280
281export {allOptions, configureOptions};