Sign in to follow this  
siric

Need Some Help Getting Data From Database Into Angular Guage

Recommended Posts

Hi,

 

I am trying to get a real-time angular gauge with data from a mysql table. I am trying to use the dataStreamURL but my question is how do I get the returned data into the dial value?

 

 

Gauge.html


<div class="gen-chart-render">

                       <div id="chartContainer">FusionWidgets will load here</div>

                       <script type="text/javascript"><!--
					var myChart = new FusionCharts( "../../Charts/AngularGauge.swf", 
     					"myChartId", "400", "200", "0", "1" );

					 myChart.setXMLData('<chart lowerLimit="0" upperLimit="100" lowerLimitDisplay="Good" upperLimitDisplay="Bad" numberSuffix="%" showValue="1" dataStreamURL="getutil.php" refreshInterval="3">\n\
					 <colorRange>\n\
					 <color minValue="0" maxValue="50" code="8BBA00"/>\n\
					 <color minValue="50" maxValue="80" code="F6BD0F"/>\n\
					 <color minValue="80" maxValue="100" code="FF654F"/>\n\
					 </colorRange>\n\
					 <dials>\n\
					 <dial value="0" />\n\
					 </dials>\n\
					 </chart>');
     					 myChart.render("chartContainer");
					 // -->
					 </script>

					 </div>

 

 

getutil.php

 

$username = "xxx";
$password = "yyy";
$db = "fusionchartsdb"; 
$hostname = "localhost";

// make connection to database
mysql_connect($hostname, $username, $password) or die("Unable to connect to host $hostname");
mysql_select_db($db) or die("Unable to select database $db");


$portid='1';
$strSQL = "SELECT util from utilisation WHERE portid = '$portid'";
$result=mysql_query($strSQL) or die(mysql_error());	

$util = mysql_result($result,0,"util");

print $util;

 

 

I have checked the getutl by itself and it is working fine.

 

 

Thanks

Share this post


Link to post
Share on other sites

Hi Siric ,

 

 

i need Your help I just add your code to implment the angular gauge , but it seems that it does not support SetXMLData function or there is a syntax error on the below , please help am new in using this tool

 

myChart.setXMLData('<chart lowerLimit="0" upperLimit="100" lowerLimitDisplay="Good" upperLimitDisplay="Bad" numberSuffix="%" showValue="1" dataStreamURL="getutil.php" refreshInterval="3">\n\ 
                            <colorRange>\n\ 
                        <color minValue="0" maxValue="50" code="8BBA00"/>\n\ 
                        <color minValue="50" maxValue="80" code="F6BD0F"/>\n\ 
                           <color minValue="80" maxValue="100" code="FF654F"/>\n\ 
                                                </colorRange>\n\ 
                               <dials>\n\ 
                                 <dial value="0" />\n\ 
                                     </dials>\n\ 
                                          </chart>'); 

Edited by ror

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Could you please paste your complete code of rendering the chart as well as the Data provider page (getutil.php) code, to better look into this issue?

 

Also please confirm once that you have provided the correct relative URL of the chart SWF file and data provider page.

 

Awaiting your response!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this