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.

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