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

水平圆角柱状图展示有错误 #4761

Closed
pearmini opened this issue Mar 13, 2023 · 1 comment · Fixed by #4764
Closed

水平圆角柱状图展示有错误 #4761

pearmini opened this issue Mar 13, 2023 · 1 comment · Fixed by #4764
Assignees
Labels

Comments

@pearmini
Copy link
Member

pearmini commented Mar 13, 2023

水平圆角柱状图

当 coordinate 转置之后,圆角展示不正确

问题复现

image

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

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

chart.coordinate({ transform: [{ type: 'transpose' }] });

chart
  .interval()
  .data({
    type: 'fetch',
    value: 'https://assets.antv.antgroup.com/g2/penguins.json',
  })
  .transform({ type: 'groupColor', y: 'count' })
  .transform({ type: 'stackY' })
  .transform({ type: 'normalizeY' })
  .axis('y', { labelFormatter: '.0%' })
  .encode('color', 'sex')
  .label({ text: 'sex', position: 'inside' })
  .tooltip({ channel: 'y', valueFormatter: '.0%' })
  .style('radius', 10);

chart.render();

问题原因

interval 的 shape 在绘制圆角的时候没有考虑转置的情况。

// src/shape/interval/color.ts

const extendedStyle = {
  radius,
  radiusTopLeft: first ? radiusTopLeft : innerRadiusTopLeft, // 需要考虑转置
  radiusTopRight: first ? radiusTopRight : innerRadiusTopRight,
  radiusBottomRight: last ? radiusBottomRight : innerRadiusBottomRight,
  radiusBottomLeft: last ? radiusBottomLeft : innerRadiusBottomLeft,
  inset,
  insetLeft,
  insetRight,
  insetBottom,
  insetTop,
};

解决步骤

新增一个测试例子,参考这个例子:__tests__/plots/static/penguins-interval-group-color.ts

版本

5.0.0-rc.1

@wuhaiyang
Copy link
Contributor

这个问题 我来跟进修复

pearmini pushed a commit that referenced this issue Mar 15, 2023
Co-authored-by: wuding.why <wuding.why@alibaba-inc.com>
hustcc pushed a commit that referenced this issue May 16, 2023
Co-authored-by: wuding.why <wuding.why@alibaba-inc.com>
hustcc pushed a commit that referenced this issue May 16, 2023
Co-authored-by: wuding.why <wuding.why@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants