Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

饼图在显示设置scale nice=true 后,某些数据下饼图无法闭合 #3304

Closed
1 task
tywei90 opened this issue Feb 28, 2021 · 5 comments
Closed
1 task

Comments

@tywei90
Copy link

tywei90 commented Feb 28, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://antv-g2.gitee.io/zh/examples/case/pie#pie3

Steps to reproduce

直接粘贴如下代码运行即可:

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

const data = [
{ type: '一线城市', value: 3 },
{ type: '二线城市', value: 4 },
];
const chart = new Chart({
container: 'container',
autoFit: true,
height: 500,
});
chart.data(data);

chart.coordinate('theta', {
radius: 0.75
});
chart.tooltip({
showMarkers: false
});

chart.scale('value', {nice: true});

const interval = chart
.interval()
.adjust('stack')
.position('value')
.color('type')

chart.interaction('element-single-selected');

chart.render();

Environment Info
g2 4.1.12
System -
Browser -
@hustcc
Copy link
Member

hustcc commented Mar 1, 2021

你为啥要设置 nice ?

@tywei90
Copy link
Author

tywei90 commented Mar 1, 2021

你为啥要设置 nice ?

我看v3版本不是默认nice=true吗?在v4版本设置了就会有问题

@hustcc
Copy link
Member

hustcc commented Mar 2, 2021

不设置吧,对饼图,nice 并没有意义~ v4 的 nice 和 v3 的不一样了~~~

@tywei90
Copy link
Author

tywei90 commented Mar 3, 2021

不设置吧,对饼图,nice 并没有意义~ v4 的 nice 和 v3 的不一样了~~~

有啥不一样,愿闻其详~

@pearmini
Copy link
Member

nice 的目的是为了生成可读性强的坐标刻度(1,2,5的倍数),nice 之后会调整数据的范围,用于生成合适的 ticks,比较典型的使用场景是折线图、条形图图的 y 轴。饼图这种情况不需要坐标刻度,所以不需要 nice。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants