Angular使用Echarts動態資料不重新整理

2021-10-23 07:51:53 字數 769 閱讀 7543

在angular專案中使用echarts來實現圖表的過程中,從服務端請求回來資料,賦值之後,頁面圖表卻不重新整理,資料沒問題,原因是

資料拿到時頁面已經渲染了,因此沒有顯示。

解決方式是:

資料拿到時使用setoption再次渲染

具體實現**如下:

地域分布

import from '@angular/core';

import from '../service';

import from 'ng-zorro-antd';

@component()

export class overviewcomponent implements oninit ) regioncharts: any;

zone =

: (%)'

},legend: ,

series: [

,emphasis: }},

labelline:

},data: }]

};constructor(private service: service, private message: nzmessageservice)

ngoninit()

)this.assetzone.legend.data.push(item.key)

})this.regioncharts.chartinstance.setoption(this.zone);

},error =>

)}

echart高階使用 EChart使用簡單介紹

1 title 寫標題,屬性如下 show false true 標題是否顯示 text 標題內容 textstyle修飾標題樣式 subtext 副標題,也可以算是內容 subtextstyle修飾副標題樣式 2 legentd 圖例元件展現了不同系列的標記 symbol 顏色和名字 show f...

echart高階使用 Echart使用總結

水監測圖表.gif 1 專案中用到的一些屬性 const options yaxis else,折線點設定為實心點 symbolsize 12,折線點的大小 showbackground true,backgroundstyle itemstyle opacity 1 2 echart初始化的時候獲...

echart使用小結

寫在前面。定義的接收圖表 的容器哦必須設定寬高。不然可能找不到就報錯 cannot read property getattribute of null 如果在vue專案裡面,寫了寬高還報這個錯就可能是頁面的容器還沒有載入完,他還沒有找到。動態新增資料 引入echart import echarts...