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.

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