tvjsx / trading-vue-js

💹 Hackable charting lib for traders. You can draw literally ANYTHING on top of candlestick charts. [Not Maintained]
https://tvjsx.github.io/trading-vue-demo/
MIT License
2.09k stars 638 forks source link

Chart “jumps” when index-based and onRange are combined #113

Closed michael-k closed 4 years ago

michael-k commented 4 years ago

Description

Background

A while ago I've asked in Discord about the chart jumping when index-based and onRange are combined. Here's finally the bug report for that.

Actual Description

When index-based is set to true and DataCube.onrange is used to lazy load older candles, the chart jumps when older candles are added to the chart. Jumping means, that the left-most candle of the updated chart is drawn where the left-most candle of the previous chart was.

It also happens often that onrange fires again and again (worst case: until no more data is available), moving the original chart all the way to the right.

Minimal example

Here's a minimal example that reproduces the problem with the data sample from below. I've put all the files in one place and started a minimal web server with python3 -m http.server 8000. (Sorry, I'm more familiar with the Python ecosystem than the one from Node.js/Javascript.)

index.html ```html TradingVue

TradingVue

```

Screenshot

Screen captures are availabe in Discord:

Data Sample

Sorry for not following the data structure. I've created the minimal example first and only then saw this requirement. The provided data can be used in combination with the index.html from above. I can rewrite the data to match the requested data structure if necessary. :)

index-based-and-onrange.zip

Console errors

n/a

Additional Info

C451 commented 4 years ago

@michael-k probably has something to do with #104 BTW the best issue description so far.

C451 commented 4 years ago

That was one hell of a bug, testing is needed.