0

I have upgraded my Angular project from version 12 to version 13. I use Plotly to create graphs and now I'm getting an error when starting the application:

plotly.js:26321 Uncaught TypeError: Cannot read properties of undefined (reading 'document')

After some research this seems to have something to do with the new way of packaging the application introduced with angular 13. Does anyone have a solution how to fix this?

lanto
  • 28
  • 3

1 Answers1

0

In this case, the best option will be to import plotly.js via CDN.

https://github.com/plotly/angular-plotly.js#plotly-via-cdn-module

We use the following version and it works just fine. The latest (2.x.x) version doesn't work.

PlotlyViaCDNModule.setPlotlyVersion('1.58.5'); 
ROMAN
  • 1,476
  • 2
  • 11
  • 24