Is there a way to let Chart.js to round up decimals?
Sure, i can do it in PHP where i get the numbers.
But maby there is an option in Chart.js to do this?
I have tried nothing, but google search.
What i want is: 2733.33
ChartJS expects the data to be in the format you need when it is fed in; as you mention you'll need to do it in PHP prior to putting it into the data array.
Related
This works the way I want it to but I want to use the ArrayFormula to add the formula to the whole column starting at Cell J2:
=IF(E2:E="Closed","",MINUS(TODAY(),I2))
This doesn't work:
=ARRAYFORMULA(IF(E2:E="Closed","",,J2:J), MINUS(TODAY(),I2))
I have tried multiple ways to add the ArrayFormula into it and reorganized it multiple ways but it failed.
Any ideas where I am going wrong?
Any help appreciated!
Please use the following formula
=ArrayFormula(IF(I2:I<>"", IF(E2:E="Closed","CL",MINUS(TODAY(),I2:I)),""))
(where today is May 20th. Adjust ranges and notifications to your liking)
I'm new to chartjs and couldn't find any example on this...
Is there a way to stack these charts vertically (same x-axis) with one long y-axis instead of 3 scales/y-axes ?
From this:
To something like this : (just an example)
here an example:
https://jsfiddle.net/Developer2011/ogjewLuz/34/
Thanks
Soo I did some research about it and there is a lot of people with this problem.
The solution that I'm giving to you will have some problems interacting with the final user but if it's just for display maybe this is what you want.
Right here is the example where you can ofcourse add your own format and specifications:
https://jsfiddle.net/4th6rbcw/3/
what is wrong with ratio? (100,200)
https://chart.googleapis.com/chart?cht=p&chd=t:100,200&chs=300x120&chl=Hello|World
As marcog explained, by default values over 100 will be truncated to 100, thus causing your api call to be processed in the background as:
https://chart.googleapis.com/chart?cht=p&chd=t:100,100&chs=300x120&chl=Hello|World
which is why you see a pie chart with two equal pieces. One way to fix this is to add a custom scale to your data series using the chds parameter like this:
https://chart.googleapis.com/chart?cht=p&chd=t:100,200&chds=0,200&chs=300x120&chl=Hello|World
Note I added a &chds=0,200 to specify that values can range from 0 to 200.
Another option is to use percentages rather than actual values
Hope this helps.
The values need to be between 0 and 100, with values above 100 truncated to 100 (reference).
Had a quick mess around with the URL. Is it possible there's meant to be a "total" parameter in the URL? Since 3 parameters just splits it equally into 3 parts...
i want to display the values on the y-axis with $ but i couldn't figure out how it is done. is it even possible? if yes please how can i do it? is it also possible to make use a gradient in bars ?
Define a format string in chxs. Use cUSD to format as US dollars.
Here's an example from the docs:
https://chart.googleapis.com/chart
?cht=s
&chd=s:984sttvuvkQIBLKNCAIi,DEJPgq0uov17zwopQODS,AFLPTXaflptx159gsDrn
&chxt=x,y,r
&chxr=0,0,1000000,250000|1,0,60|2,0,5000
&chxs=0N*e*,000000|1N*cUSD*Mil,FF0000|2N*sz2*,0000FF
&chs=250x125
The relevant portion being chxs=...1N*cUSD*Mil,FF0000.
The url I'm using is this:
https://chart.apis.google.com/chart?chxl=0:|2010-08-06|2010-08-02|2010-08-05|2010-08-03|2010-08-04|1:|0|2347.002|3650|2:|min|average|max&chxp=2,10,50.83,90&chxr=0,2347.002,3650&chxt=x,y,r&chs=200x120&cht=bvg&chco=EBB411&chd=t:3455.01,730,2240,1760,3550&chma=|5&chtt=Revenue
The image:
The bars shouldn't be filling all the way to the top, but I cannot figure out what I've done wrong.
See the documentation on data encoding:
Basic text-formatted data lets you specify floating point values from 0—100, inclusive, as numbers.
You're supplying numbers bigger than 100, which is why they're going all the way to the top.
For example, if I change one of the supplied data points to 50, it looks like this:
You need to either include a scaling parameter or used the extended encoding format.