That would only work with a --no-webpack
project. For a bundle the JavaScript has to go into a module - for your experiments app.js
. Inside the module you can get ahold of the of the canvas element that is part of your template.
I’m not sure how I would do this in the LiveView template
I’d recommend getting Chart.js
with channels to work outside of LiveView first - baby steps.
It should be quite similar to my d3.js demo.