Closed ShawYuan97 closed 3 years ago
Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.
A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.
You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe to our mailing list.
Have a nice day! 🍵
参见以下两种方式
// 使用预设字符
const superscripts = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹'];
function toSuperscript(val) {
return (val + '')
.split('')
.map(t => superscripts[t])
.join('');
}
// 使用 Unicode
const superscriptUnicodes = ['B9', 'B2', 'B3'];
function toSuperscript2(val) {
return (val + '')
.split('')
.map(t => String.fromCharCode('0x' + (t > 0 && t < 4 ? superscriptUnicodes[t - 1] : '207' + t)))
.join('');
}
然后 ECharts 添加 axisLabel
配置
axisLabel: {
formatter: (val) => {
// 2 为底数 val 为指数
// toSuperscript 或 toSuperscript2 均可
return 2 + toSuperscript(val);
}
}
相似问题:#13363 #7062
What problem does this feature solve?
like this y axis Label
What does the proposed API look like?
axisLabel