Javascript event data

Use plotly_click instead. It should just be one point.

i can do that.

Now that I know there’s data in data via console, how can I use a value to work with it? Like:

//if date at click event is a match to a specific date, perform action:
if(data.points.data.x = "2019-10-07") {
     print("do something");
}

of course the data.points.____ is the wildcard. I’m only able know it has data via the console.log; but how do the attributes translate to reference code? I would assume there’s a way to access each attribute shown in the console from (data).

Are you familiar with how to navigate around with dictionaries and lists, and list of dictionaries? That is what you have here.

Look at the whole object (in console) and figure out what data you want to get to. Then emulate the path that you took to get there in your code.

1 Like

Ok great, thanks, I’m off and running. I appreciate the help once again! While you had a number of solutions here, I’ll pick one.

if anyone else stumbles here, this is an examples of navigating to x-axis value from my data observed in the console:

data.points[0].x
1 Like