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.

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