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.

290 lines
7.3 KiB

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