This commit is contained in:
duanxiaohai 2024-07-13 17:59:02 +08:00
parent 51886476f0
commit d5099c40fb
3 changed files with 1 additions and 156 deletions

BIN
dist.zip

Binary file not shown.

View File

@ -1,155 +0,0 @@
<template>
<div ref="chart" style="width: 100%; height: 300px"></div>
</template>
<script setup>
import { onBeforeMount, onMounted, reactive, ref } from "vue";
// echarts
import * as echarts from "echarts";
const chart = ref(); // DOM
const data = reactive({
list: [],
month: [],
option: {},
color: [
"rgba(255, 252, 166, 1)",
"rgba(128, 229, 229, 1)",
"rgba(246, 255, 103, 1)",
"rgba(82, 174, 255, 1)",
],
});
let datas = [
{
name: "高血压",
value: 200,
},
{
name: "糖尿病",
value: 230,
},
{
name: "其他疾病患者",
value: 198,
},
{
name: "无重大疾病患者",
value: 80,
},
];
const getOption = () => {
data.option = {
color: data.color,
title: {
//
// text: "", //
textStyle: {
//
color: "#fff",
fontSize: 16,
},
// left: "24%", //
// top: "38%", //
// subtext: `100%`, //
// subtextStyle: {
// //
// color: "#00FFFB",
// fontSize: 22,
// fontWeight: "bold",
// },
// textAlign: "center", //
},
// grid: {
// top: "13%",
// left: "1%",
// right: "1%",
// bottom: "0%",
// },
legend: {
itemHeight: 10,
itemWidth: 25,
icon: "rect",
orient: "vertical",
top: "center",
right: "16%",
itemGap: 20, //
textStyle: {
align: "left",
color: "#ffffff",
verticalAlign: "middle",
rich: {
name: {
width: 80,
fontSize: 16,
},
value: {
width: 30,
align: "right",
fontFamily: "Medium",
fontSize: 16,
},
rate: {
width: 20,
align: "right",
fontSize: 16,
},
},
},
data: datas,
formatter: (name) => {
if (datas.length) {
const item = datas.filter((item) => item.name === name)[0];
return `{name|${name}} {value| ${item.value}}`;
}
},
},
tooltip: {
trigger: "item",
formatter: "{b}:{d}",
},
calculable: true,
series: [
{
name: "",
type: "pie",
// radius: ["45%", "90%"],
// center: ["25%", "50%"],
roseType: "radiuas",
labelLine: {
normal: {
length: 30, // 线
length2: 70,
lineStyle: {
color: "white", // 线
},
},
},
label: {
show: true,
formatter: "{b}:{c}" + "个\n\n",
borderWidth: 10,
borderRadius: 4,
fontSize: 16,
padding: [0, -80],
},
data: datas,
},
],
};
};
const setChart = () => {
var myChart = echarts.init(chart.value);
myChart.setOption(data.option);
};
// 使
onBeforeMount(() => {
setTimeout(() => {
getOption();
setChart();
}, 600);
});
</script>
<style scoped></style>

View File

@ -467,7 +467,7 @@
</div>
<div class="flex1" style="margin-top: 10px">
<div class="yd_title last_1">
<div class="gTitle"> 近30天 </div>
<!-- <div class="gTitle"> 近30天 </div> -->
<div class="animate-border">
<i></i>
<i></i>