Hi Matt,

Currently, you will need to put each of your zones in a separate column.  I
don't know if there is a way to do this with SQL, but you could do it in
JavaScript with a simple loop over your data as you create another
datatable.

At some point in the future, it would probably be convenient if we had a
'series' role, which you could apply to your zones column to have it
automatically create the separate series for each zone.

On Wed, May 31, 2017 at 9:19 AM, Matt K90 <[email protected]> wrote:

> Hi there,
>
> I'll hold my hands up right now and say that I'm new to Google Charts, so
> apologies in advance if this is a noob question!
>
> I am trying to create a line chart of temperature information, collected
> by Raspberry Pi, from within my house. The data is stored in a MySQL
> database in the following format:
>
>       *  tdate                ttime        zone
>      temperature*
>         2017-05-14 17:24:17 Living Room Out Box 19
> 2017-05-14 17:24:23 Living Room In Box         20
> 2017-05-14 17:24:31 Living Room Out Box 20
> 2017-05-14 17:24:42 Living Room In Box         20
> 2017-05-14 17:24:48 Living Room Out Box 20
> 2017-05-14 17:24:53 Living Room In Box         20
> 2017-05-14 17:24:59 Outside                     15
> 2017-05-14 17:25:05 Living Room In Box         20
> 2017-05-14 17:25:12 Living Room Out Box 20
> 2017-05-14 17:25:18 Living Room In Box         20
> 2017-05-14 17:25:23 Outside                      15
> 2017-05-14 17:25:29 Living Room In Box         20
> 2017-05-14 17:25:35 Living Room Out Box 20
> 2017-05-14 17:25:41 Living Room In Box         20
>
>
> I am trying to plot a graph that has a line for each zone, similar to
> below:
>
>
> <https://lh3.googleusercontent.com/-lF-dlnsaTiA/WS68JBGNQ7I/AAAAAAAAy8E/GJ5sTZK7GrMf3T50Um86et5dg8uJNLRAgCLcB/s1600/Screen%2BShot%2B2017-05-31%2Bat%2B13.38.16.png>
>
>
>
> I cannot fathom how I need to organise my DataTable in order to account
> for the way in which the data is being returned. I will be adding
> thermometers to the house as I progress with the renovations, so I'd like
> to be able to cater for data where a line is plotted that may start half
> way through the results set  when that thermometer comes online (see
> "Outside" zone for example).
>
> In order to set the columns and data in the way I've seen in all tutorials
> and examples, I would need to know the order in which they appear in the
> database. However the data is not in that format as I've added thermometers
> as I've progressed, plus due to the way in which the thermometers work they
> might all be writing at slightly different times, so I cannot easily order
> the data to create the table orientation below (example I've found online
> showing add rows used when order is known):
>
> data.addColumn('number', 'Day');
>       data.addColumn('number', 'Guardians of the Galaxy');
>       data.addColumn('number', 'The Avengers');
>       data.addColumn('number', 'Transformers: Age of Extinction');
>
>       data.addRows([
>         [1,  37.8, 80.8, 41.8],
>         [2,  30.9, 69.5, 32.4],
>         [3,  25.4,   57, 25.7],
>         [4,  11.7, 18.8, 10.5],
>         [5,  11.9, 17.6, 10.4],
>         [6,   8.8, 13.6,  7.7],
>         [7,   7.6, 12.3,  9.6],
>         [8,  12.3, 29.2, 10.6],
>         [9,  16.9, 42.9, 14.8],
>         [10, 12.8, 30.9, 11.6],
>         [11,  5.3,  7.9,  4.7],
>         [12,  6.6,  8.4,  5.2],
>         [13,  4.8,  6.3,  3.6],
>         [14,  4.2,  6.2,  3.4]
>
> This might just be down to the way in which I need to group or order the
> data in my SQL SELECT statement. But I can't seem to figure it out!! Is
> there a means by which I can group/order/add the data in the DataTable
> object to achieve what I need to do/see?
>
> Any help would be very much appreciated!
>
> Thanks! Matt
>
>
>
> --
> 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/20a2e9aa-04e8-48d6-9a75-
> 536221c457fc%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/20a2e9aa-04e8-48d6-9a75-536221c457fc%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/CAOtcSJPBno-oXLjkt4CrfMw1QYSDw7iT3CFvRTtEuObEAjH9DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to