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.

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