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.

275 lines
8.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 bool = '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': bool},
  20. filter: {'boolean': bool,'function': 'function'},
  21. container: {dom},
  22. __type__: {object,'boolean': bool,'function': 'function'}
  23. },
  24. //globals :
  25. yAxisOrientation: {string:['left','right']},
  26. defaultGroup: {string},
  27. sort: {'boolean': bool},
  28. sampling: {'boolean': bool},
  29. stack:{'boolean': bool},
  30. graphHeight: {string, number},
  31. shaded: {
  32. enabled: {'boolean': bool},
  33. orientation: {string:['bottom','top','zero','group']}, // top, bottom, zero, group
  34. groupId: {object},
  35. __type__: {'boolean': bool,object}
  36. },
  37. style: {string:['line','bar','points']}, // line, bar
  38. barChart: {
  39. width: {number},
  40. minWidth: {number},
  41. sideBySide: {'boolean': bool},
  42. align: {string:['left','center','right']},
  43. __type__: {object}
  44. },
  45. interpolation: {
  46. enabled: {'boolean': bool},
  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': bool}
  50. },
  51. drawPoints: {
  52. enabled: {'boolean': bool},
  53. onRender: { 'function': 'function' },
  54. size: {number},
  55. style: {string:['square','circle']}, // square, circle
  56. __type__: {object,'boolean': bool,'function': 'function'}
  57. },
  58. dataAxis: {
  59. showMinorLabels: {'boolean': bool},
  60. showMajorLabels: {'boolean': bool},
  61. icons: {'boolean': bool},
  62. width: {string, number},
  63. visible: {'boolean': bool},
  64. alignZeros: {'boolean': bool},
  65. left:{
  66. range: {min:{number,'undefined': 'undefined'},max:{number,'undefined': 'undefined'},__type__: {object}},
  67. format: {'function': 'function'},
  68. title: {text:{string,number,'undefined': 'undefined'},style:{string,'undefined': 'undefined'},__type__: {object}},
  69. __type__: {object}
  70. },
  71. right:{
  72. range: {min:{number,'undefined': 'undefined'},max:{number,'undefined': 'undefined'},__type__: {object}},
  73. format: {'function': 'function'},
  74. title: {text:{string,number,'undefined': 'undefined'},style:{string,'undefined': 'undefined'},__type__: {object}},
  75. __type__: {object}
  76. },
  77. __type__: {object}
  78. },
  79. legend: {
  80. enabled: {'boolean': bool},
  81. icons: {'boolean': bool},
  82. left: {
  83. visible: {'boolean': bool},
  84. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  85. __type__: {object}
  86. },
  87. right: {
  88. visible: {'boolean': bool},
  89. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  90. __type__: {object}
  91. },
  92. __type__: {object,'boolean': bool}
  93. },
  94. groups: {
  95. visibility: {any},
  96. __type__: {object}
  97. },
  98. autoResize: {'boolean': bool},
  99. throttleRedraw: {number}, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
  100. clickToUse: {'boolean': bool},
  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': bool},
  146. multiselect: {'boolean': bool},
  147. orientation: {string},
  148. showCurrentTime: {'boolean': bool},
  149. showMajorLabels: {'boolean': bool},
  150. showMinorLabels: {'boolean': bool},
  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': bool},
  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. clickToUse: false,
  223. end: '',
  224. format: {
  225. minorLabels: {
  226. millisecond:'SSS',
  227. second: 's',
  228. minute: 'HH:mm',
  229. hour: 'HH:mm',
  230. weekday: 'ddd D',
  231. day: 'D',
  232. month: 'MMM',
  233. year: 'YYYY'
  234. },
  235. majorLabels: {
  236. millisecond:'HH:mm:ss',
  237. second: 'D MMMM HH:mm',
  238. minute: 'ddd D MMMM',
  239. hour: 'ddd D MMMM',
  240. weekday: 'MMMM YYYY',
  241. day: 'MMMM YYYY',
  242. month: 'YYYY',
  243. year: ''
  244. }
  245. },
  246. height: '',
  247. locale: '',
  248. max: '',
  249. maxHeight: '',
  250. maxMinorChars: [7, 0, 20, 1],
  251. min: '',
  252. minHeight: '',
  253. moveable:true,
  254. orientation: ['both', 'bottom', 'top'],
  255. showCurrentTime: false,
  256. showMajorLabels: true,
  257. showMinorLabels: true,
  258. start: '',
  259. width: '100%',
  260. zoomable: true,
  261. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  262. zoomMax: [315360000000000, 10, 315360000000000, 1],
  263. zoomMin: [10, 10, 315360000000000, 1],
  264. zIndex: 0
  265. }
  266. };
  267. export {allOptions, configureOptions};