How to use the @antv/g6.Global function in @antv/g6

To help you get started, we’ve selected a few @antv/g6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G6 / examples / shape / customEdge / demo / customPolyline.js View on Github external
getShapeStyle(cfg) {
    const startPoint = cfg.startPoint;
    const endPoint = cfg.endPoint;
    const controlPoints = this.getControlPoints(cfg);
    let points = [ startPoint ]; // 添加起始点
    // 添加控制点
    if (controlPoints) {
      points = points.concat(controlPoints);
    }
    // 添加结束点
    points.push(endPoint);
    const path = this.getPath(points);
    const style = G6.Util.mix({}, G6.Global.defaultEdge.style, {
      stroke: '#BBB',
      lineWidth: 1,
      path,
      startArrow: {
        path: 'M 6,0 L -6,-6 L -3,0 L -6,6 Z',
        d: 6
      },
      endArrow: {
        path: 'M 6,0 L -6,-6 L -3,0 L -6,6 Z',
        d: 6
      }
    }, cfg.style);
    return style;
  }
}, 'line');
github antvis / G6 / examples / net / dagreFlow / demo / basicDagre.js View on Github external
text: cfg.name,
          x: 0,
          y: 0,
          fill: '#00287E',
          fontSize: 14,
          textAlign: 'center',
          textBaseline: 'middle',
          fontWeight: 'bold'
        }
      });
    }
    return rect;
  }
},
'single-shape');
G6.Global.nodeStateStyle.selected = {
  stroke: '#d9d9d9',
  fill: '#5394ef'
};

const width = document.getElementById('container').scrollWidth;
const height = document.getElementById('container').scrollHeight || 500;
const graph = new G6.Graph({
  container: 'container',
  width,
  height,
  layout: {
    type: 'dagre',
    nodesepFunc: d => {
      if (d.id === '3') {
        return 500;
      }