Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id="graph"></div>




                // 定义数据源
const data = {
  // 点集
  nodes: [
      id: "node1",
      x: 100,
      y: 100
      id: "node2",
      x: 300,
      y: 100
  // 边集
  edges: [
    // 表示一条从 node1 节点连接到 node2 节点的边
      source: "node1",
      target: "node2"
// 创建 G6 图实例
const graph = new G6.Graph({
  container: "graph", // 指定图画布的容器 id,与第 11 行的容器对应
  // 画布宽高
  width: 800,
  height: 500,
  modes: {
    default: [
      // 'brush-select'
  defaultEdge: {
    type: 'quadratic',
    style: {
      stroke: '#F6BD16',
      lineWidth: 2,
  linkCenter: true
// 读取数据;
// 渲染图

// 用于处理连线重叠
graph.on('aftercreateedge', (e) => {
  const edges =;
  graph.getEdges().forEach((edge, i) => {
    graph.updateItem(edge, {
      curveOffset: edges[i].curveOffset,
      curvePosition: edges[i].curvePosition,