Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superscript for html Canvas? (e.g. 2 ^ 3) #521

Closed
tasoskakour opened this issue Oct 30, 2017 · 5 comments
Closed

Superscript for html Canvas? (e.g. 2 ^ 3) #521

tasoskakour opened this issue Oct 30, 2017 · 5 comments

Comments

@tasoskakour
Copy link

tasoskakour commented Oct 30, 2017

First of all, congratulations to this wonderful work!

I want to show a number raised to a power in the yLabelAxis.
For example I want to show 10^3 with the '3' positioned as the power. I see that sup is not supported from canvas. 10<sup>3</sup>

Is it possible to do this?

@FVANCOP
Copy link
Owner

FVANCOP commented Oct 30, 2017

Hi,

I've checked on the web, but apparently special characters (like ² and ³) cannot be displayed on Canvas and tags are not allowed in canvas text. I've no simple solution for you... Working with the add-ins "shapesInChart" could be a bypass but not really easy to use for such a request.

Perhaps someone else will have a solution...

François

https://github.com/FVANCOP/ChartNew.js/wiki/900_050_Shapes-Text-Images_In_Chart

@markosko
Copy link
Contributor

idiotic thing maybe but String.fromCharCode(253) wouldnt works 253 is power of 2 and its part of extended ascii table

@markosko
Copy link
Contributor

markosko commented Oct 30, 2017

okey sorry so for power of 2 or 3 can be done with "\u00B2" for 2 and "\u00B3" for 3 for others you can only check out unicode table for bigger power of x
image

EDIT:
Actual using is for example - xAxisLabel:"power of \u00B2"

@FVANCOP
Copy link
Owner

FVANCOP commented Oct 31, 2017

@markosko - Nice to know and really interesting ! Thanks a lot. I will update the sample function_x2.html :-)

@Others :
Following link will give a complete liste of all available power chars.
https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts

Example : \u207D\u207F\u207A\u2075\u207E <=> (n+5) in "superscript".

Other link with a complete list of all unicode chars...
https://unicode-table.com/en/#control-character

@FVANCOP FVANCOP closed this as completed Oct 31, 2017
@tasoskakour
Copy link
Author

Thanks a lot!,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants