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.

272 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. __type__: {object}
  162. };
  163. let configureOptions = {
  164. global: {
  165. //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly
  166. sort: true,
  167. sampling: true,
  168. stack:false,
  169. shaded: {
  170. enabled: false,
  171. orientation: ['zero','top','bottom','group'] // zero, top, bottom
  172. },
  173. style: ['line','bar','points'], // line, bar
  174. barChart: {
  175. width: [50,5,100,5],
  176. sideBySide: false,
  177. align: ['left','center','right'] // left, center, right
  178. },
  179. interpolation: {
  180. enabled: true,
  181. parametrization: ['centripetal','chordal','uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  182. },
  183. drawPoints: {
  184. enabled: true,
  185. size: [6,2,30,1],
  186. style: ['square', 'circle'] // square, circle
  187. },
  188. dataAxis: {
  189. showMinorLabels: true,
  190. showMajorLabels: true,
  191. icons: false,
  192. width: [40,0,200,1],
  193. visible: true,
  194. alignZeros: true,
  195. left:{
  196. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  197. //format: function (value) {return value;},
  198. title: {text:'',style:''}
  199. },
  200. right:{
  201. //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined},
  202. //format: function (value) {return value;},
  203. title: {text:'',style:''}
  204. }
  205. },
  206. legend: {
  207. enabled: false,
  208. icons: true,
  209. left: {
  210. visible: true,
  211. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  212. },
  213. right: {
  214. visible: true,
  215. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  216. }
  217. },
  218. autoResize: true,
  219. throttleRedraw: [10, 0, 1000, 10],
  220. clickToUse: false,
  221. end: '',
  222. format: {
  223. minorLabels: {
  224. millisecond:'SSS',
  225. second: 's',
  226. minute: 'HH:mm',
  227. hour: 'HH:mm',
  228. weekday: 'ddd D',
  229. day: 'D',
  230. month: 'MMM',
  231. year: 'YYYY'
  232. },
  233. majorLabels: {
  234. millisecond:'HH:mm:ss',
  235. second: 'D MMMM HH:mm',
  236. minute: 'ddd D MMMM',
  237. hour: 'ddd D MMMM',
  238. weekday: 'MMMM YYYY',
  239. day: 'MMMM YYYY',
  240. month: 'YYYY',
  241. year: ''
  242. }
  243. },
  244. height: '',
  245. locale: '',
  246. max: '',
  247. maxHeight: '',
  248. maxMinorChars: [7, 0, 20, 1],
  249. min: '',
  250. minHeight: '',
  251. moveable:true,
  252. orientation: ['both', 'bottom', 'top'],
  253. showCurrentTime: false,
  254. showMajorLabels: true,
  255. showMinorLabels: true,
  256. start: '',
  257. width: '100%',
  258. zoomable: true,
  259. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  260. zoomMax: [315360000000000, 10, 315360000000000, 1],
  261. zoomMin: [10, 10, 315360000000000, 1]
  262. }
  263. };
  264. export {allOptions, configureOptions};