Jqplot - superscript in axis label

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

I tried using the Javascript sup () function as well as the actual html tags for the axis titles, but not in vain.

Basically I need to display units like m 3 etc. Should I be messing with AxisLabelRenderer or is there an obvious workaround I'm missing?

Thank.

+3


source to share


2 answers


You can use Unicode characters for this:

  • "Superscript two" (\ u00B2) (2)
  • "Superscript three" (\ u00B3) (³)
  • "Superscript" (\ 00B9) (¹)


try this:

      xaxis: {
      label: "Units m\u00B3"
      },

      

+5


source


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

  • ¹

    (& sup1;)
  • ²

    (& sup2;)
  • ³

    (& sup3;)


For example (m & sup2;):

  xaxis: {
    label: "m²"
  },

      

0


source







All Articles