vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
7.5 KiB

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