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.

279 lines
7.0 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  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 object = 'object';
  13. let dom = 'dom';
  14. let fn = 'function';
  15. let undef = 'undefined';
  16. let allOptions = {
  17. canvas: {
  18. width: {string},
  19. height: {string},
  20. autoResize: {boolean},
  21. __type__: {object}
  22. },
  23. rendering: {
  24. hideEdgesOnDrag: {boolean},
  25. hideNodesOnDrag: {boolean},
  26. __type__: {object}
  27. },
  28. clustering: {},
  29. configure: {
  30. filter: {boolean,string:['nodes','edges','layout','physics','manipulation','interaction','selection','rendering'],array},
  31. container: {dom},
  32. __type__: {object,string,array,boolean}
  33. },
  34. edges: {
  35. arrows: {
  36. to: {enabled: {boolean}, scaleFactor: {number}, __type__: {object}},
  37. middle: {enabled: {boolean}, scaleFactor: {number}, __type__: {object}},
  38. from: {enabled: {boolean}, scaleFactor: {number}, __type__: {object}},
  39. __type__: {string:['from','to','middle'],object}
  40. },
  41. color: {
  42. color: {string},
  43. highlight: {string},
  44. hover: {string},
  45. inherit: {string:['from','to','both'],boolean},
  46. opacity: {number},
  47. __type__: {object}
  48. },
  49. dashes: {
  50. enabled: {boolean},
  51. pattern: {array},
  52. __type__: {boolean,object}
  53. },
  54. font: {
  55. color: {string},
  56. size: {number}, // px
  57. face: {string},
  58. background: {string},
  59. stroke: {number}, // px
  60. strokeColor: {string},
  61. align: {string:['horizontal','top','middle','bottom']},
  62. __type__: {object,string}
  63. },
  64. hidden: {boolean},
  65. hoverWidth: {fn,number},
  66. label: {string,undef},
  67. length: {number,undef},
  68. physics: {boolean},
  69. scaling: {
  70. min: {number},
  71. max: {number},
  72. label: {
  73. enabled: {boolean},
  74. min: {number},
  75. max: {number},
  76. maxVisible: {number},
  77. drawThreshold: {number},
  78. __type__: {object,boolean}
  79. },
  80. customScalingFunction: {fn},
  81. __type__: {object}
  82. },
  83. selectionWidth: {fn,number},
  84. selfReferenceSize: {number},
  85. shadow: {
  86. enabled: {boolean},
  87. size: {number},
  88. x: {number},
  89. y: {number},
  90. __type__: {object,boolean}
  91. },
  92. smooth: {
  93. enabled: {boolean},
  94. dynamic: {boolean},
  95. type: {string},
  96. roundness: {number},
  97. __type__: {object,boolean}
  98. },
  99. title: {string, undef},
  100. width: {number},
  101. value: {number, undef},
  102. __type__: {object}
  103. },
  104. groups: {
  105. useDefaultGroups: {boolean},
  106. __any__: ['__ref__','nodes'],
  107. __type__: {object}
  108. },
  109. interaction: {
  110. dragNodes: {boolean},
  111. dragView: {boolean},
  112. zoomView: {boolean},
  113. hoverEnabled: {boolean},
  114. navigationButtons: {boolean},
  115. tooltipDelay: {number},
  116. keyboard: {
  117. enabled: {boolean},
  118. speed: {x: {number}, y: {number}, zoom: {number}, __type__: {object}},
  119. bindToWindow: {boolean},
  120. __type__: {object,boolean}
  121. },
  122. __type__: {object}
  123. },
  124. layout: {
  125. randomSeed: {undef,number},
  126. hierarchical: {
  127. enabled: {boolean},
  128. levelSeparation: {number},
  129. direction: {string:['UD','DU','LR','RL']}, // UD, DU, LR, RL
  130. sortMethod: {string:['hubsize','directed']}, // hubsize, directed
  131. __type__: {object,boolean}
  132. },
  133. __type__: {object}
  134. },
  135. manipulation: {
  136. enabled: {boolean},
  137. initiallyActive: {boolean},
  138. locale: {string},
  139. locales: {object},
  140. addNode: {boolean,fn},
  141. addEdge: {boolean,fn},
  142. editNode: {fn},
  143. editEdge: {boolean,fn},
  144. deleteNode: {boolean,fn},
  145. deleteEdge: {boolean,fn},
  146. controlNodeStyle: ['__ref__','nodes'],
  147. __type__: {object,boolean}
  148. },
  149. nodes: {
  150. borderWidth: {number},
  151. borderWidthSelected: {number,undef},
  152. brokenImage: {string,undef},
  153. color: {
  154. border: {string},
  155. background: {string},
  156. highlight: {
  157. border: {string},
  158. background: {string},
  159. __type__: {object,string}
  160. },
  161. hover: {
  162. border: {string},
  163. background: {string},
  164. __type__: {object,string}
  165. },
  166. __type__: {object,string}
  167. },
  168. fixed: {
  169. x: {boolean},
  170. y: {boolean},
  171. __type__: {object,boolean}
  172. },
  173. font: {
  174. color: {string},
  175. size: {number}, // px
  176. face: {string},
  177. background: {string},
  178. stroke: {number}, // px
  179. strokeColor: {string},
  180. __type__: {object,string}
  181. },
  182. group: {string,number,undef},
  183. hidden: {boolean},
  184. icon: {
  185. face: {string},
  186. code: {string}, //'\uf007',
  187. size: {number}, //50,
  188. color: {string},
  189. __type__: {object}
  190. },
  191. id: {string, number},
  192. image: {string,undef}, // --> URL
  193. label: {string,undef},
  194. level: {number,undef},
  195. mass: {number},
  196. physics: {boolean},
  197. scaling: {
  198. min: {number},
  199. max: {number},
  200. label: {
  201. enabled: {boolean},
  202. min: {number},
  203. max: {number},
  204. maxVisible: {number},
  205. drawThreshold: {number},
  206. __type__: {object, boolean}
  207. },
  208. customScalingFunction: {fn},
  209. __type__: {object}
  210. },
  211. shadow: {
  212. enabled: {boolean},
  213. size: {number},
  214. x: {number},
  215. y: {number},
  216. __type__: {object,boolean}
  217. },
  218. shape: {string:['ellipse', 'circle', 'database', 'box', 'text','image', 'circularImage','diamond', 'dot', 'star', 'triangle','triangleDown', 'square','icon']},
  219. size: {number},
  220. title: {string,undef},
  221. value: {number,undef},
  222. x: {number},
  223. y: {number},
  224. __type__: {object}
  225. },
  226. physics: {
  227. barnesHut: {
  228. gravitationalConstant: {number},
  229. centralGravity: {number},
  230. springLength: {number},
  231. springConstant: {number},
  232. damping: {number},
  233. __type__: {object}
  234. },
  235. repulsion: {
  236. centralGravity: {number},
  237. springLength: {number},
  238. springConstant: {number},
  239. nodeDistance: {number},
  240. damping: {number},
  241. __type__: {object}
  242. },
  243. hierarchicalRepulsion: {
  244. centralGravity: {number},
  245. springLength: {number},
  246. springConstant: {number},
  247. nodeDistance: {number},
  248. damping: {number},
  249. __type__: {object}
  250. },
  251. maxVelocity: {number},
  252. minVelocity: {number}, // px/s
  253. solver: {string:['barnesHut','repulsion','hierarchicalRepulsion']},
  254. stabilization: {
  255. enabled: {boolean},
  256. iterations: {number}, // maximum number of iteration to stabilize
  257. updateInterval: {number},
  258. onlyDynamicEdges: {boolean},
  259. fit: {boolean},
  260. __type__: {object,boolean}
  261. },
  262. timestep: {number},
  263. __type__: {object,boolean}
  264. },
  265. selection: {
  266. selectable: {boolean},
  267. selectConnectedEdges: {boolean},
  268. __type__: {object}
  269. },
  270. view: {},
  271. __type__: {object}
  272. };
  273. allOptions.groups.__any__ = allOptions.nodes;
  274. allOptions.manipulation.controlNodeStyle = allOptions.nodes;
  275. export default allOptions;