Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


Save Automatically?

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="mountNode"></div>





 * Tamplate has default install the newest G6 && G6Plugins as
 * if you can not access this url above you can install By you own

 * 模版已经默认按以下链接安装了最新版 G6 和 G6Plugins
 * 如果你无法访问上述链接,你需要自己手动安装能访问的链接安装 G6 
G6.registerGuide('tag', {
  draw(item) {
    const group = item.getGraphicGroup();
    const model = item.getModel();
    const {nodeId, label} = model;
    const graph = item.getGraph();
    const node = graph.find(nodeId);
    const nodeBox = node.getBBox();
    const dy = 32;
    const labelMargin = [8, 16];
    const labelShape = group.addShape('text', {
      attrs: {
        x: nodeBox.centerX,
        y: nodeBox.minY - dy - 8,
        text: label,
        fill: '#333',
        textAlign: 'center'
    const labelBox = labelShape.getBBox();
    const backRect = group.addShape('path', {
      attrs: {
        path: [
          ['M', labelBox.minX - labelMargin[1], labelBox.minY - labelMargin[0]],
          ['L', labelBox.maxX + labelMargin[1], labelBox.minY - labelMargin[0]],
          ['L', labelBox.maxX + labelMargin[1], labelBox.maxY + labelMargin[0]],
          ['L', labelBox.minX - labelMargin[1], labelBox.maxY + labelMargin[0]],
        stroke: 'red'
    group.addShape('path', {
      attrs: {
        path: [
          ['M', nodeBox.centerX, nodeBox.minY - dy],
          ['L', nodeBox.centerX, nodeBox.minY]
        stroke: 'red',
        lineDash: [2, 2],
        endArrow: true
    return backRect;
const data = {
  nodes: [{
    id: 'node1',
    x: 100,
    y: 200
    id: 'node2',
    x: 300,
    y: 200
  edges: [{
    id: 'edge1',
    target: 'node2',
    source: 'node1'
const graph = new G6.Graph({
  container: 'mountNode',
  width: 500,
  height: 500
graph.add('guide', {
  shape: 'tag',
  nodeId: 'node1',
  label: '这是 node1'