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

圆角玉珏图 的endAngle 看起来配置失效 #5970

Closed
kun6696 opened this issue Dec 21, 2023 · 6 comments
Closed

圆角玉珏图 的endAngle 看起来配置失效 #5970

kun6696 opened this issue Dec 21, 2023 · 6 comments
Assignees

Comments

@kun6696
Copy link
Contributor

kun6696 commented Dec 21, 2023

问题描述

如下重现步骤

重现链接

https://g2.antv.antgroup.com/zh/examples/general/radial/#bar-cornered-radial

重现步骤

1、进去页面
2、复制如下参数

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

const chart = new Chart({
  container: 'container',
  autoFit: true,
});

chart.coordinate({ type: 'radial', startAngle: Math.PI/2, endAngle: 0 });

chart
  .interval()
  .data({
    // Data is collected by the end of 2022.11.09
    value: [
      { name: 'G', star: 814 },
      { name: 'G2', star: 11425 },
      { name: 'G2Plot', star: 2320 },
      { name: 'S2', star: 968 },
      { name: 'F2', star: 7346 },
      { name: 'L7', star: 2888 },
      { name: 'G6', star: 9314 },
      { name: 'X6', star: 3985 },
      { name: 'AVA', star: 1151 },
    ],
    transform: [{ type: 'sortBy', fields: [['star', true]] }],
  })
  .encode('x', 'name')
  .encode('y', 'star')
  .scale('y', { type: 'sqrt' })
  .encode('color', 'name')
  .encode('size', 40)
  .style('radius', 20)
  .label({
    text: 'star',
    position: 'outside',
    autoRotate: true,
    rotateToAlignArc: true,
    dx: 4,
  })
  .axis('x', { title: false })
  .axis('y', false)
  .animate('enter', { type: 'waveIn', duration: 1000 });

chart.render();

3、可以看到有问题的图形,看起来只有最外层的角度是0度的感觉,然后中间的数据也不是按照其值的大小排布的。

预期行为

希望endAngle配置正确

平台

  • 操作系统: [macOS]
  • 网页浏览器: [Google Chrome]

屏幕截图或视频(可选)

image

补充说明(可选)

No response

@pearmini
Copy link
Member

pearmini commented Dec 22, 2023

感兴趣修复一下吗🤣

[中级任务]

@kun6696
Copy link
Contributor Author

kun6696 commented Dec 26, 2023

我先接下来看看

@kun6696
Copy link
Contributor Author

kun6696 commented Dec 29, 2023

这个问题我看了一下,目前能够支持的角度绘制是当endAgnle >= startAngle 并且两个角度在同一周期里是能够满足正确绘制。我这里方案可能有点取巧了,就是关于cordinate 里面具体绘制逻辑我还没看。这个方案是我打算将option的coordinate参数的角度做一个转换。映射到0~2*Math.PI之间。并且 startAngle <= endAngle。代码可以类似这样:
image
在极坐标里面加这样的逻辑。
image
如果可以的话,我就编码了。

@kun6696
Copy link
Contributor Author

kun6696 commented Dec 29, 2023

@pearmini 看一下我上面

@pearmini
Copy link
Member

pearmini commented Jan 3, 2024

@kun6696 我觉得没有问题。

@pearmini
Copy link
Member

pearmini commented Jan 5, 2024

closed by: #6010

@pearmini pearmini closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants