How to use the @antv/g2.Plot 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 antvis / G2Plot / src / plots / line / interaction / range.ts View on Github external
if (!xAxis) {
      throw new Error('Please specify the xAxis!');
    }
    if (!yAxis) {
      throw new Error('Please specify the yAxis!');
    }

    const backgroundChart = this.backgroundChart;
    let type = backgroundChart.type || geom.get('type');
    const color = backgroundChart.color || 'grey';
    if (!_.isArray(type)) {
      type = [type];
    }

    const padding = parsePadding(this.padding);
    const bgChart = new Plot({
      containerDOM: this.container,
      width: this.domWidth,
      height: this.height,
      padding: [0, padding[1], 0, padding[3]],
      animate: false,
    });
    bgChart.data(data);
    bgChart.scale(scales);
    bgChart.axis(false);
    bgChart.tooltip(false);
    bgChart.legend(false);
    _.each(type, (eachType) => {
      bgChart
        .area()
        .position(`${xAxis}*${yAxis}`)
        .color(color)