
<div class="risk-type-echarts" id="main"></div>
import * as echarts from "echarts";
option: {
title: {
text: "14",
x: "center",
y: "center",
top: "80",
textStyle: {
fontSize: 25,
color: "#FAB208",
fontWeight: "700",
},
},
tooltip: {
trigger: "item",
},
legend: {
top: "0",
left: "0",
data: [],
},
graphic: {
type: "text",
left: "center",
top: "120px",
z: 2,
zlevel: 100,
style: {
text: "巡检总次数",
fill: "#fff",
fontSize: 16,
},
},
series: [
{
name: "",
type: "pie",
radius: ["60%", "90%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
emphasis: {
label: {
show: false,
fontSize: "0",
fontWeight: "bold",
},
},
labelLine: {
show: false,
},
data: [
{
value: 9,
name: "累计巡检次数",
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#e6c24e" },
// { offset: 0.5, color: "#FAFF75" },
{ offset: 1, color: "#d87e42" },
]),
},
},
},
{
value: 5,
name: "累计漏检次数",
itemStyle: {
normal: {
fontSize: 0,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#48bbeb" },
// { offset: 0.5, color: "#FAFF75" },
{ offset: 1, color: "#3458e4" },
]),
},
},
},
],
},
],
},
mounted() {
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById("main"));
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(this.option);
},