moose2004 Report post Posted January 4, 2011 I have implemented an angular gauge with a database query returning a numeric value to the gauge. Working great! Now I would like to also return a time stamp from the database and display it as a label below the gauge. How can achieve this?? I have attached image of what it currently looks like. Here is my javascript code… <div id="angular_<?php echo $random_value; ?>" align="center" style="width: 100%; height: 100%" > <script type="text/javascript"> var myChart = new FusionCharts("<?php echo $SERVER_ADDRESS; ?>/includes/functions/widgets/gauges/fusion/AngularGauge.swf", "myChartId_<?php echo $random_value; ?>", "280", "280", "0", "0"); var chart_data = "<chart tickValueDistance='30' pivotRadius='5' pivotFillColor='333333' bgAlpha='0' bgColor='000000' showBorder='0' basefontColor='FFFFFF' chartTopMargin='15' chartBottomMargin='100' chartLeftMargin='37' chartRightMargin='37' toolTipBgColor='80A905' gaugeFillMix='{dark-10},FFFFFF,{dark-10}' gaugeFillRatio='3' lowerLimit='<?php echo $min; ?>' upperLimit='<?php echo $max; ?>' numberSuffix='<?php echo $si; ?>' dataStreamURL='<?php echo $SERVER_ADDRESS; ?>/includes/functions/widgets/gauges/fusion/data/data_stream.php?location_id=<?php echo $location_id; ?>¶meter_id=<?php echo $parameter_id; ?>' refreshInterval='5' >"; chart_data += " <colorRange>"; chart_data += " <color minValue='0' maxValue='<?php echo ($max * (1/3)); ?>' code='8BBA00'/>"; chart_data += " <color minValue='<?php echo ($max * (1/3)); ?>' maxValue='<?php echo ($max * (2/3)); ?>' code='8BBA00'/>"; chart_data += " <color minValue='<?php echo ($max * (2/3)); ?>' maxValue='<?php echo $max; ?>' code='8BBA00'/>"; chart_data += " </colorRange>"; chart_data += " <dials>"; chart_data += " <dial value='0' rearExtension='10' showValue='1' valueY='220' bgColor='FF5904' borderColor='FF0000'/>"; chart_data += " </dials>"; chart_data += " <styles>"; chart_data += " <definition>"; chart_data += " <style type='font' name='valueFont' borderColor='FFFFFF' bold='1' size='13'/>"; chart_data += " </definition>"; chart_data += " <application>"; chart_data += " <apply toObject='value' styles='valueFont'/>"; chart_data += " </application>"; chart_data += " </styles>"; chart_data += "</chart>"; myChart.setDataXML(chart_data); myChart.setTransparent(true); myChart.render("angular_<?php echo $random_value; ?>"); </script> </div> Here is my php code… $location_id = $_GET['location_id']; $parameter_id = $_GET['parameter_id']; $query = "SELECT parameter_{$parameter_id}.data, parameter_{$parameter_id}.date_time, unit.math FROM parameter_{$parameter_id}, location, parameter, unit WHERE parameter.id = {$parameter_id} AND unit.id = parameter.unit_id AND location.id = {$location_id} AND location.plc_id = parameter_{$parameter_id}.plc_id ORDER BY date_time DESC LIMIT 0,1"; $result = mysql_query($query) or die(mysql_error()); if($row = mysql_fetch_assoc($result)) { $data = $row['data']; $date_time = $row['date_time']; switch($row['math'][0]) { case '/' : $data /= substr($row['math'],1); break; case '*' : $data *= substr($row['math'],1); break; } echo "&value=" . $data . "&date_time=" . $date_time; } pic1.bmp Share this post Link to post Share on other sites
Sanjukta Report post Posted January 5, 2011 Hi, Please note that FusionWidgets supports date/time format as String value. In case you wish to pass the date/time directly, i am afraid, this is not possible, as of now. You can retrieve the date/time as a string value and hence pass it as the value for the label. Hope this helps. Share this post Link to post Share on other sites
moose2004 Report post Posted January 5, 2011 (edited) Thanks for the reply Sanjukta. But I need to pull the actual time stamp of the value latest post in the database. If I lose communication in the field with that device and this gauge is pulling the latest entry in the database, the user needs to know if the value is current or an hour, day, week, etc. old. Thanks again. Edited January 5, 2011 by moose2004 Share this post Link to post Share on other sites
Sanjukta Report post Posted January 6, 2011 Hi, Please try retrieving the time stamp in the "toolText" attribute of the Angular Gauge by mentioning it in Real-time format. In that case the time would be displayed in the "tooltip" and would be easily understood if its the latest post or the number of days or hours old from the latest post retrieved from the database. Hope this helps. Share this post Link to post Share on other sites
moose2004 Report post Posted January 6, 2011 Thanks for your help. Share this post Link to post Share on other sites
Guest Angie Report post Posted January 7, 2011 Hi, Thanks for your appreciation. Keep FusionCharting! Share this post Link to post Share on other sites