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.

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