Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Plotly Click Events Example

I am trying to replicate the following example from the plotly website. https://plot.ly/r/click-events/. I have copied the html and the js into separate files in the same directory and added the following line to the top of the html:

<head>
<script src="interactiveplot.js"></script>
</head>

where interactiveplot.js is the name of the file containing the javascript from the example. When I open the html file in chrome the data point selecting functionality does not work. Please let me know if you can reproduce this functionality and what might be the problem.

Thanks.

Could you more specific on what doesn’t work ?

If you see any errors in the javascript console, could you paste them here?

Uncaught TypeError: Cannot read property 'contentWindow' of null(anonymous function) @ interactiveplot.js:1

I think this has to do with the fact that I am sourcing the java script in the header which is making the java script try to access an element that has not been defined yet.

I have tried moving around the script import within the HTML. If I put it directly after the iframe Tag, I get this error message

Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin 'null' in a call to 'postMessage'

I don’t know what this error means but I think it is coming from the deletePoints function.

Thanks.