From 6eb7a5aba15a3446f0e992c27822e5b2c137a13d Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Fri, 31 May 2024 10:43:45 +0800 Subject: [PATCH] 1 --- resources/views/admin/home.blade.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/views/admin/home.blade.php b/resources/views/admin/home.blade.php index 8f12cde..4cf25ba 100644 --- a/resources/views/admin/home.blade.php +++ b/resources/views/admin/home.blade.php @@ -360,12 +360,15 @@ ] }) var pieChart = echarts.init(document.querySelector("#pie-chart")); - var pieRows = Math.ceil(lies.length / 3); - var pieR = (100 / pieRows); + var pieRows = Math.ceil(datas.length / 3); // 确保使用正确的变量,这里假设datas是你的数据数组 + var pieColumns = 3; // 每行的饼图数量 + var pieR = 100 / pieColumns; // 每个饼图占据的百分比宽度和高度 var option = { series: datas.map(function (data, idx) { - var left = idx * pieR; - var top = Math.floor(idx / 3) * pieR + var columnIndex = idx % pieColumns; // 当前饼图在其行中的列索引 + var rowIndex = Math.floor(idx / pieColumns); // 当前饼图的行索引 + var left = columnIndex * pieR; // 计算left位置 + var top = rowIndex * pieR; // 计算top位置 return { type: 'pie', radius: [40, 60],