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
4.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 fn = 'function';
  17. let nada = 'null';
  18. let undef = 'undefined';
  19. let any = 'any';
  20. let allOptions = {
  21. configure: {
  22. enabled: {boolean},
  23. filter: {boolean,fn},
  24. container: {dom},
  25. __type__: {object,boolean,fn}
  26. },
  27. //globals :
  28. align: {string},
  29. autoResize: {boolean},
  30. clickToUse: {boolean},
  31. dataAttributes: {string, array},
  32. editable: {
  33. add: {boolean, undef},
  34. remove: {boolean, undef},
  35. updateGroup: {boolean, undef},
  36. updateTime: {boolean, undef},
  37. __type__: {boolean, object}
  38. },
  39. end: {number, date, string, moment},
  40. format: {
  41. minorLabels: {
  42. millisecond: {string,undef},
  43. second: {string,undef},
  44. minute: {string,undef},
  45. hour: {string,undef},
  46. weekday: {string,undef},
  47. day: {string,undef},
  48. month: {string,undef},
  49. year: {string,undef},
  50. __type__: {object}
  51. },
  52. majorLabels: {
  53. millisecond: {string,undef},
  54. second: {string,undef},
  55. minute: {string,undef},
  56. hour: {string,undef},
  57. weekday: {string,undef},
  58. day: {string,undef},
  59. month: {string,undef},
  60. year: {string,undef},
  61. __type__: {object}
  62. },
  63. __type__: {object}
  64. },
  65. groupOrder: {string, fn},
  66. height: {string, number},
  67. hiddenDates: {object, array},
  68. locale:{string},
  69. locales:{
  70. __any__: {object},
  71. __type__: {object}
  72. },
  73. margin: {
  74. axis: {number},
  75. item: {
  76. horizontal: {number,undef},
  77. vertical: {number,undef},
  78. __type__: {object,number}
  79. },
  80. __type__: {object,number}
  81. },
  82. max: {date, number, string, moment},
  83. maxHeight: {number, string},
  84. min: {date, number, string, moment},
  85. minHeight: {number, string},
  86. moveable: {boolean},
  87. multiselect: {boolean},
  88. onAdd: {fn},
  89. onUpdate: {fn},
  90. onMove: {fn},
  91. onMoving: {fn},
  92. onRemove: {fn},
  93. order: {fn},
  94. orientation: {
  95. axis: {string,undef},
  96. item: {string,undef},
  97. __type__: {string, object}
  98. },
  99. selectable: {boolean},
  100. showCurrentTime: {boolean},
  101. showMajorLabels: {boolean},
  102. showMinorLabels: {boolean},
  103. stack: {boolean},
  104. snap: {fn, nada},
  105. start: {date, number, string, moment},
  106. template: {fn},
  107. timeAxis: {
  108. scale: {string,undef},
  109. step: {number,undef},
  110. __type__: {object}
  111. },
  112. type: {string},
  113. width: {string, number},
  114. zoomable: {boolean},
  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, fn},
  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: {fn},
  172. //onUpdate: {fn},
  173. //onMove: {fn},
  174. //onMoving: {fn},
  175. //onRename: {fn},
  176. //order: {fn},
  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: {fn, nada},
  187. start: '',
  188. //template: {fn},
  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. zoomMax: [315360000000000, 10, 315360000000000, 1],
  197. zoomMin: [10, 10, 315360000000000, 1]
  198. }
  199. };
  200. export {allOptions, configureOptions};