javascript - How to put superscript google chart title? -
i have next code
var title = 'hello<sup>2</sup>';
now i'm using google charts , want 2
appear superscript.
i
hello<sup>2</sup>
the code on title is
<text text-anchor="start" x="148" y="52.9" font-family="arial" font-size="14" font-weight="bold" stroke="none" stroke-width="0" fill="#000000">hello<sup>2</sup></text>
which on svg, tried, next
var title = 'hello<text style="vertical-align: super">2</text>';
but
hello<text style="vertical-align: super">2</text>
any ideas of how can put 2
superscript?
the easiest method (if want title) make separate div contains text title in html. if want within google charts natively, need write javascript manipulate title svg.
to create superscript in svg, can see this article. can see, need svg change title text this:
<svg viewbox = "0 0 500 300" version = "1.1"> <desc> text example </desc> <g fill = "navy"> <text x = "10" y = "25" font-size = "20"> <tspan> e = mc <tspan baseline-shift = "super"> 2 </tspan> </tspan> <tspan x = "10" y = "60"> t <tspan baseline-shift = "sub"> i+2 </tspan> =t <tspan baseline-shift = "sub"> </tspan> + t <tspan baseline-shift = "sub"> i+1 </tspan> </tspan> </text> </g> </svg>
so in case, can try finding text title, , manipulating svg using jquery. of course, easier make separate <div>
html title, choice yours.
Comments
Post a Comment