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.

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