Try this:
npm install angular-plotly.js plotly.js-dist-min --save
npm install @types/plotly.js-dist-min --save-dev
In the AppModule, do the follow:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PlotlyViaCDNModule } from 'angular-plotly.js';
PlotlyViaCDNModule.setPlotlyVersion('latest');
@NgModule({
imports: [
CommonModule,
PlotlyViaCDNModule,
],
...
})
export class AppModule { }
Use the latest version of Plotly.js, but you can use a minor version as well.
You can take a look my project in Angular 12 with Plotly:
https://github.com/cristofima/AngularPlotly
npm install angular-plotly.js plotly.js.