This commit is contained in:
duanxiaohai 2024-05-16 14:03:35 +08:00
parent 520afc5132
commit 5f77b825f6
1 changed files with 7 additions and 18 deletions

View File

@ -25,7 +25,7 @@ const props = defineProps({
}); });
const data = reactive({ const data = reactive({
list: [[140], [260], [330], [270]], list: [[140], [260], [330], [270]],
list1: [], list1: "",
year: [], year: [],
option: {}, option: {},
totalMax: null, totalMax: null,
@ -39,20 +39,9 @@ const data = reactive({
// const lb = ref(0); // const lb = ref(0);
const getOption1 = () => { const getOption1 = () => {
// data.list = [] data.list = data.list1.map((item) => [item]);
data.list.forEach((item,index) => {
data.list1.push([item]);
});
console.log(data.list,666);
// data.list.forEach((item,index) => {
// data.total += item[index];
// }); //
// data.totalMax = data.total * 1.06; //
// data.lb = Math.trunc(data.total * 0.03);//
}; };
const getOption = () => { const getOption = () => {
console.log(data.list, 111);
console.log(data.total, data.totalMax, data.lb, 222);
data.option = { data.option = {
legend: { legend: {
show: true, show: true,
@ -159,7 +148,7 @@ const getOption = () => {
normal: { normal: {
show: true, show: true,
position: ["35%", "-60%"], position: ["35%", "-60%"],
formatter: `${Math.trunc((data.list[1][0] * 100) / data.total)}%`, formatter: `${data.list[1][0]}%`,
color: "#fff", color: "#fff",
fontSize: 22, fontSize: 22,
fontWeight: 600, fontWeight: 600,
@ -191,7 +180,7 @@ const getOption = () => {
normal: { normal: {
show: true, show: true,
position: ["35%", "-60%"], position: ["35%", "-60%"],
formatter: `${Math.trunc((data.list[2][0] * 100) / data.total)}%`, formatter: `${data.list[2][0]}%`,
color: "#fff", color: "#fff",
fontSize: 22, fontSize: 22,
fontWeight: 600, fontWeight: 600,
@ -223,7 +212,7 @@ const getOption = () => {
normal: { normal: {
show: true, show: true,
position: ["35%", "-60%"], position: ["35%", "-60%"],
formatter: `${Math.trunc((data.list[3][0] * 100) / data.total)}%`, formatter: `${data.list[3][0]}%`,
color: "#fff", color: "#fff",
fontSize: 22, fontSize: 22,
fontWeight: 600, fontWeight: 600,
@ -249,7 +238,7 @@ const getOption = () => {
color: "rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.1)",
barBorderRadius: [100, 100, 100, 100], barBorderRadius: [100, 100, 100, 100],
}, },
data: ["2019"].map(() => 106), data: ["2019"].map(() => 120),
barWidth: 50, barWidth: 50,
}, },
], ],
@ -264,7 +253,7 @@ const setChart = () => {
// 使 // 使
onBeforeMount(() => { onBeforeMount(() => {
setTimeout(() => { setTimeout(() => {
data.list = props.list; data.list1 = props.list;
getOption1(); getOption1();
getOption(); getOption();
setChart(); setChart();