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.

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