How to use the @antv/util.has function in @antv/util

To help you get started, we’ve selected a few @antv/util 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 / G2Plot / src / plots / radar / RadarLayer.ts View on Github external
protected _coord() {
    const props = this.initialProps;
    const coordConfig = {
      type: 'polar' as CoordinateType,
      cfg: {
        radius: 1.0, // default radius值
      },
    };
    if (_.has(props, 'radius')) {
      coordConfig.cfg.radius = props.radius;
    }
    this.setConfig('coord', coordConfig);
  }
github antvis / G2Plot / src / components / label / parser.ts View on Github external
_.each(mapper, (m) => {
      if (_.has(props, m)) {
        config[m] = props[m];
        count++;
      }
    });
    // 如用户没有设置offset,而label position又为middle时,则默认设置offset为0
github antvis / G2Plot / src / plots / percentage-stack-bar / layer.ts View on Github external
_.each(originData, (d) => {
      const sumField = d[yField];
      if (!_.has(sum, sumField)) {
        sum[sumField] = 0;
      }
      sum[sumField] += Number.parseFloat(d[xField]);
    });
    // step2: 获取每一条数据yField的值在对应xField数值总和的占比
github antvis / G2Plot / src / plots / column / layer-refactor.ts View on Github external
protected scale() {
    const { options } = this;
    const scales = {};
    /** 配置x-scale */
    scales[options.xField] = {};
    if (_.has(options, 'xAxis')) {
      extractScale(scales[options.xField], options.xAxis);
    }
    /** 配置y-scale */
    scales[options.yField] = {};
    if (_.has(options, 'yAxis')) {
      extractScale(scales[options.yField], options.yAxis);
    }
    this.setConfig('scales', scales);
    super.scale();
  }
github antvis / G2Plot / src / geoms / line / main.ts View on Github external
public parseColor() {
    const props = this.plot.initialProps;
    const config: DataPointType = {};
    if (props.seriesField) {
      config.fields = [props.seriesField];
    }
    if (_.has(props, 'color')) {
      const color = props.color;
      if (_.isString(color)) {
        config.values = [color];
      } else if (_.isFunction(color)) {
        config.callback = color;
      } else {
        config.values = color as [];
      }
    }

    this.config.color = config;
  }
github antvis / G2Plot / src / sparkline / progress / layer.ts View on Github external
protected addGeometry() {
    const props = this.options;
    const bar = getGeom('interval', 'main', {
      positionFields: [props.yField, props.xField],
      plot: this,
    });
    bar.adjust = [
      {
        type: 'stack',
      },
    ];
    if (_.has(props, 'animation')) {
      bar.animate = props.animation;
    }
    this.setConfig('element', bar);
  }
github antvis / G2Plot / src / plots / radar / layer.ts View on Github external
protected scale() {
    const props = this.options;
    const scales = {};
    /** 配置x-scale */
    scales[props.angleField] = {};
    if (_.has(props, 'angleAxis')) {
      extractScale(scales[props.angleField], props.angleAxis);
    }
    /** 配置y-scale */
    scales[props.radiusField] = {};
    if (_.has(props, 'radiusAxis')) {
      extractScale(scales[props.radiusField], props.radiusAxis);
    }
    this.setConfig('scales', scales);
    super.scale();
  }
github antvis / G2Plot / src / plots / bubble / layer.ts View on Github external
protected scale() {
    const props = this.options;
    const scales = {};
    /** 配置x-scale */
    scales[props.xField] = {};
    if (_.has(props, 'xAxis')) {
      extractScale(scales[props.xField], props.xAxis);
    }
    /** 配置y-scale */
    scales[props.yField] = {};
    if (_.has(props, 'yAxis')) {
      extractScale(scales[props.yField], props.yAxis);
    }
    this.setConfig('scales', scales);
    super.scale();
  }
github antvis / G2Plot / src / combo-plots / util / adjustColorConfig.ts View on Github external
export function isSingleGraph(type: string, props: ViewLayerConfig) {
  if (_.contains(SINGLE_TYPE, type)) {
    if (type === 'line' && _.has(props, 'seriesField')) {
      return false;
    }
    if (type === 'column' && _.has(props, 'colorField')) {
      return false;
    }
    return true;
  }
  return false;
}
github antvis / G2Plot / src / plots / bubble / layer.ts View on Github external
protected scale() {
    const props = this.options;
    const scales = {};
    /** 配置x-scale */
    scales[props.xField] = {};
    if (_.has(props, 'xAxis')) {
      extractScale(scales[props.xField], props.xAxis);
    }
    /** 配置y-scale */
    scales[props.yField] = {};
    if (_.has(props, 'yAxis')) {
      extractScale(scales[props.yField], props.yAxis);
    }
    this.setConfig('scales', scales);
    super.scale();
  }