Sign in to follow this  
daibojun

Angular Gauge > Real-Time Update

Recommended Posts

test2.jsp

 

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="content-type" content="text/html;charset=GB18030"/>

<meta http-equiv="pragma" content="no-cache"/>

<meta http-equiv="cache-control" content="no-cache"/>

<meta http-equiv="expires" content="0"/>

<script language="JavaScript" src="../FusionChartsBroad/FusionCharts.js"></script>

</head>

<body onload = "aa();">

<table>

<tr>

<td>

<div id="chartdiv" align="center"></div>

</td>

</tr>

</body>

</html>

<script type="text/javascript" >

function aa(){

var myChart = new FusionCharts("../FusionChartsBroad/AngularGauge.swf", "myChartId", "350", "200", "0", "0");

myChart.setDataXML(getxml());

myChart.render("chartdiv");

}

 

function getxml(){

var str1 = null;

str1 = "<chart dataStreamURL = 'test_data.jsp' refreshInterval = '5' animation = '0' palette = '2' bgAlpha = '0' bgColor = 'FFFFFF' lowerLimit = '0'" +

"upperLimit = '100' numberSuffix = '' showBorder = '0'" +

"basefontColor = 'FFFFDD' chartTopMargin = '25' chartBottomMargin = '25'" +

"chartLeftMargin = '25' chartRightMargin = '25' toolTipBgColor = '009999'" +

"gaugeFillMix = '{dark-10},{light-70},{dark-10}' gaugeFillRatio = '20'" +

"pivotRadius = '5' gaugeInnerRadius = '50%' tickValueDistance = '20' showvalue = '1' baseFontSize = '20' >" +

"<colorRange>" +

"<color minValue = '0' maxValue = '30' code = '8BBA00' />" +

"<color minValue = '30' maxValue = '60' code = 'F6BD0F' />" +

"<color minValue = '60' maxValue = '100' code = 'FF654F'/>" +

"</colorRange>" +

"<dials>" +

"<dial id = 'CPU1' value='92' rearExtension = '10' baseWidth = '2' toolText='CPU 1 Usage'/>" +

"</dials>" +

"<annotations>" +

"<annotationGroup id = 'Grp1' showBelow = '1'>" +

"<annotation type = 'rectangle' x = '5' y = '5' toX = '345' toY = '195'" +

"radius = '10' color = '009999,333333' showBorder = '0'/>" +

"</annotationGroup>" +

"</annotations>" +

"<styles>" +

"<definition>" +

"<style name = 'RectShadow' type = 'shadow' strength = '3'/>" +

"<style name = 'trendvaluefont' type = 'font' bold = '1'" +

"borderColor = 'FFFFDD'/>" +

"</definition>" +

"<application>" +

"<apply toObject = 'Grp1' styles='RectShadow'/>" +

"<apply toObject = 'Trendvalues' styles = 'trendvaluefont'/>" +

"</application>" +

"</styles>" +

"</chart>";

return str1;

}

</script>

 

test_data.jsp

 

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>

<%

String call_str = null;

Random random = new Random();

call_str = "&cpu1=" + String.valueOf(random.nextInt(100));

//call_str = "100" +

//"|" + random.nextInt(100) +

//"|" + random.nextInt(100) +

//"|" + random.nextInt(100) +

//"|" + random.nextInt(100) +

//"|" + random.nextInt(100) ;

response.getWriter().write(call_str);

call_str = null;

%>

 

I set the property dataStreamURL = 'test_data.jsp' refreshInterval = '5',

But the page does not update, where the problem?

property upperLimit data is dynamically generated,

And how to set upperLimit = '' in test_data.jsp.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum! :)

 

 

Please folllow the steps below to troubleshoot your chart :

 

1.Switch on the debug mode of chart. It will provide you with a lot of valuable information when debugging.

 

2.Check if path dataStreamURL provided in XML is correct.

 

3. Check if you've specified a valid value for refreshInterval in your XML document.

 

4. Check if dataStreamURL is returning proper data. To test this, just open your browser and run this page. It should return the data in text format.

 

5. Make sure the output data doesn't contain any carraige returns or HTML elements. In many scripting languages, these are automatically added. You'll need to remove them.

 

5. You would also need to make sure that the page which provides the incremental update data to FusionCharts must be hosted on the same sub-domain in which the chart .swf is hosted - otherwise, FusionWidgets, owing to Flash Sandbox security model, won't be able to receive updated data. Due to Flash sandbox security restrictions, you are allowed to retrieve data only from the same sub-domain in which the flash movie is residing. Data can only be loaded from a domain that is an exact match to the location of the SWF, including subdomains. For this reason a SWF residing at server1.mydomain.com will not be able to access data from a SWF at mydomain.com.

 

6. If you wish to load data from a different domain, you can set up a proxy page at the same sub domain which would actually request data from the distant domain and then relay it to FusionWidgets. You must be able to upload and run a server-side script on a server in the same domain as the Flash movie. In this method, the Flash movie accesses the script, which loads the information, retrieves it, and returns the information back to the Flash movie. This method is best if the server hosting the data is not under your control (for example, a public source or a web service).

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi,

 

Welcome to FusionCharts Forum! :)

 

 

Please folllow the steps below to troubleshoot your chart :

 

1.Switch on the debug mode of chart. It will provide you with a lot of valuable information when debugging.

 

2.Check if path dataStreamURL provided in XML is correct.

 

3. Check if you've specified a valid value for refreshInterval in your XML document.

 

4. Check if dataStreamURL is returning proper data. To test this, just open your browser and run this page. It should return the data in text format.

 

5. Make sure the output data doesn't contain any carraige returns or HTML elements. In many scripting languages, these are automatically added. You'll need to remove them.

 

