Google charts using php and SQL Server as data source

29 views
Skip to first unread message

rcb

unread,
Oct 24, 2015, 10:37:03 AM10/24/15
to Google Visualization API

I am currently working on generating a multi-line graph to plot count of 3 different parameters (x, y, z) per hour for each day. I'm facing 2 challenges here :

  1. Using a php script I've connected to the SQL Server. Currently I'm getting an array of all values in my resultset, however I need to pass only values from 4 columns to the chart, and I'm not sure how to filter out the data.

  2. The date is stored in the DB in the following format : 2015-09-20 00:13:43.000 I'm not sure how to get it to the google charts time format of [00,13,43].

Google charts expects a json format to handle graphs, I understand I would need to get the following format in order to plot my graph : [[00,13,43], 45, 50, 60]] : where 45, 50, and 60 are the counts of different parameters, and [00,13,43] would be the time along the X axis.


Any help would be much appreciated! Thanks

Reply all
Reply to author
Forward
0 new messages