g6/docs/api/graphLayout/random.en.md
2020-11-13 22:33:15 +08:00

1.2 KiB

title order
Random 1

Random is the default layout in G6. It will take effect when layout is not assigned to the Graph instance and there is no position information in node data.

img
const graph = new G6.Graph({
  container: 'mountNode',
  width: 1000,
  height: 600,
  layout: {
    type: 'random',
    width: 300,
    height: 300,
  },
});

layoutCfg.center

Type: Array
Example: [ 0, 0 ]
Default: The center of the graph
Required: false
Description: The center of the layout

layoutCfg.width

Type: Number
Default: The width of the graph
Required: false
Description: The width of the layout

layoutCfg.height

Type: Number
Default: The height of the graph
Required: false
Description: The height of the layout

layoutCfg.workerEnabled

Type: Boolean
Default: false
Required: false
Description: Whether to enable the web-worker in case layout calculation takes too long to block page interaction