5. You would also need to make sure that the page which provides the incremental update data to FusionCharts must be hosted on the same sub-domain in which the chart .swf is hosted - otherwise, FusionWidgets, owing to Flash Sandbox security model, won't be able to receive updated data. Due to Flash sandbox security restrictions, you are allowed to retrieve data only from the same sub-domain in which the flash movie is residing. Data can only be loaded from a domain that is an exact match to the location of the SWF, including subdomains. For this reason a SWF residing at server1.mydomain.com will not be able to access data from a SWF at mydomain.com.

 

6. If you wish to load data from a different domain, you can set up a proxy page at the same sub domain which would actually request data from the distant domain and then relay it to FusionWidgets. You must be able to upload and run a server-side script on a server in the same domain as the Flash movie. In this method, the Flash movie accesses the script, which loads the information, retrieves it, and returns the information back to the Flash movie. This method is best if the server hosting the data is not under your control (for example, a public source or a web service).

 

Hope this helps.

 

 

 

hi, can display graphics, but the data has not been updated, test_data.jsp returned data format is

& CPU1 = 90,

<chart dataStreamURL = '.. / FusionChartsBroad / test_data.jsp' refreshInterval = '5 'is set.

I have access to a lot of information, for I can not refer a case, I hope you can help me.

My English is not very good, translated by Google, if you have not understand, I see yourresponse online.

Thank you.

Share this post


Link to post
Share on other sites
Guest Bindhu

Hi,

 

Thank you for the post.

 

With regards to your query,

 

I have modified your JSP file a little. Can you please use this JSP file and try once ?

 

Please find below the modified JSP,

<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<head>
<meta http-equiv="content-type" content="text/html;charset=GB18030"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<script language="JavaScript" src="../FusionChartsBroad/FusionCharts.js"></script>
</head>
<body onload = "aa();">
<table>
<tr>
<td>
<div id="chartdiv" align="center"></div>
</td>
</tr>
</body>
<script type="text/javascript" >
function aa(){
var myChart = new FusionCharts("../FusionChartsBroad/AngularGauge.swf", "myChartId", "350", "200", "0", "0");
myChart.setDataXML(getxml());
myChart.render("chartdiv");
}

function getxml(){
var str1 = null;
str1 = "<chart dataStreamURL = 'test_data.jsp' refreshInterval = '5' animation = '0' palette = '2' bgAlpha = '0' bgColor = 'FFFFFF' lowerLimit = '0'" +
"upperLimit = '100' numberSuffix = '' showBorder = '0'" +
"basefontColor = 'FFFFDD' chartTopMargin = '25' chartBottomMargin = '25'" +
"chartLeftMargin = '25' chartRightMargin = '25' toolTipBgColor = '009999'" +
"gaugeFillMix = '{dark-10},{light-70},{dark-10}' gaugeFillRatio = '20'" +
"pivotRadius = '5' gaugeInnerRadius = '50%' tickValueDistance = '20' showvalue = '1' baseFontSize = '20' >" +
"<colorRange>" +
"<color minValue = '0' maxValue = '30' code = '8BBA00' />" +
"<color minValue = '30' maxValue = '60' code = 'F6BD0F' />" +
"<color minValue = '60' maxValue = '100' code = 'FF654F'/>" +
"</colorRange>" +
"<dials>" +
"<dial id = 'CPU1' value='92' rearExtension = '10' baseWidth = '2' toolText='CPU 1 Usage'/>" +
"</dials>" +
"<annotations>" +
"<annotationGroup id = 'Grp1' showBelow = '1'>" +
"<annotation type = 'rectangle' x = '5' y = '5' toX = '345' toY = '195'" +
"radius = '10' color = '009999,333333' showBorder = '0'/>" +
"</annotationGroup>" +
"</annotations>" +
"<styles>" +
"<definition>" +
"<style name = 'RectShadow' type = 'shadow' strength = '3'/>" +
"<style name = 'trendvaluefont' type = 'font' bold = '1'" +
"borderColor = 'FFFFDD'/>" +
"</definition>" +
"<application>" +
"<apply toObject = 'Grp1' styles='RectShadow'/>" +
"<apply toObject = 'Trendvalues' styles = 'trendvaluefont'/>" +
"</application>" +
"</styles>" +
"</chart>";
return str1;
}
</script>
<%
String call_str = null;
Random random = new Random();
call_str = "&cpu1=" + String.valueOf(random.nextInt(100));
//call_str = "100" +
//"|" + random.nextInt(100) +
//"|" + random.nextInt(100) +
//"|" + random.nextInt(100) +
//"|" + random.nextInt(100) +
//"|" + random.nextInt(100) ;
response.getWriter().write(call_str);
call_str = null;
%>
</html>

 

Also, for more information on 'Data Streaming Charts > Creating a simple example', please refer to the link below,

http://docs.fusionch...SC_Example.html

 

Hope this helps !

Edited by Bindhu

Share this post


Link to post
Share on other sites

Thank you for change, but the problem still not solved. Now I upload the project to the forum. I hope you can help me see where the problem lies. My project using MyEclipse 6.0, JDK 1.6, Tomcat 6.0.

TestFusioncharts\WebRoot\test\test.jsp

TestFusioncharts\WebRoot\test\test_data.jsp

Share this post


Link to post
Share on other sites
Guest Bindhu

Hi,

 

Thank you for the post.

 

I am afraid, I am unable to see any project uploaded.

 

Can you please try uploading once again ?

 

Awaiting your response.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Glad to know that you have managed to resolve your problem.

 

Happy FusionCharting!!! biggrin.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
Sign in to follow this