博客
关于我
百度echart绘制圆环
阅读量:131 次
发布时间:2019-02-26

本文共 2858 字,大约阅读时间需要 9 分钟。

效果图

一、代码封装

var pie = function (options) {       var option = {        backgroundColor: "#fff",        //不显示标题        title: {            show: false,            text: options.title,            textStyle: {                fontSize: 24 * iWidth / 720,                color: "#36383c",                fontWeight: "normal",                fontFamily: "Microsoft Yahei"            },            left: 20 * iWidth / 720,            top: 20 * iWidth / 720,        },        grid: {            top: 0 * iWidth / 720,            left: '50%',            right: '50%',            bottom: 45 * iWidth / 720        },        //鼠标放上去提示        // tooltip: {           //     trigger: 'item',        //     formatter: "{a} 
{b}: {c} ({d}%)" // }, legend: { orient: 'vertical', left: 180 * iWidth / 720, top: "middle", icon: 'circle', itemGap: 20 * iWidth / 720, textStyle: { fontSize: 16 * iWidth / 720, color: "#91989e", fontWeight: "normal", fontFamily: "Microsoft Yahei" }, //图例不能点击 selectedMode: false, data: options.legendData }, series: [ { name: '访问来源', type: 'pie', center: ["28%", "50%"], radius: [54 * iWidth / 720, 70 * iWidth / 720], top: "50%", avoidLabelOverlap: false, label: { normal: { show: false, position: 'center' }, //鼠标移上去中间显示文字 emphasis: { show: false, textStyle: { fontSize: 30 * iWidth / 720, color: "#91989e", fontWeight: "normal", fontFamily: "Microsoft Yahei" } } }, labelLine: { normal: { show: false } }, data: [], } ] }; //如果是大图设置样式 if(options.isBig){ option.legend.left = 300 * iWidth / 720; } //重组数据 (function () { options.seriesData.map(function (item, index) { option.series[0].data.push({ value: item.value, name: item.name, itemStyle: { normal: { color: colorGroup[index % colorGroupLen], //中间间隔 borderColor: '#fff', borderType: 'solid', borderWidth: 5 } } }) }) })(); return option;}
你可能感兴趣的文章
ms sql server 2008 sp2更新异常
查看>>
MS UC 2013-0-Prepare Tool
查看>>
MSBuild 教程(2)
查看>>
msbuild发布web应用程序
查看>>
MSB与LSB
查看>>
MSCRM调用外部JS文件
查看>>
MSCRM调用外部JS文件
查看>>
MSEdgeDriver (Chromium) 不适用于版本 >= 79.0.313 (Canary)
查看>>
MsEdgeTTS开源项目使用教程
查看>>
msf
查看>>
MSSQL数据库查询优化(一)
查看>>
MSSQL数据库迁移到Oracle(二)
查看>>
MSSQL日期格式转换函数(使用CONVERT)
查看>>
MSTP多生成树协议(第二课)
查看>>
MSTP是什么?有哪些专有名词?
查看>>
Mstsc 远程桌面链接 And 网络映射
查看>>
Myeclipse常用快捷键
查看>>
MyEclipse更改项目名web发布名字不改问题
查看>>
MyEclipse用(JDBC)连接SQL出现的问题~
查看>>
mt-datetime-picker type="date" 时间格式 bug
查看>>