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.

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