diff --git a/lib/zin/wg/thinkappeals/js/v1.js b/lib/zin/wg/thinkappeals/js/v1.js index d514a9f73e..02d403043f 100644 --- a/lib/zin/wg/thinkappeals/js/v1.js +++ b/lib/zin/wg/thinkappeals/js/v1.js @@ -11,6 +11,23 @@ window.formatSeriesLabel = function(params) return params?.value?.toFixed(2); } +/** + * 格式化图例名称。 + * Format the legend name. + * + * @param string name + * @access public + * @return string + */ +window.formatLegend = function(name) +{ + const parts = name.split('/'); + if(parts.length > 0) name = `{bolder|${parts[0]}}/${parts.slice(1).join(' ')}`; + const reg = /[\u4E00-\u9FA5]/; + const threshold = !reg.test(name) ? 60 : 30; + return name.length > threshold ? name.substr(0, threshold) + '...' : name; +} + /** * 初始化 $APPEALS 图表数据后的回调函数。 * The callback function after initializing the $APPEALS chart data.