Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
830 stars 240 forks source link

Line Tool #260

Open lmvdz opened 1 year ago

lmvdz commented 1 year ago

I found a fork of lightweight-charts which has implemented line tool.

So, I merged your repo with his and put it on mine.

Here is an example of a simple trend line:

image

Tucsky commented 1 year ago

you can draw directly on the chart ? if so that's pretty cool

github.com/iosiftalmacel/lightweight-charts ?

lmvdz commented 1 year ago

Yessir, lack of documentation so I am not sure the exact best way to go about it, but I guess you'd need a toolbar

lmvdz commented 1 year ago

https://github.com/lmvdz/aggr/blob/master/src/components/chart/Chart.vue#L284

This is the hacky example you see in the picture.

I call the createLine function during createChart, but like I said in the previous comment would need a toolbar or key combo shortcut, if you want to be able to create more than just that first one.

When you move the chart it moves correctly with it, but I wasn't able to move the line itself yet, not sure how to go about that.

If you try to click on the chart where there isn't a price bar you'll get undefined for the timestamp. I tried looking at how crosshair draws the vertical line and gets the time, but I couldn't figure it out.

adeacetis commented 1 year ago

Adding a toolbar with basic functionalities raises a lot of questions. I do agree, this is pretty cool but just adding a line tool, usually doesn't cut it. By experience, it's kinda hard to get it right in terms of UX. Even, only copying - and just that - the line tool experience could be daunting with plenty of edge cases.

Also Lightweight Chart dependency hasn't been updated in this repo for ages. I don't know the reasons, maybe @Tucsky could enlighten us, but I would argue we'd need to solve that first.

Then we'd have to figure the Line Tool UX and UI, including edge cases and then integrate it.

Is that something we could imagine adding in the near future @Tucsky?