tysonwu / dash-tradingview

Tradingview Lightweight Charts wrapper for Plotly Dash apps
MIT License
134 stars 25 forks source link

How to subscribe lightweight chart events? #2

Open aliveoceans opened 1 year ago

aliveoceans commented 1 year ago

How to subscribe lightweight chart events?

tysonwu commented 1 year ago

Hi @aliveoceans , this repo got recently updated. The original Tradingview lightweight chart library supports subscribing mouse even (hover on chart coordinates, mouse clicks) - they are now supported in this Dash component in the form of a prop. You can get the mouse events from the crosshair and click properties. Hope it helps.

aliveoceans commented 1 year ago

Hi @aliveoceans , this repo got recently updated. The original Tradingview lightweight chart library supports subscribing mouse even (hover on chart coordinates, mouse clicks) - they are now supported in this Dash component in the form of a prop. You can get the mouse events from the crosshair and click properties. Hope it helps.

Hi @tysonwu , Thanks for your efforts and quick response. I am able to access the click event as expected. Is there a way to implement crosshair synchronization between multiple charts like this https://jsfiddle.net/trior/y1vcxtqw/ ?

tysonwu commented 1 year ago

Hi @aliveoceans, Thanks for trying out the component. I briefly looked at the jsfiddle you provided. The syncronization is driven by chart.setCrossHairXY() which does not exist in the original charting library. I believe it is only achievable by modifying the original charting library in js (see this discussion).

s71m commented 7 months ago

Hi @tysonwu! Thanks for your work.

Syncronization between multiple charts added to original library - https://tradingview.github.io/lightweight-charts/tutorials/how_to/set-crosshair-position#syncing-two-charts. Would you mind add this feature to your implementation?