2020-02-14 23:17:01 +08:00

64 lines
1.4 KiB
JavaScript

var wxCharts = require('./utils/wxcharts.js');
var App = getApp();
var pieChart = null;
// px = rpx / 750 * wx.getSystemInfoSync().windowWidth;
Page({
data: {
title:"数据分析"
},
touchHandler: function (e) {
console.log(pieChart.getCurrentDataIndex(e));
},
onLoad: function (e) {
this.setData({
navH: App.globalData.navHeight
})
var windowWidth = 320;
try {
var res = wx.getSystemInfoSync();
windowWidth = res.windowWidth;
console.log("屏幕宽度为:",windowWidth)
} catch (e) {
console.error('getSystemInfoSync failed!');
}
var list = [{
name: 'A选项',
data: 412,
}, {
name: 'B选项',
data: 35,
}, {
name: 'C选项',
data: 40,
}, {
name: 'D选项',
data: 63,
}]
pieChart = new wxCharts({
animation: true,
canvasId: 'pieCanvas',
type: 'pie',
series: list ,
width: windowWidth,
height: 300,
dataLabel: true,
});
wx.startWifi({
success: function (res) {
console.log("调起wifi",res)
wx.getWifiList({
success: function (sList) {
console.log("sList",sList)
wx.onGetWifiList(res => {
console.log("获取到WiFilist", res)
});
},
fail: function (fList) {
console.log("flist",fList)
}
})
}
})
}
});