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.

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