This commit is contained in:
leiyong
2024-01-29 07:24:55 +00:00
parent 3c488cbcb6
commit 58d2d2cc19
2 changed files with 37 additions and 2 deletions
+34
View File
@@ -3,3 +3,37 @@ $(function()
initBurnChar();
});
function truncateCustomString(str, maxLength)
{
let count = 0;
let strLength = 0;
for(let char of str)
{
if(char.match(/[A-Z]/))
{
count += 2;
}
else if(char.match(/[a-z]/))
{
count += 1;
}
else if(char.charCodeAt(0) > 255)
{
count += 2;
}
else
{
count += 1;
}
if(count > maxLength)
{
break;
}
strLength++;
}
return str.slice(0, strLength);
}
+3 -2
View File
@@ -35,10 +35,11 @@ function initBurnChar()
Object.values(executions).forEach(function(execution)
{
var chartDom = document.getElementById('burn' + execution.id);
var myChart = echarts.init(chartDom);
var myChart = echarts.init(chartDom);
var title = truncateCustomString(execution.name, 38);
var option = {
title: {
text: execution.name,
text: title,
top: 10,
textStyle: {
color: '#a1c4e9',