本文介绍: 大部分功能是echarts社区大佬写的,地址https://www.makeapie.cn/echarts_content/xmQZRm2IHw.html下面是自己的一些学习理解,效果: 间隔的大多数方案是统过与背景图一样的边框颜色来达成,但如果要求扇形有其他边框颜色或者背景色不是纯色,效果就无法实现。大佬是通过给每一个要呈现的扇形添加一个透明的扇形来达成,适用场景更广!可以使用菜鸟编码工具https://c.runoob.com/front–end/59/根据官方文档做的引导线文字样式,
大部分功能是echarts社区大佬写的,地址https://www.makeapie.cn/echarts_content/xmQZRm2IHw.html
1.添加间隔
for (var i = 0; i < trafficWay.length; i++) {
data.push(
{
value: trafficWay[i].value,
name: trafficWay[i].name,
itemStyle: {
normal: {
borderWidth: 2,
borderColor: bgColor[i],
color: color[i],
},
},
},
{
value: 1,//数值控制间隔大小
name: "",
itemStyle: {
normal: {
color: "rgba(0, 0, 0, 0)",//均为透明颜色
borderColor: "rgba(0, 0, 0, 0)",
borderWidth: 0,
},
},
}
);
}
间隔的大多数方案是统过与背景图一样的边框颜色来达成,但如果要求扇形有其他边框颜色或者背景色不是纯色,效果就无法实现。大佬是通过给每一个要呈现的扇形添加一个透明的扇形来达成,适用场景更广!
2.内嵌图形
var img =""//base64编码值
graphic: {
elements: [
{
type: "image",
z: 3,
style: {
image: img,
width: 108,
height: 108,
},
left: "center",
top: "center",
position: [100, 100],
},
],
},
可以使用菜鸟编码工具https://c.runoob.com/front-end/59/
3.富文本引导文字
formatter: function (params) {
if (params.name) {
return `{a|${params.value}}n {b|${params.name}}`
}
},
rich:{
a:{color:'#d9e289',
fontSize:22
},
b:{color:'white',
fontSize:14}
}
根据官方文档做的引导线文字样式,formatter可以自定义文字内容,rich自定义文字样式
官方文档地址:https://echarts.apache.org/zh/option.html#series-pie.label.formatter
全部代码
<template>
<div class="contain">
<div style="width: 100%; height: 100%" ref="echarts"></div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
data() {
return {};
},
props: ["aName", "aValue"],
mounted() {
this.test();
},
methods: {
test() {
var myChart = echarts.init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gvv1zQDbDEQvD9bJH8FAjroX24ww+QPwKY9oRqhLm/BMHchkLMAFh4oaRZQm12N50SysYLC5wi2gEhvOFDSW+RWoHkzVb311xI4DE7N+eR6m29fA5cGlA1H0C6VKj+o7TEgPpY1gafeTOX2jKxx2Wtl19+JmuPNKnHblmQs6DV3+tQS8qIsXgdg8/jhHqUZZLed/xiyniUCderAjC7gI5NW9U6OB9q0Gym7ElyI+ApIbHY5CEPdguzZsNFTBA0G9a9rKNxh+Zzks7ynvVwQUckbd+petdZw/D6N/z+1Lku34UOHjPxYlO8K/MVWmxPgliaM17QDCBsyihojnai7rJ+vA+RdS80FxBx8JikvbvUaiKHNWC2aaY5O5QqbAQ8yalLh/2ceWIaA2gqQv8JYKbuLkHjR9Uew6Uu+LrRbWo/ed6krF0LmXapHq1ml9MHf9cH33Kax5X4FUA5dlrSMTDLUYTWn+pVYw/qvFvn00O5gkbA45ZGaeHNDMRDIeO16+vSr6xx2g1t1T9ALDXWOKUBwa88V+lT1ZdXE7q9w60y8oDn/wUYAO4wj7oKjzBSAAAAAElFTkSuQmCC";
var trafficWay = [
{
name: "火车",
value: 20,
},
{
name: "飞机",
value: 10,
},
{
name: "客车",
value: 30,
},
];
var data = [];
var color = ["#06bb7b", "#2aaec0", "#b9a671"];
let bgColor = ["#01e991", "#2ecfe2", "#e6cb84"];
for (var i = 0; i < trafficWay.length; i++) {
data.push(
{
value: trafficWay[i].value,
name: trafficWay[i].name,
itemStyle: {
normal: {
borderWidth: 2,
borderColor: bgColor[i],
color: color[i],
},
},
},
{
value: 1,//数值控制间隔大小
name: "",
itemStyle: {
normal: {
color: "rgba(0, 0, 0, 0)",//均为透明颜色
borderColor: "rgba(0, 0, 0, 0)",
borderWidth: 0,
},
},
}
);
}
var seriesOption = [
{
name: "",
type: "pie",
clockWise: false,
radius: [65, 75],
hoverAnimation: false,
itemStyle: {
normal: {
label: {
show: true,
position: "outside",
color: "#ddd",
textStyle: {
color: 'white', // 文字颜色
fontSize: 14 // 文字大小
},
formatter: function (params) {
if (params.name) {
return `{a|${params.value}}n {b|${params.name}}`
}
},
rich:{
a:{color:'#d9e289',
fontSize:22
},
b:{color:'white',
fontSize:14}
}
},
labelLine: {
show: true,
length:40,
length2:20,
},
},
},
data: data,
},
];
option = {
color: color,
graphic: {
elements: [
{
type: "image",
z: 3,
style: {
image: img,
width: 108,
height: 108,
},
left: "center",
top: "center",
position: [100, 100],
},
],
},
tooltip: {
show: false,
},
toolbox: {
show: false,
},
series: seriesOption,
};
option && myChart.setOption(option);
},
},
};
</script>
<style>
</style>
原文地址:https://blog.csdn.net/T23332/article/details/130323748
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_27494.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。