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.

224 lines
6.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 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. align: {string},
  26. autoResize: {boolean},
  27. throttleRedraw: {number},
  28. clickToUse: {boolean},
  29. dataAttributes: {string, array},
  30. editable: {
  31. add: {boolean, 'undefined': 'undefined'},
  32. remove: {boolean, 'undefined': 'undefined'},
  33. updateGroup: {boolean, 'undefined': 'undefined'},
  34. updateTime: {boolean, 'undefined': 'undefined'},
  35. __type__: {boolean, object}
  36. },
  37. end: {number, date, string, moment},
  38. format: {
  39. minorLabels: {
  40. millisecond: {string,'undefined': 'undefined'},
  41. second: {string,'undefined': 'undefined'},
  42. minute: {string,'undefined': 'undefined'},
  43. hour: {string,'undefined': 'undefined'},
  44. weekday: {string,'undefined': 'undefined'},
  45. day: {string,'undefined': 'undefined'},
  46. month: {string,'undefined': 'undefined'},
  47. year: {string,'undefined': 'undefined'},
  48. __type__: {object}
  49. },
  50. majorLabels: {
  51. millisecond: {string,'undefined': 'undefined'},
  52. second: {string,'undefined': 'undefined'},
  53. minute: {string,'undefined': 'undefined'},
  54. hour: {string,'undefined': 'undefined'},
  55. weekday: {string,'undefined': 'undefined'},
  56. day: {string,'undefined': 'undefined'},
  57. month: {string,'undefined': 'undefined'},
  58. year: {string,'undefined': 'undefined'},
  59. __type__: {object}
  60. },
  61. __type__: {object}
  62. },
  63. moment: {'function': 'function'},
  64. groupOrder: {string, 'function': 'function'},
  65. groupEditable: {
  66. add: {boolean, 'undefined': 'undefined'},
  67. remove: {boolean, 'undefined': 'undefined'},
  68. order: {boolean, 'undefined': 'undefined'},
  69. __type__: {boolean, object}
  70. },
  71. groupOrderSwap: {'function': 'function'},
  72. height: {string, number},
  73. hiddenDates: {
  74. start: {date, number, string, moment},
  75. end: {date, number, string, moment},
  76. repeat: {string},
  77. __type__: {object, array}
  78. },
  79. locale:{string},
  80. locales:{
  81. __type__: {object}
  82. },
  83. margin: {
  84. axis: {number},
  85. item: {
  86. horizontal: {number,'undefined': 'undefined'},
  87. vertical: {number,'undefined': 'undefined'},
  88. __type__: {object,number}
  89. },
  90. __type__: {object,number}
  91. },
  92. max: {date, number, string, moment},
  93. maxHeight: {number, string},
  94. min: {date, number, string, moment},
  95. minHeight: {number, string},
  96. moveable: {boolean},
  97. multiselect: {boolean},
  98. onAdd: {'function': 'function'},
  99. onUpdate: {'function': 'function'},
  100. onMove: {'function': 'function'},
  101. onMoving: {'function': 'function'},
  102. onRemove: {'function': 'function'},
  103. onAddGroup: {'function': 'function'},
  104. onMoveGroup: {'function': 'function'},
  105. onRemoveGroup: {'function': 'function'},
  106. order: {'function': 'function'},
  107. orientation: {
  108. axis: {string,'undefined': 'undefined'},
  109. item: {string,'undefined': 'undefined'},
  110. __type__: {string, object}
  111. },
  112. selectable: {boolean},
  113. showCurrentTime: {boolean},
  114. showMajorLabels: {boolean},
  115. showMinorLabels: {boolean},
  116. stack: {boolean},
  117. snap: {'function': 'function', 'null': 'null'},
  118. start: {date, number, string, moment},
  119. template: {'function': 'function'},
  120. groupTemplate: {'function': 'function'},
  121. timeAxis: {
  122. scale: {string,'undefined': 'undefined'},
  123. step: {number,'undefined': 'undefined'},
  124. __type__: {object}
  125. },
  126. type: {string},
  127. width: {string, number},
  128. zoomable: {boolean},
  129. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  130. zoomMax: {number},
  131. zoomMin: {number},
  132. __type__: {object}
  133. };
  134. let configureOptions = {
  135. global: {
  136. align: ['center', 'left', 'right'],
  137. autoResize: true,
  138. throttleRedraw: [10, 0, 1000, 10],
  139. clickToUse: false,
  140. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  141. editable: {
  142. add: false,
  143. remove: false,
  144. updateGroup: false,
  145. updateTime: false
  146. },
  147. end: '',
  148. format: {
  149. minorLabels: {
  150. millisecond:'SSS',
  151. second: 's',
  152. minute: 'HH:mm',
  153. hour: 'HH:mm',
  154. weekday: 'ddd D',
  155. day: 'D',
  156. month: 'MMM',
  157. year: 'YYYY'
  158. },
  159. majorLabels: {
  160. millisecond:'HH:mm:ss',
  161. second: 'D MMMM HH:mm',
  162. minute: 'ddd D MMMM',
  163. hour: 'ddd D MMMM',
  164. weekday: 'MMMM YYYY',
  165. day: 'MMMM YYYY',
  166. month: 'YYYY',
  167. year: ''
  168. }
  169. },
  170. //groupOrder: {string, 'function': 'function'},
  171. groupsDraggable: false,
  172. height: '',
  173. //hiddenDates: {object, array},
  174. locale: '',
  175. margin: {
  176. axis: [20, 0, 100, 1],
  177. item: {
  178. horizontal: [10, 0, 100, 1],
  179. vertical: [10, 0, 100, 1]
  180. }
  181. },
  182. max: '',
  183. maxHeight: '',
  184. min: '',
  185. minHeight: '',
  186. moveable: false,
  187. multiselect: false,
  188. //onAdd: {'function': 'function'},
  189. //onUpdate: {'function': 'function'},
  190. //onMove: {'function': 'function'},
  191. //onMoving: {'function': 'function'},
  192. //onRename: {'function': 'function'},
  193. //order: {'function': 'function'},
  194. orientation: {
  195. axis: ['both', 'bottom', 'top'],
  196. item: ['bottom', 'top']
  197. },
  198. selectable: true,
  199. showCurrentTime: false,
  200. showMajorLabels: true,
  201. showMinorLabels: true,
  202. stack: true,
  203. //snap: {'function': 'function', nada},
  204. start: '',
  205. //template: {'function': 'function'},
  206. //timeAxis: {
  207. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  208. // step: [1, 1, 10, 1]
  209. //},
  210. type: ['box', 'point', 'range', 'background'],
  211. width: '100%',
  212. zoomable: true,
  213. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  214. zoomMax: [315360000000000, 10, 315360000000000, 1],
  215. zoomMin: [10, 10, 315360000000000, 1]
  216. }
  217. };
  218. export {allOptions, configureOptions};