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.

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