nikkic

Real Time Angular Gauge

Recommended Posts

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

Edited by nikkic

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

It seems from your code(bike.html), that The real-time data provided by the URL specified as dataStreamURL attribute in XML data document is incorrect.

 

This data should essentially be in text format WITHOUT containing any HTML tags or carriage returns.

For more details, please visit the links below:

 

http://www.fusioncha...meOverview.html

 

http://www.fusioncha...DataFormat.html

 

Hope this helps.smile.gif

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your response.

 

I am afraid, FusionCharts does not support the feature you are looking for, at this time.sad.gif

 

You would need to use JavaScript in order to update the chart as per your requirement.

 

Hope this helps.smile.gif

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