原理

使用一个默认颜色为透明的,并且只显示labelLine的饼状图

然后通过调节这个透明的饼状图 以达到修改labelLine的位置

echarts地址

https://gallery.echartsjs.com/editor.html?c=x6VnXPfxlx

echarts源码:

option = {
backgroundColor: "#03141c",
title: {
text: "84%",
subtext: '完成部门占比',
x: 'center',
y: 'center',
textStyle: {
color: "#fff",
fontSize: 30,
fontWeight: 'normal'
},
subtextStyle: {
color: "rgba(255,255,255,.45)",
fontSize: 14,
fontWeight: 'normal'
}
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
x: 'center',
y: 'bottom',
data: ['rose3', 'rose5', 'rose6', 'rose7', 'rose8']
},
calculable: true,
series: [
{
type: 'pie',
radius: [80, 120],
center: ['50%', '50%'],
data: [
{
value: 10,
name: '吴际帅\n牛亚莉',
itemStyle: {
color: "transparent"
}
},
{
value: 90,
name: 'rose2',
itemStyle: { color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0,
color: '#0ce4da'
}, {
offset: 1,
color: '#f6fb08'
}])
},
labelLine: {
show: false,
length: 200,
length2: 100
},
label: {
color: "rgba(255,255,255,.45)",
fontSize: 14,
show: false,
position: 'outside',
formatter: '客户满意度\n{a|52}个',
rich: {
a: {
color: "#fff",
fontSize: 20,
lineHeight: 30
},
}
}
}
]
},
{ // 指示线
// 通过value 的值 调节lableLine的位置
type: 'pie',
radius: [80, 100],
data: [
{
value: 100,
itemStyle: {
color: 'transparent'
} },
{
value: 50,
itemStyle: {
color: "transparent"
},
labelLine: {
show: true,
length: 2,
length2: 240,
color: 'orange',
lineStyle: {
color: 'orange'
}
},
label: {
color: "rgba(255,255,255,.45)",
fontSize: 14,
position: 'outside',
formatter: '客户满意度\n{a|52}个',
rich: {
a: {
color: "#fff",
fontSize: 20,
lineHeight: 30
},
}
}
}
]
},
{
type: 'pie',
radius: [80, 100],
center: ['50%', '50%'],
data: [{
value: 10,
itemStyle: {
color: '#06d3cd'
},
labelLine: {
show: false
}
},
{
value: 90,
itemStyle: {
color: "transparent"
}
}
]
} ]
};

  

echarts 饼状图调节 label和labelLine的位置的更多相关文章

  1. Echarts 饼状图自定义颜色

    今天给饼状图着色问题,找了好久 终于找到了 话不多说直接上代码 $.ajax({ url: "/HuanBaoYunTai/ajax/HuanBaoYunTaiService.ashx&qu ...

  2. jquery echarts 饼状图

    var myChart = echarts.init(document.getElementById('myChart')); option = { title : { text: '某站点用户访问来 ...

  3. canvas图表详解系列(3):动态饼状图(原生Js仿echarts饼状图)

    本章建议学习时间4小时 学习方式:详细阅读,并手动实现相关代码(如果没有canvas基础,需要先学习前面的canvas基础笔记) 学习目标:此教程将教会大家如何使用canvas绘制各种图表,详细分解步 ...

  4. 关于echarts中的饼状图的label文字显示过长的问题

    label: { normal: { fontSize: 14, formatter(v) { let text = v.name let count = text.indexOf('¥') cons ...

  5. ECharts饼状图添加事件

    和柱状图添加事件没有区别,详情如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Content ...

  6. echarts 饼状图 改变折线长度

    $(function (){ //ups部分 var myChart = echarts.init(document.getElementById('result')) var option = { ...

  7. vue+element+echarts饼状图+可折叠列表

    html: <div id="echartsDiv" style="width: 48%; height: 430px; float: left;"> ...

  8. echarts 饼状图

    说明:这是我做项目时自己写的小例子,里面有冗余的参数. 开发环境 vs2012 asp.net mvc4  c# 1.显示效果 2.HTML代码 <%@ Page Language=" ...

  9. Echarts饼状图

    <head> <meta charset="utf-8"> <title>ECharts</title> <script sr ...

随机推荐

  1. 查看当前页面的jsp文件【我】

    方法一:可以通过看html类型的请求 方法二:对于有些嵌入的子页面,也可以通过,鼠标右键——此框架——查看框架源代码的方式,直接找到对应的jsp 直接就可以看到对应的jsp:

  2. Algorithm测试

    Algorithm测试 #include <algorithm> #include <vector> #include <iostream> using names ...

  3. Mac mysql 忘记root密码的解决方法

    1.执行命令以安全模式启动MySQL cd /usr/local/mysql/bin sudo ./mysqld_safe --skip-grant-tables 2.同上面目录下执行 '\) whe ...

  4. jenkins自动化视频地址

    1.腾讯课堂的视频 http://www.ctnrs.com/study.html 我的课程所有列表 2.百度网盘里面的

  5. JEECG实现模糊查询

    1.JEECG默认不带模糊查询的,但实际开发中会经常用到模糊查询,因此要适当修改(在相应的查询处). @RequestMapping(params = "datagrid") pu ...

  6. golang遍历文件夹

    golang遍历文件夹: func main() { //方式一 filepath.Walk("temp/", func (path string, info os.FileInf ...

  7. elastalert 用import属性来组织,引入配置

    对应rule的一些公用规则,可以放到一个或者多个头文件中.主的rule yaml文件引入即可.文件名随意,最好别用yaml后缀,要不会被当做一个rule.另外import在rule文件中只能出现一次. ...

  8. 为Endnote中的期刊名称添加缩写期刊名

    为Endnote中的期刊名称添加缩写期刊名 Endnote - tools - Open term lists - Journals term lists - lists -- Journals - ...

  9. FTP 客户端工具(支持 Windows/Unix/Linux)

    FTP 客户端工具,支持 Windows/Unix/Linux

  10. vue实现视频播放

    用的vue组件是vue-video-player,可以去百度下怎么引入到项目中: 因为这个组件是基于H5video实现的,视频格式有所限制,而且MP4不是H264的也不行.转码可以看下我上篇博客,地址 ...