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.

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