G2
G2 copied to clipboard
饼图中如何在数据更新时不产生动画效果
问题描述
我在使用饼图时,通过点击事件触发数据变化后,扇区的颜色发生变化,但是我发现当我点击的时候,扇区会有动画,但我并不希望拥有这个动画,我尝试用一下的方式进行关闭,但似乎不起作用:
const draw = async (list: typeof chartDataList) => {
const chart = new Chart({
container: "chart",
width: 300,
height: 240,
});
chart.coordinate({ type: "theta", innerRadius: 0.6, outerRadius: 0.8 });
chart
.interval()
.data(list)
.transform({ type: "stackY" })
.encode("y", "value")
.label({
position: "outside",
fontWeight: 600,
fill: (data) => (data.isHighlight ? "#CE824E" : "#222222"),
text: (data) => `省¥${data.saveMoney} \n ${data.lineName}`,
})
.style("radius", 4)
.style("stroke", "#fff")
.style("lineWidth", 2)
.style("fill", (data) => (data.isHighlight ? "#CE824E" : "#222222"))
.animate("enter", { type: "waveIn" })
.animate("update", {
type: false,
}) // ❎ 我使用了该方法,但这似乎不起作用
.legend(false)
.tooltip(false);
chart.on("interval:click", async (event) => {
const { data } = event;
const lineName = data.data.lineName;
const list = changeChartDataHighlightByLineName(lineName, chartDataList);
chart.changeData(list);
});
chart.render();
};
重现链接
No response
重现步骤
No response
预期行为
我希望数据更新时,没有动画,但是动画似乎一直存在
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response