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.

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