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