I've been attempting to display a 3D model using Plotly (https://github.com/plotly/angular-plotly.js/blob/master/README.md), but unfortunately, the chart is not appearing.
component.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-componente',
templateUrl: './componente.component.html',
styleUrls: ['./componente.component.css']
})
export class ComponenteComponent{
getData() {
var arr = [];
for(let i=0;i<25;i++)
arr.push(Array(25).fill(undefined).map(() => Math.random()))
console.log(arr);
return arr;
}
data: any[] = this.getData();
public graph = {
z: this.data,
type: 'surface',
layout: {autosize: true, title: 'Modelo 3d'}
};
}
componente.component.html
<plotly-plot [data]="graph.z" [layout]="graph.layout"></plotly-plot>
https://i.sstatic.net/gLhQe.png This is the current display.
It should look more like this: https://i.sstatic.net/4RB7g.png
I've been working on getting this to function with Angular all day, but I'm struggling a bit. Any assistance would be greatly appreciated. 😊