紅糖糍粑
2023-11-11 21:24:06
我正在使用情節來顯示熱圖。我可以用硬編碼數據顯示熱圖。但現在我有了端點,這樣您就可以看到帶有后端數據的熱圖。但如果我使用端點數據,我看不到熱圖。所以我有這個作為模板:<plotly-plot [data]="graph.data" [layout]="graph.layout"</plotly-plot>和這個打字稿:Map:map = {};}所以這有效,我看到了熱圖。但現在如果我這樣做:export interface map { map?: Array<Array<number>> | null;} Map() { this.Service }); }But then the data is not visibleSo what I have to change?So I have it now like this:this.showHeadMap().subscribe((res) => {}因為它使用源作為圖像。但是,如果我加載頁面,我只會看到一個圖表一秒鐘,并且頁面加載是否完成。然后圖表消失。但圖像未顯示。But if I fill in the z with this:來自:[[0.000010752661,you have to do this:z: [[res.push(this.ok.map[0])]],but then for all values
1 回答

桃花長相依
TA貢獻1860條經驗 獲得超8個贊
將 showHeadMap 更改為以下內容:-
showHeadMap() {
return this.aggregateCameraHeatmapsService
.aggregateHeatmaps('2020-11-09 10:00:00', '2020-12-10 14:15:00', 4, '1')
.pipe(map((res) => {
this.cameraAgretateHeadMap.heatmap = res.heatmap.slice(0, 1);
return this.cameraAgretateHeadMap.heatmap;
}));
}
然后分配圖表,例如:-
this.showHeadMap().subscribe((res) => {
this.graph = {
data: [
{
z: [res],
type: 'heatmap',
showscale: false,
colorscale: colorScale,
opacity: 0.7,
zsmooth: 'best'
}
]
}
});
添加回答
舉報
0/150
提交
取消