How to use the @antv/g2.getTheme 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 / __tests__ / unit / miniLineShape-spec.ts View on Github external
index = i;
    }
  }

  if (max > threshold) {
    const list1 = DouglasPeucker(points.slice(0, index + 1), threshold);
    const list2 = DouglasPeucker(points.slice(index, points.length), threshold);
    result = list1.concat(list2);
  } else {
    result = [points[0], points[points.length - 1]];
  }

  return result;
}

const theme = getTheme('default');

describe('mini line shape', () => {
  const canvasDiv = document.createElement('div');
  canvasDiv.style.width = '200px';
  canvasDiv.style.height = '100px';
  canvasDiv.id = 'canvas';
  document.body.appendChild(canvasDiv);
  const canvas = new Canvas({
    containerDOM: canvasDiv,
    width: 200,
    height: 100,
  });
  it('test', () => {
    const plot = new G2.View({
      canvas,
      container: canvas.addGroup(),
github antvis / G2 / examples / pie / rose / demo / donut-rose.js View on Github external
autoFit: true,
  height: 500,
});
chart.data(data);
chart.coordinate('polar', {
  innerRadius: 0.2,
});
chart.legend('year', {
  position: 'right',
  offsetX: -100,
});
chart.axis(false);
chart
  .interval()
  .position('year*population')
  .color('year', getTheme().colors_20)
  .style({
    lineWidth: 1,
    stroke: '#fff',
  });
chart.render();
github antvis / G2 / examples / pie / rose / demo / color-rose.js View on Github external
const chart = new Chart({
  container: 'container',
  autoFit: true,
  height: 500,
});
chart.data(data);
chart.coordinate('polar');
chart.legend('year', {
  position: 'right',
});
chart.axis(false);
chart
  .interval()
  .position('year*population')
  .color('year', getTheme().colors_20)
  .style({
    lineWidth: 1,
    stroke: '#fff',
  });
chart.render();