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.

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