We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
G2 Version: 4.0.7
Platform: Ant Design Pro
Mini Showcase(like screenshots):
CodePen Link: N/A
The text was updated successfully, but these errors were encountered:
附加另一个问题:chart/view 数据更新时,slider的数据如何保证更新?谢谢!
Sorry, something went wrong.
暂时没有一个 slider 控制多个 view 的能力。这种情况,可以外置自己写一个 slider,然后在 slider 交互的时候去过滤两个 view 的数据。
项目中同样的需求,我的解决方案是:
代码看起来像是这样:
const chart = new Chart({ container: "container", width: 800, height: 400, }); const view1 = chart.createView({ region: { start: { x: 0, y: 0 }, end: { x: 1, y: 0.5 }, }, }); view1.data(data); view1.interval().position("time*money"); const viewLast = chart.createView({ region: { start: { x: 0, y: 0.5 }, end: { x: 1, y: 1 }, }, }); viewLast.data(data); viewLast.interval().position("time*money"); viewLast.option("slider", {}); viewLast.on("afterpaint", () => { view1.changeData(viewLast.filteredData); }); chart.render();
希望能帮助到你:)
基本同意 @belldandy4ever 的方案。 也可以通过 Apply 方法调用changeViewData方法达到同样目的。 源码里全是 this.view
this.view
chart.on( 'slider:valuechanged', (ev) => { chart.getController('slider').changeViewData.apply( { view: mainView, }, ev.event.value, ); }, );
hustcc
No branches or pull requests
G2 Version: 4.0.7
Platform: Ant Design Pro
Mini Showcase(like screenshots):
CodePen Link: N/A
The text was updated successfully, but these errors were encountered: