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

label.render option causes the font to become bold #5390

Closed
jianjunyuu opened this issue Aug 11, 2023 · 1 comment · Fixed by #5392
Closed

label.render option causes the font to become bold #5390

jianjunyuu opened this issue Aug 11, 2023 · 1 comment · Fixed by #5392

Comments

@jianjunyuu
Copy link

这边使用g2 v5.0.18版本发现一个问题,使用了 label.render api后,窗口resize,label的dom数量线性递增,导致label展示文本效果是叠加的
文档地址:https://g2.antv.antgroup.com/spec/label/overview

这是初始化的文本:
image

这是窗口变化后的效果
image

文本变粗了

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

const data = [
{ action: '浏览网站', pv: 50000 },
{ action: '放入购物车', pv: 35000 },
{ action: '生成订单', pv: 25000 },
{ action: '支付订单', pv: 15000 },
{ action: '完成交易', pv: 8000 },
];

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

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

chart.data(data);

chart
.interval()
.encode('x', 'action')
.encode('y', 'pv')
.encode('color', 'action')
.encode('shape', 'funnel')
.transform({ type: 'symmetryY' })
.scale('x', { padding: 0 })
.animate('enter', { type: 'fadeIn' })
.label({
// text: (d) => ${d.action}\n${d.pv},
render: (t, d) => ${d.action}\n${d.pv},
position: 'inside',
transform: [{ type: 'contrastReverse' }],
})
.axis(false);

chart.render();

@hustcc
Copy link
Member

hustcc commented Aug 14, 2023

排查中了,原因是 resize 的时候重新渲染, html label 没有回收导致出现多个相同的 dom。

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

Successfully merging a pull request may close this issue.

4 participants