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.

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