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.07k stars 628 forks source link

Having trouble drawing lines in my overlay #253

Closed black-hawk85 closed 2 years ago

black-hawk85 commented 2 years ago

Description

My lines are being transformed when I scroll around on time axis. Not sure if it's a bug in my overlay or in the t2screen / $2screen methods but there's not much code in my overlay and I couldn't find anything there.

I saw this issue but it didn't help me in my case.

Hope you can tell me what's going wrong here.

Demo

Playground.zip

Screen

black-hawk85 commented 2 years ago

Just playing around with your Lines-class. This still happens when I use it instead of drawing the line myselve.

But I still don't understand how your LineTool manages this not to happen?

black-hawk85 commented 2 years ago

What I just found out is that the "jump" happens when a candle after a gap appears in the time range. So I just turned off indexBased mode for testing and the line jumping stops. But now the chart has gaps which really looks odd.

indexBased_false

Any idea? Lines manually drawn with the LineTool don't have this problem (even if indexBased is turned on).

black-hawk85 commented 2 years ago

If anyone faces the same or a similar issue, I found out that the t2screen-function can also work with candle-indexes instead of timestamps when indexBased-mode is enabled. This may help finding a workaround.

If anyone still working on the core-part, I tried to map the timestamps within my overlay itselve via this.$props.layout.ti_map.it_map but for some reason most entries are null so this won't work.

I'll have to find another way for the timestamp-index mapping.