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.

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