import * as echarts from '../../ec-canvas/echarts';var app = getApp();var demo = require('../jspackage/album.js');var dataChange = new demo();let chart = null;var demo2={ //设置背景色 backgroundColor: '#fff', //设置文本样式 默认字和线于图的颜色相同 textStyle: { color: 'rgba(0, 0, 0, 1)' }, //颜色明暗度 visualMap: { // 不显示 visualMap 组件,只用于明暗度的映射 show: false, // 映射的最小值为 80 min: 20, // 映射的最大值为 600 max:365, inRange: { // 明暗度的范围是 0 到 1 colorLightness: [0, 1] } }, //饼图 series: [ { name: '访问来源', type: 'pie', //加上为南定尔图 roseType: 'angle', radius: '55%', data: [ { value: 30, name: '45545' }, { value: 35, name: '联盟广告' }, { value: 40, name: '邮件营销' }, { value: 45, name: '直接访问' }, {value: 50, name: '搜索引擎'} ], //emphasis是鼠标 hover 时候的高亮样式。 itemStyle: { emphasis: { shadowBlur: 20, shadowOffsetX: 0, // 阴影垂直方向上的偏移 shadowOffsetY: 0, // 阴影颜色 shadowColor: 'rgba(0, 0, 0, 0.5)' }, // 设置扇形的颜色 color: '#c23531', // shadowBlur: 200, // shadowColor: 'rgba(0, 0, 0, 0.5)', }, } ]};function initChart(canvas, width, height) { chart = echarts.init(canvas, null, { width: width, height: height }); canvas.setChart(chart); var option = demo2; chart.setOption(option); return chart;} Page({ onShareAppMessage: function (res) { return { title: 'ECharts 可以在微信小程序中使用啦!', path: '/pages/index/index', success: function () { }, fail: function () { } } }, data: { ec: { onInit: initChart } }, onLoad:function() { }, onShow:function() { // var messiones = app.globalData.messiones; if (app.globalData.messiones!=null){ var dataArray=[]; dataArray.splice(0); for (var pos in app.globalData.messiones) { // console.log("hhh:"+app.globalData.messiones[pos].albumName); // console.log(demo2.series[0].data[pos].name); var temp = { name: app.globalData.messiones[pos].albumName, value: app.globalData.messiones[pos].time } dataArray.push(temp); } demo2.series[0].data = dataArray; setTimeout(function () { console.log(chart); chart.setOption(demo2); }, 2000); } }})
import * as echarts from '../../ec-canvas/echarts';
var app = getApp();
var demo = require('../jspackage/album.js');
var dataChange = new demo();
let chart = null;
var demo2={
//设置背景色
backgroundColor: '#fff',
//设置文本样式 默认字和线于图的颜色相同
textStyle: {
},
//颜色明暗度
visualMap: {
},
//饼图
series: [
]
};
function initChart(canvas, width, height) {
chart = echarts.init(canvas, null, {
});
canvas.setChart(chart);
var option = demo2;
chart.setOption(option);
return chart;
}
Page({
onShareAppMessage: function (res) {
},
data: {
},
onLoad:function() {
},
onShow:function() {
}
})