[英]echarts: How to use subscript/superscript (or latex/mathjax) in 3D axis labels?
How do I render superscript or subscript in a 3D chart?如何在 3D 图表中呈现上标或下标?
Right now I'm doing like this:现在我正在这样做:
xAxis3D: { scale: true, gridIndex: 0, name: "f0" },
yAxis3D: { scale: true, gridIndex: 1, name: "f1" },
zAxis3D: { scale: true, girdIndex: 2, name: "f2" },
and the y-axis label in the plot looks like this:图中的 y 轴标签如下所示:
Instead of f2
, is there any way I can label it like f₂
(similar to f<sub>2</sub>
in html)?而不是
f2
,有什么办法可以像f₂
一样标记它(类似于 html 中的f<sub>2</sub>
)?
Also, is there any way to use latex or mathjax within echarts?另外,有没有办法在echarts中使用latex或mathjax?
As I know Echarts doesn't have this or similar features.据我所知,Echarts 没有这个或类似的功能。 But even if it did, it's not enough.
但即使这样做了,也还不够。 Need improve the zRender (visualization engine) to support this feature.
需要改进 zRender(可视化引擎)以支持此功能。
I would to recommend for you to capture the values and replace to Unicode symbol in formatter
, see example:我建议您在
formatter
捕获值并替换为 Unicode 符号,请参见示例:
var myChart = echarts.init(document.getElementById('main')); var chars = ['\¼', '\½', '\¾', '\⅐', '\⅑', '\⅒']; var option = { xAxis: [{ data: [0, 1, 2, 3, 4, 5], axisLabel: { formatter: (val, idx) => chars[parseInt(val)], } }], yAxis: [{}], series: [{ name: 'Series', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] }; myChart.setOption(option);
<script src="https://cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js"></script> <div id="main" style="width: 600px;height:400px;"></div>
Addition:添加:
PS Just for my: have you ever seen JS-charts with embedded Latex? PS 只为我:你见过嵌入 Latex 的 JS 图表吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.