Hi Gianni, Looks like your numbers needs to be non-string numeric values, not strings. The Dates are a special case because to create a real date, you would have to use new Date(...) which is not allowed in JSON, so the Google Charts data can include "Date(..)" strings instead.
On Sun, Dec 25, 2016 at 4:13 PM, Gianni Declercq <[email protected]> wrote: > Hello, > > What I'm trying to create is a chart with multiple lines. I have for > example 2 Raspberry Pi's which temperature data gets feed to the database. > Each RPI has a unique ID which I call UID. > > I'm trying to loop over my query as you can see in my code so that I can > create a seperate line for each RPI. But I'm having problems putting the > temperature data from the database in an array. When for example the data > when converted to json should be > > {"cols":[{"label":"datetime","type":"datetime"},{"label":"RPI1","type": > "number"},{"label":"RPI2","type":"number"}],"rows":[{"c":[{"v":"Date(2016, > 11, 25, 16, 29, 29)"},{"v":"20"},{"v":"12"}]},{"c":[{"v":"Date(2016, 11, > 25, 16, 33, 22)"},{"v":"15"},{"v":"25"}]}]} > > > it outputs > > {"cols":[{"label":"datetime","type":"datetime"},{"label":"RPI1","type": > "number"},{"label":"RPI2","type":"number"}],"rows":[{"c":[{"v":"Date(2016, > 11, 25, 16, 29, 29)"},{"v":"15"},{"v":"12"}]},{"c":[{"v":"Date(2016, 11, > 25, 16, 33, 22)"},{"v":"15"},{"v":"25"}]}]} > > > > I guess there is something going wrong when putting the temperature data > in the DatabaseArray. But I can't seem to figure out how to do it the right > way. (I'm a bit new when it comes to PHP) > > My code is posted as a attachment, also an example of how it should > approximatily look like in Excel. > > > > A picture of my database table: > > > <https://lh3.googleusercontent.com/-XfZtumyg7tc/WGA0Zt-C-DI/AAAAAAAABHQ/dalrMCGqidgjfWzkSXcoxu_BmZZt2nq3gCLcB/s1600/1.PNG> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to google-visualization-api@ > googlegroups.com. > Visit this group at https://groups.google.com/ > group/google-visualization-api. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-visualization-api/0cad39eb-bbe4-4bc5-a1d3- > edef7b5e1913%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/0cad39eb-bbe4-4bc5-a1d3-edef7b5e1913%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> 5CC, Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJNXk7NDR_HJ0J7DR1Q2F1JwnD4%3DBK355AVC3frunoTbdg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
