简体   繁体   English

D3带折线的多折线图

[英]D3 Multiline Chart with transition

I'm working on a pure d3 implementation of a multiline chart with transitions. 我正在研究带有过渡的多线图的纯d3实现。 It works quite well with a little exception. 它工作得很好,有一点例外。 Using transitions with a line drawn as path seems quite difficult. 使用以线条作为路径的过渡效果似乎很困难。 I found some solutions using clipping paths and so on and always combined with the warning, that these solutions are quite performance consuming. 我发现了一些使用剪切路径等的解决方案,并且总是与警告结合在一起,这些解决方案非常消耗性能。

Is there any easier solution of showing progress in the multiline chart as a real point to point drawing (at least in users perception). 有没有更简单的解决方案将多线图中的进度显示为真实的点对点绘图(至少在用户的感知中)。

You can inspect my current code under http://bl.ocks.org/m99coder/136db7134df6fdc3e3cf 您可以在http://bl.ocks.org/m99coder/136db7134df6fdc3e3cf下查看我当前的代码

With kind regards Marco 亲切的问候马可

Update 2015-07-14 14:14:00 CET 更新2015-07-14 14:14:00 CET

I refactored some parts of my code: http://bl.ocks.org/m99coder/8a9fab35b8f47ab8844c . 我重构了部分代码: http : //bl.ocks.org/m99coder/8a9fab35b8f47ab8844c But unfortunately I couldn't get it to work as smooth as you given tutorial link ( http://bost.ocks.org/mike/path/ ). 但是不幸的是,我无法像您给定的教程链接( http://bost.ocks.org/mike/path/ )那样使它顺利运行。 Any advices? 有什么建议吗? Maybe it's related to the defined range, which avoids values outside of „viewport“. 可能与定义的范围有关,这避免了“视口”之外的值。

Update 2015-07-14 14:57:00 CET 更新2015-07-14 14:57:00 CET

Getting closer but not perfect yet: http://bl.ocks.org/m99coder/136db7134df6fdc3e3cf/a53f06a0334bada96e1f892c886c5b68fe3c0a05 . 越来越近,但还不完善: http : //bl.ocks.org/m99coder/136db7134df6fdc3e3cf/a53f06a0334bada96e1f892c886c5b68fe3c0a05 It looks like the path is hopping back to the right after smooth transition to the left. 平滑过渡到左侧后,路径似乎在跳回右侧。

Update 2015-07-14 17:37:00 CET 更新2015-07-14 17:37:00 CET

Harmonizing durations of updates and transitions didn't solved it too. 协调更新和过渡的持续时间并不能解决问题。 Now it's hopping to the left: http://bl.ocks.org/m99coder/8a9fab35b8f47ab8844c/cd25a9d33839f52974780b1c142922cbbf8f64f4 现在它跳到左侧: http : //bl.ocks.org/m99coder/8a9fab35b8f47ab8844c/cd25a9d33839f52974780b1c142922cbbf8f64f4

I managed it to work as expected. 我设法使其按预期工作。 It was a timing issue. 这是一个时间问题。 Data was modified before the transition was done. 在完成转换之前,已修改数据。 The new approach uses a callback to get informed when the transition is over and shifts data afterwards. 新方法使用回调来通知过渡结束,然后再转移数据。

http://bl.ocks.org/m99coder/54d6e0130064c699e6e4/06149dd1ab22cebf5b307bab3ec90079e356bce9 http://bl.ocks.org/m99coder/54d6e0130064c699e6e4/06149dd1ab22cebf5b307bab3ec90079e356bce9

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM