There are some examples on this page of the documentation:
https://developers.google.com/chart/interactive/docs/datatables_dataviews#javascriptliteral

But it sounds like your problem might be how to set up things via PHP.  For
that, this page might help:
https://developers.google.com/chart/interactive/docs/php_example

On Tue, Dec 27, 2016 at 2:56 PM, Gianni Declercq <[email protected]>
wrote:

> Hello, Daniel,
>
> Is it possible to give me an example how to do it the way I intended it to
> work?
>
> I really like to understand what I need to change as it would be a good
> exercise for me.
>
> Op dinsdag 27 december 2016 17:48:59 UTC+1 schreef Daniel LaLiberte:
>>
>> 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 [email protected].
>>> Visit this group at https://groups.google.com/grou
>>> p/google-visualization-api.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/google-visualization-api/0cad39eb-bbe4-4bc5-a1d3-edef7b
>>> 5e1913%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]   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 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/cc5a5613-4b42-4c83-a3fb-
> 14ff9c33f2f0%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/cc5a5613-4b42-4c83-a3fb-14ff9c33f2f0%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/CAOtcSJPcK5ExTXCovTrL9PBUS9m_%2BjXEVtBDjbnRpKAqXDsXdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to