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

The size of the circle should be mapped to its area, not its radius(圆形尺寸应该映射为面积而非半径) #2716

Closed
1 task done
neoddish opened this issue Jul 31, 2020 · 6 comments
Assignees

Comments

@neoddish
Copy link
Member

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

What problem does this feature solve?

"The human visual system naturally experiences a disk's size in terms of its area. And the area of a disk—unlike its diameter or circumference—is not proportional to its radius, but to the square of the radius. So if one chooses to scale the disks' radii to the third data values directly, then the apparent size differences among the disks will be non-linear (quadratic) and misleading. To get a properly weighted scale, one must scale each disk's radius to the square root of the corresponding data value "

quoted from https://en.wikipedia.org/wiki/Bubble_chart

What does the proposed API look like?

The api does not need to be changed, it is recommended to modify the internal logic

@visiky
Copy link
Member

visiky commented Aug 2, 2020

确实应该映射为面积,这里 point 映射 size 通道,应该将 sqrt(size) 作为半径

@neoddish
Copy link
Member Author

neoddish commented Aug 2, 2020

包括 heatmap 里面的自定义 shape:square 这些,也都应该映射为面积。

@simaQ @hustcc 看看如何,我们如果统一下心智的话 G2 栈相应的实现、文档都可以更新一下

@hustcc
Copy link
Member

hustcc commented Aug 3, 2020

从图形映射来看,确实是映射到半径了(文档上明确 size 就是指半径即可),但是从业务理解上看,数据映射到面积。

所以在用 G2 这一层:

chart.point().size('value', (size) => sqrt(size))

但是在 G2Plot 这一层,就直接内部包掉,默认用户不感知。


在 echarts 中,也是指定半径大小,然后开发者自己去转数据。

image

@neoddish
Copy link
Member Author

neoddish commented Aug 3, 2020

从图形映射来看,确实是映射到半径了(文档上明确 size 就是指半径即可),但是从业务理解上看,数据映射到面积。

所以在用 G2 这一层:

chart.point().size('value', (size) => sqrt(size))

但是在 G2Plot 这一层,就直接内部包掉,默认用户不感知。

在 echarts 中,也是指定半径大小,然后开发者自己去转数据。

image

结论是?

G2 这层让用户自己去做映射操作,G2Plot 这一层我们默认处理为 sqrt (映射到面积)是么?

@hustcc
Copy link
Member

hustcc commented Aug 3, 2020

是的,我是这想法。

@neoddish
Copy link
Member Author

neoddish commented Aug 3, 2020

是的,我是这想法。

可以,如果没有反对意见,我们就这么搞吧!

@neoddish neoddish closed this as completed Aug 6, 2020
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

4 participants