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.6 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. sideBySide: {boolean},
  41. align: {string:['left','center','right']},
  42. __type__: {object}
  43. },
  44. interpolation: {
  45. enabled: {boolean},
  46. parametrization: {string:['centripetal', 'chordal','uniform']}, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  47. alpha: {number},
  48. __type__: {object,boolean}
  49. },
  50. drawPoints: {
  51. enabled: {boolean},
  52. onRender: { 'function': 'function' },
  53. size: {number},
  54. style: {string:['square','circle']}, // square, circle
  55. __type__: {object,boolean,'function': 'function'}
  56. },
  57. dataAxis: {
  58. showMinorLabels: {boolean},
  59. showMajorLabels: {boolean},
  60. icons: {boolean},
  61. width: {string, number},
  62. visible: {boolean},
  63. alignZeros: {boolean},
  64. left:{
  65. range: {min:{number},max:{number},__type__: {object}},
  66. format: {'function': 'function'},
  67. title: {text:{string,number},style:{string},__type__: {object}},
  68. __type__: {object}
  69. },
  70. right:{
  71. range: {min:{number},max:{number},__type__: {object}},
  72. format: {'function': 'function'},
  73. title: {text:{string,number},style:{string},__type__: {object}},
  74. __type__: {object}
  75. },
  76. __type__: {object}
  77. },
  78. legend: {
  79. enabled: {boolean},
  80. icons: {boolean},
  81. left: {
  82. visible: {boolean},
  83. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  84. __type__: {object}
  85. },
  86. right: {
  87. visible: {boolean},
  88. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  89. __type__: {object}
  90. },
  91. __type__: {object,boolean}
  92. },
  93. groups: {
  94. visibility: {any},
  95. __type__: {object}
  96. },
  97. autoResize: {boolean},
  98. throttleRedraw: {number},
  99. clickToUse: {boolean},
  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: {boolean},
  145. multiselect: {boolean},
  146. orientation: {string},
  147. showCurrentTime: {boolean},
  148. showMajorLabels: {boolean},
  149. showMinorLabels: {boolean},
  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: {boolean},
  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. sideBySide: false,
  178. align: ['left','center','right'] // left, center, right
  179. },
  180. interpolation: {
  181. enabled: true,
  182. parametrization: ['centripetal','chordal','uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  183. },
  184. drawPoints: {
  185. enabled: true,
  186. size: [6,2,30,1],
  187. style: ['square', 'circle'] // square, circle
  188. },
  189. dataAxis: {
  190. showMinorLabels: true,
  191. showMajorLabels: true,
  192. icons: false,
  193. width: [40,0,200,1],
  194. visible: true,
  195. alignZeros: true,
  196. left:{
  197. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  198. //format: function (value) {return value;},
  199. title: {text:'',style:''}
  200. },
  201. right:{
  202. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  203. //format: function (value) {return value;},
  204. title: {text:'',style:''}
  205. }
  206. },
  207. legend: {
  208. enabled: false,
  209. icons: true,
  210. left: {
  211. visible: true,
  212. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  213. },
  214. right: {
  215. visible: true,
  216. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  217. }
  218. },
  219. autoResize: true,
  220. throttleRedraw: [10, 0, 1000, 10],
  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};