nikkic

Members
  • Content count

    5
  • Joined

  • Last visited

Everything posted by nikkic

  1. Hi I am trying to implement a real time angular gauge and have the following:- xml <chart lowerLimit='0' upperLimit='5000' lowerLimitDisplay='Bad' upperLimitDisplay='Good' gaugeStartAngle='180' gaugeEndAngle='0' palette='1' numberSuffix=' kwH' tickValueDistance='20' showValue='1' decimals='0' dataStreamURL='bike.html' refreshinterval='1'> <colorRange> <color minValue='0' maxValue='1000' code='FF654F'/> <color minValue='1000' maxValue='4000' code='F6BD0F'/> <color minValue='4000' maxValue='5000' code='FF654F'/> </colorRange> <dials> <dial value='50' rearExtension='10' toolText='Exercise Bike'/> </dials> </chart> datstreamURL <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Exercise Bike Test</title> <script src="../wsapi.js"></script> <script language="JavaScript" src="FusionCharts.js"></script> <style type="text/css"> <!-- body { font-family: Verdana, Geneva, sans-serif; color: #000; } --> </style> <script> <!-- // Set up the address to our value in the Modbus/TCP device var watts1Adr="Integra1630.Watts.W Phase 2"; function Setup() { // Create a scanlist to use for our cyclic scan points, in this case we name it "CyclicScanList" WSAPI_CreateScanList("CyclicScanList"); // Add the counter register to our cyclic scanlist WSAPI_AddScanPoint("CyclicScanList",watts1Adr); // We want the cyclic scanlist to run once every second WSAPI_SetScanlistCycle("CyclicScanList",1); // Register our callback function that will be called every time a scan has been completed WSAPI_RegisterScanCallback("CyclicScanList",CyclicCallback); // Start reading the scanlists WSAPI_ReadScanList("CyclicScanList"); } // This callback function will be called after every scan of the cyclic scanlist function CyclicCallback() { var tmpPoint; // Get the value of the counter tmpPoint=WSAPI_GetPoint("CyclicScanList",watts1Adr); // Show the value in the div by setting the innerHTML property document.getElementById("watts1Div").innerHTML="&value="+tmpPoint.val; } </script> </head> <body onload="Setup()"> <div id="watts1Div"</div> </body> </html> Angular Gauge <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Exercise Bike Test</title> <script language="JavaScript" src="FusionCharts.js"></script> <style type="text/css"> <!-- body { font-family: Verdana, Geneva, sans-serif; color: #000; } --> </style> </head> <body> Bike Value <p></p> <div id="chart5div"> <script type="text/javascript"> var myChart5 = new FusionCharts("AngularGauge.swf", "myChart5Id", "300", "175", "0", "0"); myChart5.setDataXML("bike.xml"); myChart5.render("chart5div"); </script> </div> </body> </html> I know the datstreamURL is a little different but when viewed it just shows &value=0.000000 or a value depending on the watts being used (0.000000 at the moment because the office is empty). When I open the angular gauge page I just get No data to display. If I set the xml in the angular gauge the gauge loads and you can see the call to go and get the data but the pointer stays on the inital value set. Any ideas? Thanks Nikki
  2. Real Time Angular Gauge

    Thanks for the reply. The problem I have is the code generating the real time value is coming from a modbus gateway that will only support html and javascript. I did get the value showing without using real time but the graph refreshed every second. Is there any way to just render the pointer value rather than the graph without using the real time data stream? I will try and just generate some javascript and use document.write and see how I get on using the real time dat stream.. Thanks again.
  3. Hi I am developing a webpage to display some TCPIP modbus data and have the data showing on the page using some javascript. I am trying to pass the data to the fushionchart and have the following code:- <script src="../wsapi.js"></script> <script language="JavaScript" src="FusionCharts.js"></script> <script> <!-- // Set up the address to our value in the Modbus/TCP device var watts1Adr="Integra1630.Watts.W Phase 2"; function Setup() { // Create a scanlist to use for our cyclic scan points, in this case we name it "CyclicScanList" WSAPI_CreateScanList("CyclicScanList"); // Add the counter register to our cyclic scanlist WSAPI_AddScanPoint("CyclicScanList",watts1Adr); // We want the cyclic scanlist to run once every second WSAPI_SetScanlistCycle("CyclicScanList",1); // Register our callback function that will be called every time a scan has been completed WSAPI_RegisterScanCallback("CyclicScanList",CyclicCallback); // Start reading the scanlists WSAPI_ReadScanList("CyclicScanList"); } // This callback function will be called after every scan of the cyclic scanlist function CyclicCallback() { var tmpPoint; // Get the value of the counter tmpPoint=WSAPI_GetPoint("CyclicScanList",watts1Adr); // Show the value in the div by setting the innerHTML property document.getElementById("watts1Div").innerHTML=tmpPoint.val; myChart1.setDataXML("<chart lowerLimit='0' upperLimit='5000' lowerLimitDisplay='Good' upperLimitDisplay='Bad' palette='1' numberSuffix='kwH' chartRightMargin='20' chartLeftMargin='20'><colorRange><color minValue='0' maxValue='30' code='8BBA00' label='Good'/><color minValue='30' maxValue='45' code='F6BD0F' label='Moderate'/><color minValue='45' maxValue='50' code='FF654F' label='Bad'/></colorRange><pointers><pointer value='"+tmpPoint.val+"' radius='5'/></pointers></chart>"); myChart1.render("chart1div"); } //--> </script> I then have the following to show the value and hopefully the chart:- <body onload="Setup()"> Bike Value <div id="watts1Div"></div> <p></p> <script type="text/javascript"> var myChart1 = new FusionCharts("HLinearGauge.swf", "ChId1", "300", "75", "0", "0"); </script> </body> The problem is when the page loads the graph does not load and in the firefox debug the fushioncharts.js fails at line 250 - (n.innerHTML = this.getSWFHTML(); ) now it looks like the chartobj is not defined. If you continue the fushioncharts.js stops at line 193 (chartObj.setDataXML(strDataXML); ) with the error chartObj is null. I know the value is ok as I can see this in the xmldata in the debug. In an ideal world I would like to just refresh/upload the value each time rather than the chart but if the chart has to load then I can slow down the cyclic on the modbus side. Has anyone got any ideas on this? Thanks Nikki
  4. Dynamic Data From Another Source

    Thanks Why is it you always forget the simple bit?!!
  5. Dynamic Data From Another Source

    Just found out a bit more .... The reason for the fail at line 250 is that n is null. How and where do I define n? Nikki