jqplot - superscript in axis label

2020-07-20 03:57发布

As the title says how do I add superscript fonts to the axis labels in a jqplot graph?

I tried using Javascript sup() function and also actual html tags for the titles of the axes but to no vain.

Basically I need to display units like m3 etc. Do I have to tinker with the AxisLabelRenderer or is there any obvious workaround I am missing?

Thanks.

2条回答
淡お忘
2楼-- · 2020-07-20 04:16

Here's another answer, with HTML entities, which also works in jqPlot:

  1. ¹ (¹)
  2. ² (²)
  3. ³ (³)

For example (m²):

  xaxis: {
    label: "m²"
  },
查看更多
萌系小妹纸
3楼-- · 2020-07-20 04:21

You can use unicode characters for do that;

  1. "Superscript two"(\u00B2) (2)
  2. "Superscript three" (\u00B3) (³)
  3. "Superscript one" (\00B9) (¹)

try this:

      xaxis: {
      label: "Units m\u00B3"
      },
查看更多
登录 后发表回答