diff --git a/src/main/resources/static/css/home/home.css b/src/main/resources/static/css/home/home.css index 77b95ce..e63d8db 100644 --- a/src/main/resources/static/css/home/home.css +++ b/src/main/resources/static/css/home/home.css @@ -6,10 +6,12 @@ .one{ height: 4%; width: 100%; + margin-left: 20px; } .one span{ font-weight: bold; font-size: 20px; + margin-left: 20px; } .two{ height: 40%; @@ -65,7 +67,7 @@ } .three-one div:nth-child(1){ margin-top: 1%; - margin-left: 2%; + margin-left: 20px; height: 10%; } .three-one div:nth-child(2){ @@ -116,7 +118,7 @@ } .four-one div{ height: 58%; - margin-left: 2%; + margin-left: 20px; padding-top: 1%; } .four-one span{ diff --git a/src/main/resources/static/js/home/home.js b/src/main/resources/static/js/home/home.js index 960f6c1..b9a4899 100644 --- a/src/main/resources/static/js/home/home.js +++ b/src/main/resources/static/js/home/home.js @@ -257,7 +257,44 @@ function echartstwo(){ option = { tooltip: { trigger: 'item', - extraCssText: 'width:160px;height:100px;', + extraCssText: 'width:200px;height:100px;', + formatter: function (params) { + if (!params || !params.name || !params.value) { + return ''; // 如果数据无效,则返回空字符串 + } + + let text = ''; // 创建一个空字符串来存放最终的文本 + + // 处理参数数据 + let name = params.name; + let value = params.value; + + // 每行最多显示15个字符 + const maxCharsPerLine = 8; + + // 将名称分隔成多行 + let lines = []; + while (name.length > maxCharsPerLine) { + let spaceIndex = name.lastIndexOf(' ', maxCharsPerLine); + if (spaceIndex === -1) { + spaceIndex = maxCharsPerLine; + } + lines.push(name.slice(0, spaceIndex)); + name = name.slice(spaceIndex).trim(); + } + lines.push(name); + + // 将每一行添加到最终文本中,并在每行之间添加换行符 + lines.forEach(function (line) { + text += line + '
'; + }); + + // 添加值 + text += ': ' + value; + + // 返回格式化的文本 + return text; + } }, // legend: { // orient: 'vertical',