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.

260 lines
6.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. yAxisOrientation: {string:['left','right']},
  29. defaultGroup: {string},
  30. sort: {boolean},
  31. sampling: {boolean},
  32. stack:{boolean},
  33. graphHeight: {string, number},
  34. shaded: {
  35. enabled: {boolean},
  36. orientation: {string:['bottom','top']}, // top, bottom
  37. __type__: {boolean,object}
  38. },
  39. style: {string:['line','bar','points']}, // line, bar
  40. barChart: {
  41. width: {number},
  42. sideBySide: {boolean},
  43. align: {string:['left','center','right']},
  44. __type__: {object}
  45. },
  46. interpolation: {
  47. enabled: {boolean},
  48. parametrization: {string:['centripetal', 'chordal','uniform']}, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  49. alpha: {number},
  50. __type__: {object,boolean}
  51. },
  52. drawPoints: {
  53. enabled: {boolean},
  54. size: {number},
  55. style: {string:['square','circle']}, // square, circle
  56. __type__: {object,boolean}
  57. },
  58. dataAxis: {
  59. showMinorLabels: {boolean},
  60. showMajorLabels: {boolean},
  61. icons: {boolean},
  62. width: {string, number},
  63. visible: {boolean},
  64. alignZeros: {boolean},
  65. left:{
  66. range: {min:{number},max:{number},__type__: {object}},
  67. format: {fn},
  68. title: {text:{string,number},style:{string},__type__: {object}},
  69. __type__: {object}
  70. },
  71. right:{
  72. range: {min:{number},max:{number},__type__: {object}},
  73. format: {fn},
  74. title: {text:{string,number},style:{string},__type__: {object}},
  75. __type__: {object}
  76. },
  77. __type__: {object}
  78. },
  79. legend: {
  80. enabled: {boolean},
  81. icons: {boolean},
  82. left: {
  83. visible: {boolean},
  84. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  85. __type__: {object}
  86. },
  87. right: {
  88. visible: {boolean},
  89. position: {string:['top-right','bottom-right','top-left','bottom-left']},
  90. __type__: {object}
  91. },
  92. __type__: {object,boolean}
  93. },
  94. groups: {
  95. visibility: {any},
  96. __type__: {object}
  97. },
  98. autoResize: {boolean},
  99. clickToUse: {boolean},
  100. end: {number, date, string, moment},
  101. format: {
  102. minorLabels: {
  103. millisecond: {string,undef},
  104. second: {string,undef},
  105. minute: {string,undef},
  106. hour: {string,undef},
  107. weekday: {string,undef},
  108. day: {string,undef},
  109. month: {string,undef},
  110. year: {string,undef},
  111. __type__: {object}
  112. },
  113. majorLabels: {
  114. millisecond: {string,undef},
  115. second: {string,undef},
  116. minute: {string,undef},
  117. hour: {string,undef},
  118. weekday: {string,undef},
  119. day: {string,undef},
  120. month: {string,undef},
  121. year: {string,undef},
  122. __type__: {object}
  123. },
  124. __type__: {object}
  125. },
  126. height: {string, number},
  127. hiddenDates: {object, array},
  128. locale:{string},
  129. locales:{
  130. __any__: {object},
  131. __type__: {object}
  132. },
  133. max: {date, number, string, moment},
  134. maxHeight: {number, string},
  135. min: {date, number, string, moment},
  136. minHeight: {number, string},
  137. moveable: {boolean},
  138. multiselect: {boolean},
  139. orientation: {string},
  140. showCurrentTime: {boolean},
  141. showMajorLabels: {boolean},
  142. showMinorLabels: {boolean},
  143. start: {date, number, string, moment},
  144. timeAxis: {
  145. scale: {string,undef},
  146. step: {number,undef},
  147. __type__: {object}
  148. },
  149. width: {string, number},
  150. zoomable: {boolean},
  151. zoomMax: {number},
  152. zoomMin: {number},
  153. __type__: {object}
  154. }
  155. let configureOptions = {
  156. global: {
  157. yAxisOrientation: ['left','right'],
  158. sort: true,
  159. sampling: true,
  160. stack:false,
  161. shaded: {
  162. enabled: false,
  163. orientation: ['top','bottom'] // top, bottom
  164. },
  165. style: ['line','bar','points'], // line, bar
  166. barChart: {
  167. width: [50,5,100,5],
  168. sideBySide: false,
  169. align: ['left','center','right'] // left, center, right
  170. },
  171. interpolation: {
  172. enabled: true,
  173. parametrization: ['centripetal','chordal','uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5)
  174. },
  175. drawPoints: {
  176. enabled: true,
  177. size: [6,2,30,1],
  178. style: 'square' // square, circle
  179. },
  180. dataAxis: {
  181. showMinorLabels: true,
  182. showMajorLabels: true,
  183. icons: false,
  184. width: [40,0,200,1],
  185. visible: true,
  186. alignZeros: true,
  187. left:{
  188. //range: {min:undefined,max:undefined},
  189. //format: function (value) {return value;},
  190. title: {text:'',style:''}
  191. },
  192. right:{
  193. //range: {min:undefined,max:undefined},
  194. //format: function (value) {return value;},
  195. title: {text:'',style:''}
  196. }
  197. },
  198. legend: {
  199. enabled: false,
  200. icons: true,
  201. left: {
  202. visible: true,
  203. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  204. },
  205. right: {
  206. visible: true,
  207. position: ['top-right','bottom-right','top-left','bottom-left'] // top/bottom - left,right
  208. }
  209. },
  210. autoResize: true,
  211. clickToUse: false,
  212. end: '',
  213. format: {
  214. minorLabels: {
  215. millisecond:'SSS',
  216. second: 's',
  217. minute: 'HH:mm',
  218. hour: 'HH:mm',
  219. weekday: 'ddd D',
  220. day: 'D',
  221. month: 'MMM',
  222. year: 'YYYY'
  223. },
  224. majorLabels: {
  225. millisecond:'HH:mm:ss',
  226. second: 'D MMMM HH:mm',
  227. minute: 'ddd D MMMM',
  228. hour: 'ddd D MMMM',
  229. weekday: 'MMMM YYYY',
  230. day: 'MMMM YYYY',
  231. month: 'YYYY',
  232. year: ''
  233. }
  234. },
  235. height: '',
  236. locale: '',
  237. max: '',
  238. maxHeight: '',
  239. min: '',
  240. minHeight: '',
  241. movable:true,
  242. orientation: ['both', 'bottom', 'top'],
  243. showCurrentTime: false,
  244. showMajorLabels: true,
  245. showMinorLabels: true,
  246. start: '',
  247. width: '100%',
  248. zoomable: true,
  249. zoomMax: [315360000000000, 10, 315360000000000, 1],
  250. zoomMin: [10, 10, 315360000000000, 1]
  251. }
  252. };
  253. export {allOptions, configureOptions};