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.

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