You must be logged in to post your query.
Home › Forums › Chart Support › How to reduce number of 0 on Y axis?
Tagged: javascript, php
Good afternoon,
I am displaying data from the database onto the graph. Values that I am plotting on Y axis are Watts. The small problem is that on the graph, my Y values are like this:
600,000,000,000 500,000,000,000 400,000,000,000 ...
So my question is, is there a function, which would allow me to replace those extra 0s’ into something like this:
600T Watts 500T Watts 400T Watts ...
I do apologies if this question was already asked, I have tried finding this answer here already, but I couldn’t find anything similar.
Thank you kindly in advance. Best wishes, Saul
Please Ignore this. It has been resolved using this function:
function addSymbols(e) { var suffixes = ["", "K", "M", "B"]; var order = Math.max(Math.floor(Math.log(Math.abs(e.value)) / Math.log(1000)), 0); if (order > suffixes.length - 1) order = suffixes.length - 1; var suffix = suffixes[order]; return CanvasJS.formatNumber(e.value / Math.pow(1000, order)) + suffix; }
and declaring it in Y axis.
Thank you.
Saul,
Glad that you figured it out :)
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register