Skip to content

How to set subscript text in Chart.js axis title #8544

Answered by LeeLenaleee
amigian74 asked this question in Q&A
Discussion options

You must be logged in to vote

There is no build in way tp do this, you can only provide valid unicode subscript. (https://jsfiddle.net/Leelenaleee/p025vr6h/2/).

If you want subscript in the axis title the best thing you can do is set display to true, labelString to an empty string and use the space yourself to draw the text. You can achieve your subscript by making the font smaller and moving the y position of the text.

See this stack issue for more info about subscript in a canvas: https://stackoverflow.com/questions/8326191/html5-canvas-subscript-and-superscript

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kurkle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants