1. 程式人生 > >ionic學習(九):ionic3引入echarts及線上測試後複製到專案內

ionic學習(九):ionic3引入echarts及線上測試後複製到專案內

參考這裡:https://blog.csdn.net/weixin_36593033/article/details/78087329

步驟

1.安裝

安裝命令:

npm install echarts --save//下載ECharts

npm install @types/echarts --save //// ECharts的官方版本是基於JavaScript 的,下載ECharts的TypeScript定義檔案

2.引入

在使用的頁面ts檔案內引入:import ECharts from 'echarts';


在html頁面:

<div id="container" style="height: 100%"></div>


3.使用

3.1在周期函式內引用畫圖函式,那幾個周期函式都可以,什麼載入,進入函式都可以


4. 除錯程式碼:

去官網:http://echarts.baidu.com/examples/index.html 除錯程式碼


5.在ts檔案中引用程式碼:

將上一步除錯好的option中的程式碼。複製到下圖中的option中即可!


其他:

其他樣式可以百度搜索,很全!