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.

226 lines
6.4 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. multiselectPerGroup: {boolean},
  99. onAdd: {'function': 'function'},
  100. onUpdate: {'function': 'function'},
  101. onMove: {'function': 'function'},
  102. onMoving: {'function': 'function'},
  103. onRemove: {'function': 'function'},
  104. onAddGroup: {'function': 'function'},
  105. onMoveGroup: {'function': 'function'},
  106. onRemoveGroup: {'function': 'function'},
  107. order: {'function': 'function'},
  108. orientation: {
  109. axis: {string,'undefined': 'undefined'},
  110. item: {string,'undefined': 'undefined'},
  111. __type__: {string, object}
  112. },
  113. selectable: {boolean},
  114. showCurrentTime: {boolean},
  115. showMajorLabels: {boolean},
  116. showMinorLabels: {boolean},
  117. stack: {boolean},
  118. snap: {'function': 'function', 'null': 'null'},
  119. start: {date, number, string, moment},
  120. template: {'function': 'function'},
  121. groupTemplate: {'function': 'function'},
  122. timeAxis: {
  123. scale: {string,'undefined': 'undefined'},
  124. step: {number,'undefined': 'undefined'},
  125. __type__: {object}
  126. },
  127. type: {string},
  128. width: {string, number},
  129. zoomable: {boolean},
  130. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  131. zoomMax: {number},
  132. zoomMin: {number},
  133. __type__: {object}
  134. };
  135. let configureOptions = {
  136. global: {
  137. align: ['center', 'left', 'right'],
  138. autoResize: true,
  139. throttleRedraw: [10, 0, 1000, 10],
  140. clickToUse: false,
  141. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  142. editable: {
  143. add: false,
  144. remove: false,
  145. updateGroup: false,
  146. updateTime: false
  147. },
  148. end: '',
  149. format: {
  150. minorLabels: {
  151. millisecond:'SSS',
  152. second: 's',
  153. minute: 'HH:mm',
  154. hour: 'HH:mm',
  155. weekday: 'ddd D',
  156. day: 'D',
  157. month: 'MMM',
  158. year: 'YYYY'
  159. },
  160. majorLabels: {
  161. millisecond:'HH:mm:ss',
  162. second: 'D MMMM HH:mm',
  163. minute: 'ddd D MMMM',
  164. hour: 'ddd D MMMM',
  165. weekday: 'MMMM YYYY',
  166. day: 'MMMM YYYY',
  167. month: 'YYYY',
  168. year: ''
  169. }
  170. },
  171. //groupOrder: {string, 'function': 'function'},
  172. groupsDraggable: false,
  173. height: '',
  174. //hiddenDates: {object, array},
  175. locale: '',
  176. margin: {
  177. axis: [20, 0, 100, 1],
  178. item: {
  179. horizontal: [10, 0, 100, 1],
  180. vertical: [10, 0, 100, 1]
  181. }
  182. },
  183. max: '',
  184. maxHeight: '',
  185. min: '',
  186. minHeight: '',
  187. moveable: false,
  188. multiselect: false,
  189. multiselectPerGroup: false,
  190. //onAdd: {'function': 'function'},
  191. //onUpdate: {'function': 'function'},
  192. //onMove: {'function': 'function'},
  193. //onMoving: {'function': 'function'},
  194. //onRename: {'function': 'function'},
  195. //order: {'function': 'function'},
  196. orientation: {
  197. axis: ['both', 'bottom', 'top'],
  198. item: ['bottom', 'top']
  199. },
  200. selectable: true,
  201. showCurrentTime: false,
  202. showMajorLabels: true,
  203. showMinorLabels: true,
  204. stack: true,
  205. //snap: {'function': 'function', nada},
  206. start: '',
  207. //template: {'function': 'function'},
  208. //timeAxis: {
  209. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  210. // step: [1, 1, 10, 1]
  211. //},
  212. type: ['box', 'point', 'range', 'background'],
  213. width: '100%',
  214. zoomable: true,
  215. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  216. zoomMax: [315360000000000, 10, 315360000000000, 1],
  217. zoomMin: [10, 10, 315360000000000, 1]
  218. }
  219. };
  220. export {allOptions, configureOptions};