How to write a callback to get the date(x) of a candle in canclestick chart?

Hi,

I have a candlestick chart. I want to get the date(x axis value) of a candle when it’s clicked.
How could I write such kind of callback?

Hi @ChrisYan and welcome to the Dash Community :slight_smile:

Check this out Part 4. Interactive Graphing and Crossfiltering | Dash for Python Documentation | Plotly

You can use the clickData property of the figure in your callback which gets triggered when clicking a datapoint on your plot. It returns an dict with x and y values along with other data.

Hi atharvakatre,

Thank you very much for the help!
Let me give it a try

1 Like

@ChrisYan

Happy to help :slight_smile:
Also a side note, use the @ symbol before the username for tagging a user, this way the mentioned user will be notified.

@atharvakatre

Get it, thanks very much for the tips as well!
I have already tried, it worked perfectly. I could get the values and working on the rest part of the logic.

1 Like