试验管理
This commit is contained in:
parent
d652c7278d
commit
22cbcb4a92
|
|
@ -204,9 +204,10 @@ function echartsone(type){
|
|||
tooltip: {
|
||||
// 修改tooltip的触发方式,例如改为'axis'轴触发
|
||||
trigger: 'axis',
|
||||
confine: true,
|
||||
// 自定义内容格式化函数
|
||||
// 其他tooltip样式和行为
|
||||
extraCssText: 'width:160px;height:100px;',
|
||||
extraCssText: 'height:100px;',
|
||||
backgroundColor: 'rgba(50,50,50,0.7)', // 背景颜色
|
||||
borderColor: '#333', // 边框颜色
|
||||
borderWidth: 1, // 边框宽度
|
||||
|
|
@ -214,6 +215,7 @@ function echartsone(type){
|
|||
textStyle: {
|
||||
color: '#fff' // 文本颜色
|
||||
},
|
||||
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
|
|
@ -257,7 +259,7 @@ function echartstwo(){
|
|||
option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
extraCssText: 'width:200px;height:100px;',
|
||||
extraCssText: 'width:210px;height:100px;',
|
||||
formatter: function (params) {
|
||||
if (!params || !params.name || !params.value) {
|
||||
return ''; // 如果数据无效,则返回空字符串
|
||||
|
|
@ -269,8 +271,8 @@ function echartstwo(){
|
|||
let name = params.name;
|
||||
let value = params.value;
|
||||
|
||||
// 每行最多显示15个字符
|
||||
const maxCharsPerLine = 8;
|
||||
// 每行最多显示13个字符
|
||||
const maxCharsPerLine = 15;
|
||||
|
||||
// 将名称分隔成多行
|
||||
let lines = [];
|
||||
|
|
@ -285,12 +287,16 @@ function echartstwo(){
|
|||
lines.push(name);
|
||||
|
||||
// 将每一行添加到最终文本中,并在每行之间添加换行符
|
||||
lines.forEach(function (line) {
|
||||
text += line + '<br/>';
|
||||
lines.forEach(function (line,index) {
|
||||
if (index === lines.length - 1) {
|
||||
text += line + ':'+ '<br/>';
|
||||
} else {
|
||||
text += line + '<br/>';
|
||||
}
|
||||
});
|
||||
|
||||
// 添加值
|
||||
text += ': ' + value;
|
||||
text += value;
|
||||
|
||||
// 返回格式化的文本
|
||||
return text;
|
||||
|
|
|
|||
Loading…
Reference in New Issue