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.

261 lines
7.3 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']}, // top, bottom
  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. clickToUse: {boolean},
  98. end: {number, date, string, moment},
  99. format: {
  100. minorLabels: {
  101. millisecond: {string,'undefined': 'undefined'},
  102. second: {string,'undefined': 'undefined'},
  103. minute: {string,'undefined': 'undefined'},
  104. hour: {string,'undefined': 'undefined'},
  105. weekday: {string,'undefined': 'undefined'},
  106. day: {string,'undefined': 'undefined'},
  107. month: {string,'undefined': 'undefined'},
  108. year: {string,'undefined': 'undefined'},
  109. __type__: {object}
  110. },
  111. majorLabels: {
  112. millisecond: {string,'undefined': 'undefined'},
  113. second: {string,'undefined': 'undefined'},
  114. minute: {string,'undefined': 'undefined'},
  115. hour: {string,'undefined': 'undefined'},
  116. weekday: {string,'undefined': 'undefined'},
  117. day: {string,'undefined': 'undefined'},
  118. month: {string,'undefined': 'undefined'},
  119. year: {string,'undefined': 'undefined'},
  120. __type__: {object}
  121. },
  122. __type__: {object}
  123. },
  124. moment: {'function': 'function'},
  125. height: {string, number},
  126. hiddenDates: {object, array},
  127. locale:{string},
  128. locales:{
  129. __any__: {any},
  130. __type__: {object}
  131. },
  132. max: {date, number, string, moment},
  133. maxHeight: {number, string},
  134. min: {date, number, string, moment},
  135. minHeight: {number, string},
  136. moveable: {boolean},
  137. multiselect: {boolean},
  138. orientation: {string},
  139. showCurrentTime: {boolean},
  140. showMajorLabels: {boolean},
  141. showMinorLabels: {boolean},
  142. start: {date, number, string, moment},
  143. timeAxis: {
  144. scale: {string,'undefined': 'undefined'},
  145. step: {number,'undefined': 'undefined'},
  146. __type__: {object}
  147. },
  148. width: {string, number},
  149. zoomable: {boolean},
  150. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  151. zoomMax: {number},
  152. zoomMin: {number},
  153. __type__: {object}
  154. };
  155. let configureOptions = {
  156. global: {
  157. //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly
  158. sort: true,
  159. sampling: true,
  160. stack:false,
  161. shaded: {
  162. enabled: false,
  163. orientation: ['top','bottom'] // top, bottom
  164. },
  165. style: ['line','bar','points'], // line, bar
  166. barChart: {
  167. width: [50,5,100,5],
  168. sideBySide: false,
  169. align: ['left','center','right'] // left, center, right
  170. },
  171. interpolation: {
  172. enabled: true,
  173. parametrization: ['centripetal','chordal','uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  174. },
  175. drawPoints: {
  176. enabled: true,
  177. size: [6,2,30,1],
  178. style: ['square', 'circle'] // square, circle
  179. },
  180. dataAxis: {
  181. showMinorLabels: true,
  182. showMajorLabels: true,
  183. icons: false,
  184. width: [40,0,200,1],
  185. visible: true,
  186. alignZeros: true,
  187. left:{
  188. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  189. //format: function (value) {return value;},
  190. title: {text:'',style:''}
  191. },
  192. right:{
  193. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  194. //format: function (value) {return value;},
  195. title: {text:'',style:''}
  196. }
  197. },
  198. legend: {
  199. enabled: false,
  200. icons: true,
  201. left: {
  202. visible: true,
  203. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  204. },
  205. right: {
  206. visible: true,
  207. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  208. }
  209. },
  210. autoResize: true,
  211. clickToUse: false,
  212. end: '',
  213. format: {
  214. minorLabels: {
  215. millisecond:'SSS',
  216. second: 's',
  217. minute: 'HH:mm',
  218. hour: 'HH:mm',
  219. weekday: 'ddd D',
  220. day: 'D',
  221. month: 'MMM',
  222. year: 'YYYY'
  223. },
  224. majorLabels: {
  225. millisecond:'HH:mm:ss',
  226. second: 'D MMMM HH:mm',
  227. minute: 'ddd D MMMM',
  228. hour: 'ddd D MMMM',
  229. weekday: 'MMMM YYYY',
  230. day: 'MMMM YYYY',
  231. month: 'YYYY',
  232. year: ''
  233. }
  234. },
  235. height: '',
  236. locale: '',
  237. max: '',
  238. maxHeight: '',
  239. min: '',
  240. minHeight: '',
  241. moveable:true,
  242. orientation: ['both', 'bottom', 'top'],
  243. showCurrentTime: false,
  244. showMajorLabels: true,
  245. showMinorLabels: true,
  246. start: '',
  247. width: '100%',
  248. zoomable: true,
  249. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  250. zoomMax: [315360000000000, 10, 315360000000000, 1],
  251. zoomMin: [10, 10, 315360000000000, 1]
  252. }
  253. };
  254. export {allOptions, configureOptions};