function initChart(canvas, width, height) {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chart);
var option = {
backgroundColor: "#ffffff",
color: ["#37A2DA", "#FF9F7F"],
tooltip: {},
xAxis: {
show: false
},
yAxis: {
show: false
},
radar: {
indicator: [{
name: '10米折返跑',
max: 5
},
{
name: '立定跳远',
max: 5
},
{
name: '网球掷远',
max: 5
},
{
name: '走平衡木',
max: 5
},
{
name: '坐位体前屈',
max: 5
},
{
name: '双脚连续跳',
max: 5
}
]
},
series: [{
name: '',
type: 'radar',
itemStyle: {
normal: {
areaStyle: {
type: 'default'
}
}
},
data: [{
value: app.globalData.all_date,
name: ''
}]
}]
};
chart.setOption(option);
return chart;
}
7、在 wxml 调用:
总体来说,设置单页的全局变量,不能改变小程序图表的二次渲染,要设置成app.js的全局变量才行