1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
import * as echarts from '../../../utils/ec-canvas/echarts'; var dataList = []; Page({
data: { ec: { lazyLoad: true }, }
onReady: function (options) { this.echartsComponnet = this.selectComponent('#mychart'); this.getData(); }, getData: function () {
wx.request({ url: url, data: data, method: 'POST', header: { 'content-type': 'application/x-www-form-urlencoded' }, success: (res) => { dataList = res.data; this.init_echarts(); } }); }, init_echarts: function () { this.echartsComponnet.init((canvas, width, height) => { const Chart = echarts.init(canvas, null, { width: width, height: height }); Chart.setOption(this.getOption()) return Chart; }); },
getOption: function () { var option = { backgroundColor: "#ffffff", color: ["#37A2DA", "#32C5E9", "#67E0E3", "#91F2DE", "#FFDB5C", "#FF9F7F"], series: [{ label: { normal: { show:true, formatter: ' {b} n ¥ {c} ', fontSize:10 } }, labelLine: { show: true } , type: 'pie', center: ['50%', '50%'], radius: [0, '80%'], data: that.data.accountList, itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 2, 2, 0.3)' } } }] }; } return option; }, })
|
近期评论