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

无法设置透明度 #6058

Closed
Jungzl opened this issue Jan 23, 2024 · 6 comments · Fixed by #6059
Closed

无法设置透明度 #6058

Jungzl opened this issue Jan 23, 2024 · 6 comments · Fixed by #6059
Assignees

Comments

@Jungzl
Copy link
Contributor

Jungzl commented Jan 23, 2024

问题描述

import { Chart } from '@antv/g2';
import { Renderer } from '@antv/g-svg';

const data = [
  { year: '1951 年', sales: 38 },
  { year: '1952 年', sales: 52 },
  { year: '1956 年', sales: 61 },
  { year: '1957 年', sales: 145 },
  { year: '1958 年', sales: 48 },
  { year: '1959 年', sales: 38 },
  { year: '1960 年', sales: 38 },
  { year: '1962 年', sales: 38 },
];

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

chart
.interval()
.data(data)
.encode('x', 'year')
.encode('y', 'sales')
.axis('x', { 
  labelFill: '#f00',
  labelFillOpacity: 1, // ⬅️ not working
 });

chart.render();

image
image
image
透明度固定为0.45

重现链接

No response

重现步骤

No response

预期行为

No response

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@hustcc
Copy link
Member

hustcc commented Jan 23, 2024

设置 labelOpacity 呢,能生效吗?

@Jungzl
Copy link
Contributor Author

Jungzl commented Jan 23, 2024

那就是文档有误了

@hustcc
Copy link
Member

hustcc commented Jan 23, 2024

看 svg 中,fill 属性中确实是带了 opacity 信息的。

@Jungzl
Copy link
Contributor Author

Jungzl commented Jan 23, 2024

看 svg 中,fill 属性中确实是带了 opacity 信息的。

image
此处应为 labelOpacity

@hustcc
Copy link
Member

hustcc commented Jan 23, 2024

了解了,方便来提一个 PR 修复下嘛![初级任务]

@Jungzl
Copy link
Contributor Author

Jungzl commented Jan 23, 2024

好的

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

Successfully merging a pull request may close this issue.

2 participants