[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2018-04-10 Thread kenhes
One more thing: I'm connecting this to a sensor which is constantly 
updating the Mysql table. Will this code always be updating with the sensor 
results?

On Tuesday, April 10, 2018 at 6:20:39 PM UTC+1, Gabriel Mergulhaoo wrote:
>
> dont forget to add at the very beginning of the php file which contains 
> the gauge code
>
> require_once("GLOBALS.php");
>
>
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/56e10312-7c17-4e5b-9e38-a8644fd7f94f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2018-04-10 Thread kenhes
Thanks Gabriel. I'll give this a try.

On Tuesday, April 10, 2018 at 6:20:39 PM UTC+1, Gabriel Mergulhaoo wrote:
>
> dont forget to add at the very beginning of the php file which contains 
> the gauge code
>
> require_once("GLOBALS.php");
>
>
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/6f7276bf-fc3d-4d3b-9cd9-caa808f23048%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2018-04-10 Thread Gabriel Mergulhaoo
dont forget to add at the very beginning of the php file which contains the 
gauge code

require_once("GLOBALS.php");


-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/70d1faaa-4949-4383-b552-010152595a39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2018-04-10 Thread Gabriel Mergulhaoo
create a file sql.php and add following:



edit username, password and database then back to the script from previous 
post:

 mysqli_query($GLOBALS['SQL'], $sql1);

that function executes the query. "$GLOBALS['SQL']" is the DB link and 
$sql1 is the query saved.


Am Montag, 9. April 2018 23:19:58 UTC+2 schrieb kenhes:
>
> Did you get this working Andrew? Gabriel, I'm not sure what you mean by: 
> adjust global SQL to your DB info.
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/afd79d01-3b8c-43d4-af74-4bd764f21420%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2018-04-09 Thread kenhes
Did you get this working Andrew? Gabriel, I'm not sure what you mean by: 
adjust global SQL to your DB info.

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/6a1e0262-ccb8-4a66-a4e7-49e3b12a79bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[visualization-api] Re: How do I update a Google Gauge with MySQL data?

2017-07-20 Thread Gabriel Mergulhao

google.charts.load('current', {'packages':['gauge']});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {

var data = google.visualization.arrayToDataTable([
  ['Label', 'Value'],
  ['Temp°C',  0) {
// output data of each row
while($row = mysqli_fetch_assoc($query1)) {
echo $row["temperature"];
}
} else {
echo "0 results";
}], 
  
]);

var options = {
  width: 400, height: 120,
 blueFrom: 0, blueTo: -10,
 greenFrom: 0, greenTo:20,
  redFrom: 40, redTo: 100,
  yellowFrom:20, yellowTo: 40,
  minorTicks: 5
};

var chart = new 
google.visualization.Gauge(document.getElementById('chart_div'));

chart.draw(data, options);



//
//

Adjust sql1 to your needs and global SQL to your DB info.


Am Montag, 27. März 2017 23:55:06 UTC+2 schrieb ANDREW EDWARDS:
>
> Hi,
>
> HELP!!!
>
> I am doing a project where I have to update a Temperature Gauge and a 
> Chart with data from a database (MySQL). I have created a webpage, created 
> the database table, used a gauge from Google Charts but I do not how to get 
> the gauge to work using the data from the database.
>
> Here is the code for the gauge, I need to know what type of code that I 
> have to use (AJAX, JSON etc) and then how do I get the result in to the 
> gauge.
>
> 
> google.charts.load('current', {'packages':['gauge']});
> google.charts.setOnLoadCallback(drawChart);
>
> function drawChart() {
>
> var data = google.visualization.arrayToDataTable([
>   ['Label', 'Value'],
>   ['Temp°C', 19], 
>   
> ]);
> 
> var options = {
>   width: 400, height: 120,
>  blueFrom: 0, blueTo: -10,
>  greenFrom: 0, greenTo:20,
>   redFrom: 40, redTo: 100,
>   yellowFrom:20, yellowTo: 40,
>   minorTicks: 5
> };
>
> var chart = new 
> google.visualization.Gauge(document.getElementById('chart_div'));
>
> chart.draw(data, options);
> setInterval(function() {
>   data.setValue(0, 1, 40 + Math.round(jsonData));
>   chart.draw(data, options);
> }, 500);
>
> }
> 
>
> I have been going crazy for the past week so any help or guidance will be 
> much appreciated.
>
> Thanks
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
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/ec228530-ccf4-43f3-9465-4ced4e8d2885%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.