Home › forums › Using CanvasJS › Format Numbers 1,000,000 to 1M or 1,000 to 1K
Hi Canvasjs. I’m new to this charting library. Recently I’ve read in documentation of valueFormatString, and I’ve read in the comments that it is not yet supported by this library. I’m asking if there is any suitable solution for what I’m trying to achieve?
1,000,000 >>>> 1M
1,000 >>>>>>>> 1K
You can achieve this with the help of labelFormatter. Please take a look at this gallery page for the live working example.
Thanks for the reply. I’ve tried this and works fine, however this is only possible if the whole values are positive. How about if I have a negative values because in my case there is a negative values. Does canvasjs support this feature?
Thank you again :)
Taking the absolute value within labelFormatter should work fine in this case. Please take a look at this JSFiddle.
If you are still facing issue, kindly create JSFiddle with sample data and share it with us so that we can look into the code, understand the scenario better and help you out.
You must be logged in to reply to this topic.