Closed asbai closed 10 years ago
Hi Bai,
I just took a quick look at this and it looks good. Your changes address two of the three TODO
comments, which is great. I'll review this in more detail shortly and integrate your changes after some testing.
Drew.
I found a small issue with the limit on the framerate when scrolling slowly. If the chart is dynamically resizing to fit new data points, then not enough frames are drawn to make the animation smooth.
You can test this in the builder: drag the scroll speed slider to the far right, then toggle fix maximum value.
Did you mean the scaling of the y-value not smoothly enough?
Cloud we detect this situation and boost the frame rate temporarily?
PS: It would be best if we could avoid using any O(N)+ algorithm to detect this. O(1) algorithm is the preferred of course. :-)
@asbai yes that's right. The y-movement was quite jerky. I've committed some code that does exactly as you suggest: if the animation is occurring then it won't reduce the frame rate. Please take a look and see what you think.
Your fix to the requestAnimationFrame patch will follow in another commit once I've reviewed it.
@drewnoakes I have been read your code, and it seems very nice.
I've merged your changes into master. Thanks again!
I thought some more about the issue with running multiple animation loops concurrently due to having more than one chart in the document. It seems to me that having a single animation loop that then renders all charts on the page at once might be worth trying. It may reduce the amount of composition done in the browser. Of course we'd need to test. As it stands, behaviour looks pretty good across all the browsers I've tested on.
I had add some small improvements to this great library:
here is it: http://baiy.cn/tmp/smoothie.zip
please search "by BaiYang" to review the patch. :)