plot.ly
npm install angular-plotly.js plotly.js
:
import { PlotlyModule } from 'angular-plotly.js';
@NgModule({
imports: [CommonModule, PlotlyModule],
...
})
export class AppModule { }
:
@Component({
selector: 'plotly-example',
template: '<plotly-plot [data]="graph.data" [layout]="graph.layout"></plotly-plot>',
})
export class PlotlyExampleComponent {
public graph = {
data: [
{ x: [1, 2, 3], y: [2, 6, 3], type: 'scatter', mode: 'lines+points', marker: {color: 'red'} },
{ x: [1, 2, 3], y: [2, 5, 3], type: 'bar' },
],
layout: {width: 320, height: 240, title: 'A Fancy Plot'}
};
}