How to use the @antv/g2.Util function in @antv/g2

To help you get started, we’ve selected a few @antv/g2 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 artiely / element-admin / src / views / chart / Calendar.vue View on Github external
_chart() {
      const Shape = G2.Shape
      const Util = G2.Util
      Shape.registerShape('polygon', 'boundary-polygon', {
        draw(cfg, container) {
          if (!Util.isEmpty(cfg.points)) {
            const attrs = {
              stroke: '#fff',
              lineWidth: 1,
              fill: cfg.color,
              fillOpacity: cfg.opacity
            }
            const points = cfg.points
            const path = [
              ['M', points[0].x, points[0].y],
              ['L', points[1].x, points[1].y],
              ['L', points[2].x, points[2].y],
              ['L', points[3].x, points[3].y],
              ['Z']
github viserjs / viser / packages / viser / src / shapes / Waterfall.ts View on Github external
function getFillAttrs(cfg: any) {
  const defaultAttrs = G2.Global.shape.interval;
  const attrs = G2.Util.mix({}, defaultAttrs, {
    fill: cfg.color,
    stroke: cfg.color,
    fillOpacity: cfg.opacity,
  }, cfg.style);
  return attrs;
}
github viserjs / viser / packages / viser / src / shapes / Waterfall.ts View on Github external
drawShape(cfg: any, group: any) {
      const attrs = getFillAttrs(cfg);
      let rectPath = getRectPath(cfg.points);
      rectPath = this.parsePath(rectPath);
      const interval = group.addShape('path', {
        attrs: G2.Util.mix(attrs, {
          path: rectPath,
        }),
      });

      if (cfg.nextPoints) {
        let linkPath = [
          ['M', cfg.points[2].x, cfg.points[2].y],
          ['L', cfg.nextPoints[0].x, cfg.nextPoints[0].y],
        ];

        if (cfg.nextPoints[0].y === 0) {
          linkPath[1] = ['L', cfg.nextPoints[1].x, cfg.nextPoints[1].y];
        }

        linkPath = this.parsePath(linkPath);
        group.addShape('path', {