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.

243 lines
7.4 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 bool = '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': bool},
  20. filter: { 'boolean': bool,'function': 'function'},
  21. container: {dom},
  22. __type__: {object, 'boolean': bool,'function': 'function'}
  23. },
  24. //globals :
  25. align: {string},
  26. rtl: { 'boolean': bool, 'undefined': 'undefined'},
  27. rollingMode: { 'boolean': bool, 'undefined': 'undefined'},
  28. verticalScroll: { 'boolean': bool, 'undefined': 'undefined'},
  29. horizontalScroll: { 'boolean': bool, 'undefined': 'undefined'},
  30. autoResize: { 'boolean': bool},
  31. throttleRedraw: {number}, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511
  32. clickToUse: { 'boolean': bool},
  33. dataAttributes: {string, array},
  34. editable: {
  35. add: { 'boolean': bool, 'undefined': 'undefined'},
  36. remove: { 'boolean': bool, 'undefined': 'undefined'},
  37. updateGroup: { 'boolean': bool, 'undefined': 'undefined'},
  38. updateTime: { 'boolean': bool, 'undefined': 'undefined'},
  39. overrideItems: { 'boolean': bool, 'undefined': 'undefined'},
  40. __type__: { 'boolean': bool, object}
  41. },
  42. end: {number, date, string, moment},
  43. format: {
  44. minorLabels: {
  45. millisecond: {string,'undefined': 'undefined'},
  46. second: {string,'undefined': 'undefined'},
  47. minute: {string,'undefined': 'undefined'},
  48. hour: {string,'undefined': 'undefined'},
  49. weekday: {string,'undefined': 'undefined'},
  50. day: {string,'undefined': 'undefined'},
  51. month: {string,'undefined': 'undefined'},
  52. year: {string,'undefined': 'undefined'},
  53. __type__: {object, 'function': 'function'}
  54. },
  55. majorLabels: {
  56. millisecond: {string,'undefined': 'undefined'},
  57. second: {string,'undefined': 'undefined'},
  58. minute: {string,'undefined': 'undefined'},
  59. hour: {string,'undefined': 'undefined'},
  60. weekday: {string,'undefined': 'undefined'},
  61. day: {string,'undefined': 'undefined'},
  62. month: {string,'undefined': 'undefined'},
  63. year: {string,'undefined': 'undefined'},
  64. __type__: {object, 'function': 'function'}
  65. },
  66. __type__: {object}
  67. },
  68. moment: {'function': 'function'},
  69. groupOrder: {string, 'function': 'function'},
  70. groupEditable: {
  71. add: { 'boolean': bool, 'undefined': 'undefined'},
  72. remove: { 'boolean': bool, 'undefined': 'undefined'},
  73. order: { 'boolean': bool, 'undefined': 'undefined'},
  74. __type__: { 'boolean': bool, object}
  75. },
  76. groupOrderSwap: {'function': 'function'},
  77. height: {string, number},
  78. hiddenDates: {
  79. start: {date, number, string, moment},
  80. end: {date, number, string, moment},
  81. repeat: {string},
  82. __type__: {object, array}
  83. },
  84. itemsAlwaysDraggable: { 'boolean': bool},
  85. locale:{string},
  86. locales:{
  87. __any__: {any},
  88. __type__: {object}
  89. },
  90. margin: {
  91. axis: {number},
  92. item: {
  93. horizontal: {number,'undefined': 'undefined'},
  94. vertical: {number,'undefined': 'undefined'},
  95. __type__: {object,number}
  96. },
  97. __type__: {object,number}
  98. },
  99. max: {date, number, string, moment},
  100. maxHeight: {number, string},
  101. maxMinorChars: {number},
  102. min: {date, number, string, moment},
  103. minHeight: {number, string},
  104. moveable: { 'boolean': bool},
  105. multiselect: { 'boolean': bool},
  106. multiselectPerGroup: { 'boolean': bool},
  107. onAdd: {'function': 'function'},
  108. onUpdate: {'function': 'function'},
  109. onMove: {'function': 'function'},
  110. onMoving: {'function': 'function'},
  111. onRemove: {'function': 'function'},
  112. onAddGroup: {'function': 'function'},
  113. onMoveGroup: {'function': 'function'},
  114. onRemoveGroup: {'function': 'function'},
  115. order: {'function': 'function'},
  116. orientation: {
  117. axis: {string,'undefined': 'undefined'},
  118. item: {string,'undefined': 'undefined'},
  119. __type__: {string, object}
  120. },
  121. selectable: { 'boolean': bool},
  122. showCurrentTime: { 'boolean': bool},
  123. showMajorLabels: { 'boolean': bool},
  124. showMinorLabels: { 'boolean': bool},
  125. stack: { 'boolean': bool},
  126. stackSubgroups: { 'boolean': bool},
  127. snap: {'function': 'function', 'null': 'null'},
  128. start: {date, number, string, moment},
  129. template: {'function': 'function'},
  130. groupTemplate: {'function': 'function'},
  131. visibleFrameTemplate: {string, 'function': 'function'},
  132. tooltipOnItemUpdateTime: {
  133. template: {'function': 'function'},
  134. __type__: { 'boolean': bool, object}
  135. },
  136. timeAxis: {
  137. scale: {string,'undefined': 'undefined'},
  138. step: {number,'undefined': 'undefined'},
  139. __type__: {object}
  140. },
  141. type: {string},
  142. width: {string, number},
  143. zoomable: { 'boolean': bool},
  144. zoomKey: {string: ['ctrlKey', 'altKey', 'metaKey', '']},
  145. zoomMax: {number},
  146. zoomMin: {number},
  147. __type__: {object}
  148. };
  149. let configureOptions = {
  150. global: {
  151. align: ['center', 'left', 'right'],
  152. direction: false,
  153. autoResize: true,
  154. clickToUse: false,
  155. // dataAttributes: ['all'], // FIXME: can be 'all' or string[]
  156. editable: {
  157. add: false,
  158. remove: false,
  159. updateGroup: false,
  160. updateTime: false
  161. },
  162. end: '',
  163. format: {
  164. minorLabels: {
  165. millisecond:'SSS',
  166. second: 's',
  167. minute: 'HH:mm',
  168. hour: 'HH:mm',
  169. weekday: 'ddd D',
  170. day: 'D',
  171. month: 'MMM',
  172. year: 'YYYY'
  173. },
  174. majorLabels: {
  175. millisecond:'HH:mm:ss',
  176. second: 'D MMMM HH:mm',
  177. minute: 'ddd D MMMM',
  178. hour: 'ddd D MMMM',
  179. weekday: 'MMMM YYYY',
  180. day: 'MMMM YYYY',
  181. month: 'YYYY',
  182. year: ''
  183. }
  184. },
  185. //groupOrder: {string, 'function': 'function'},
  186. groupsDraggable: false,
  187. height: '',
  188. //hiddenDates: {object, array},
  189. locale: '',
  190. margin: {
  191. axis: [20, 0, 100, 1],
  192. item: {
  193. horizontal: [10, 0, 100, 1],
  194. vertical: [10, 0, 100, 1]
  195. }
  196. },
  197. max: '',
  198. maxHeight: '',
  199. maxMinorChars: [7, 0, 20, 1],
  200. min: '',
  201. minHeight: '',
  202. moveable: false,
  203. multiselect: false,
  204. multiselectPerGroup: false,
  205. //onAdd: {'function': 'function'},
  206. //onUpdate: {'function': 'function'},
  207. //onMove: {'function': 'function'},
  208. //onMoving: {'function': 'function'},
  209. //onRename: {'function': 'function'},
  210. //order: {'function': 'function'},
  211. orientation: {
  212. axis: ['both', 'bottom', 'top'],
  213. item: ['bottom', 'top']
  214. },
  215. selectable: true,
  216. showCurrentTime: false,
  217. showMajorLabels: true,
  218. showMinorLabels: true,
  219. stack: true,
  220. stackSubgroups: true,
  221. //snap: {'function': 'function', nada},
  222. start: '',
  223. //template: {'function': 'function'},
  224. //timeAxis: {
  225. // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'month', 'year'],
  226. // step: [1, 1, 10, 1]
  227. //},
  228. tooltipOnItemUpdateTime: false,
  229. type: ['box', 'point', 'range', 'background'],
  230. width: '100%',
  231. zoomable: true,
  232. zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''],
  233. zoomMax: [315360000000000, 10, 315360000000000, 1],
  234. zoomMin: [10, 10, 315360000000000, 1]
  235. }
  236. };
  237. export {allOptions, configureOptions};