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
分面chart.facet渲染的图,使用changeData(data)无法正常更新 #3331
Comments
这里我也发现有同样的问题。你可以在chart.changeData()之后,再执行一次chart.render(). 这样分面就可以正常更新了。 |
嗯,目前可以destroy后重新执行render(). |
是的,我目前的解决方案也是这样。图表destroy后,重新render,暂时还没发现内存泄漏 |
我这里也遇到了差不多的问题,分面+changeData就渲染出错,用data+render就可以实现数据动态的功能,但是会有页面闪动的问题,这个问题(页面闪动)要怎么处理? |
Reproduction link
https://stackblitz.com/edit/8qba9y--run?file=index.ts
Steps to reproduce
import { Chart } from "@antv/g2";
let data = [
{ type: "自住房", value: 0.21, total: 37 },
{ type: "出租房", value: 0.19, total: 34 },
{ type: "空置房", value: 0.17, total: 31 },
{ type: "未知类型", value: 99.43, total: 17619 }
];
const chart = new Chart({
container: "container",
autoFit: true,
height: 300,
padding: "auto"
});
chart.data(data);
chart.legend(false);
chart.facet("rect", {
fields: ["type"],
padding: window.innerWidth > 1600 ? 25 : 15,
showTitle: false,
eachView(view, facet) {
let data = facet.data;
data.push({
type: "其他",
value: 100 - data[0].value
});
view.data(data);
view.coordinate("theta", {
radius: 1,
innerRadius: 0.8
});
view
.interval()
.adjust("stack")
.position("value")
.color("type")
.tooltip(false)
.animate({
appear: {
animation: "fade-in"
}
});
}
});
chart.render();
let b = [
{ type: "自住房", value: 0, total: 0 },
{ type: "出租房", value: 0, total: 0 },
{ type: "空置房", value: 0, total: 0 },
{ type: "未知类型", value: 0, total: 0 }
];
setTimeout(() => {
chart.changeData(b);
}, 5000);
The text was updated successfully, but these errors were encountered: