antvis/G2

如何设置环图两段不同区域中间的间隔空间大小 #5973

asz97665 posted onGitHub

问题描述

import { Chart } from '@antv/g2';

const progress = 0.7;

const chart = new Chart({
  container: 'container',
  width: 100,
  height: 100,
});

chart.coordinate({ type: 'theta', innerRadius: 0.7 });

chart
  .interval()
  .data([1, progress])
  .encode('y', (d) => d)
  .encode('color', (d, idx) => idx)
  .scale('y', { domain: [0, 1] })
  .scale('color', { range: ['#000000', '#a0ff03'] })
  .animate('enter', { type: 'waveIn' })
  .axis(false)
  .legend(false);

chart.text().style({
  text: `${progress * 100}%`,
  x: '50%',
  y: '50%',
  textAlign: 'center',
  fontSize: 16,
  fontStyle: 'bold',
});

chart.interaction('tooltip', false);

chart.render();

官方的例子,如果我要让这两段之间有一个白色间隔,如何做

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

边距

No response

补充说明(可选)

No response


@pearmini 帮忙看看 球球了

posted by asz97665 over 1 year ago

可以用 stroke 模拟一下:

.style('stroke', '#fff')
.style('strokeWidth', 2)
posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests