此文以饼图数据为例:
对于单个图标渲染,只需要在结构和js中插入以下代码即可
<view @click="echarts.onClick" :prop="option" :change:prop="echarts.updateEcharts" id="echarts" class="echarts-pie"></view>
设置变量:
option: {
graphic: [{ //环形图中间添加文字
type: 'text', //通过不同top值可以设置上下显示
left: 'center',
top: '40%',
style: {
text: '450次' + '\n\n' + '合计',
textAlign: 'center',
fill: '#000', //文字的颜色
// width: 30,
// height: 30,
fontSize: 16,
fontFamily: "Microsoft YaHei"
}
}],
series: [{
type: 'pie',
hoverAnimation: false,
radius: ['40%', '60%'],
label: {
formatter: "{b}\n{c}人 ({d}%)"
},
labelLine: {
length2: 2
},
itemStyle: {
borderWidth: 1,
borderColor: '#fff'
},
d