Sign in to follow this  
Guest Basundhara Ghosal

Realtime line chart not getting data

Recommended Posts

I have created a reatime line chart but the chart just sits there not plotting any data points. I have tested the InternetCap.aspx page and it provides this data which looks correct.

&label=5/19/2010 4:12:14 PM&value=7.553656E-05|2.6951024

 Here is my dataprovider page InternetCap.aspx:

protected void Page_Load(object sender, EventArgs e)
{
string strSQL = "SELECT TOP 1 InterfaceTraffic.DateTime, Nodes.Caption, InterfaceTraffic.In_Averagebps " +
"FROM InterfaceTraffic join Nodes ON InterfaceTraffic.NodeID=Nodes.NodeID " +
"WHERE Nodes.Caption like 'cdiacc%' " +
"ORDER BY InterfaceTraffic.DateTime DESC";
SqlConnection objConnect = new SqlConnection(connString);
objConnect.Open();
SqlCommand objCommand = new SqlCommand(strSQL, objConnect);
SqlDataAdapter objAdapter = new SqlDataAdapter(objCommand); DataSet objDataSet = new DataSet();
objAdapter.Fill(objDataSet);
string strSQL2 = "SELECT TOP 1 InterfaceTraffic.DateTime, Nodes.Caption, InterfaceTraffic.In_Averagebps " +
"FROM InterfaceTraffic join Nodes ON InterfaceTraffic.NodeID=Nodes.NodeID " +
"WHERE Nodes.Caption like 'chiacc%' " +
"ORDER BY InterfaceTraffic.DateTime DESC";
SqlConnection objConnect2 = new SqlConnection(connString);
objConnect2.Open();
SqlCommand objCommand2 = new SqlCommand(strSQL2, objConnect2);
SqlDataAdapter objAdapter2 = new SqlDataAdapter(objCommand2); DataSet objDataSet2 = new DataSet();
objAdapter2.Fill(objDataSet2);
string newtest = objDataSet.Tables[0].Rows[0][2].ToString();
double cdiaccbps = double.Parse(newtest);
double cdiaccMBps = cdiaccbps / 12500000;
string newtest2 = objDataSet2.Tables[0].Rows[0][2].ToString();
double chiaccbps = double.Parse(newtest2);
double chiaccMBps = chiaccbps / 12500000;
//TestCode Response.Write(DateTime.Now + " " + objDataSet.Tables[0].Rows[0][1] + " " + cdiaccMBps + " MBps<br>");
//TestCode Response.Write(objDataSet2.Tables[0].Rows[0][0] + " " + objDataSet2.Tables[0].Rows[0][1] + " " + chiaccMBps + " MBps<br>");
Response.Write("&label=" + DateTime.Now + "&value=" + cdiaccMBps + "|" + chiaccMBps);
 objConnect.Close();
objConnect.Dispose();
objConnect2.Close();
objConnect2.Dispose();
}

Here is my xml file:

<chart caption='Internet Capacity Usage' subCaption='Mbps' dataStreamURL='InternetCap.aspx' refreshInterval='5' setAdaptiveYMin='1' xAxisName='Time' showRealTimeValue='1' realTimeValuePadding='50' labelDisplay='Rotate' slantLabels='1'>
<categories>
</categories>
<dataset seriesName='cDiacc' showValues='0'>
</dataset>
<dataset seriesName='cHiacc' showValues='0'>
</dataset>
<styles>
<definition>
<style type='font' name='captionFont' size='14' />
</definition>
<application>
<apply toObject='Caption' styles='captionFont' />
<apply toObject='Realtimevalue' styles='captionFont' />
</application>
</styles>
</chart>

and here is my defult.aspx code just for chart:

<div id="Chart5"> 
</div>
<script type="text/javascript">
var internetCap = new FusionCharts("../FusionWidgets/RealTimeLineDY.swf", "internetCap", "450", "300", "0", "0");
internetCap.setDataURL("../InternetCapacity/InternetData.xml");
internetCap.render("Chart5");
</script>

 

I have the .js files linked to so i know its not that. Please help this chart looks amazingly useful.

Ben

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ben,

Could you please try the following:-

1) Please enable the debug-mode of the chart by setting it to '1'.

Ref.- var internetCap = new FusionCharts("../FusionWidgets/RealTimeLineDY.swf", "internetCap", "450", "300", "1", "0");

2) Please render the chart on the browser page and wait for around one minute.

3) Please send us screen-shot of the message received on the debug-window after one minute as an attachment.

Awaiting your reply.

Share this post


Link to post
Share on other sites

WOW i didnt even know there was a debug option! That was amazing. The file path was wrong because the dataStream URL has to be relative to the page pulling the file, not where the XML file is located.

Thanks so much!

Ben

Share this post


Link to post
Share on other sites

OK i think i narrowed down the problem: here is the value that is getting passed to the chart:

&chartWidth=250&chartHeight=35&debugMode=0&dataURL=InfrastructureCapacity%2fSuperDome3.aspx

shouldn't that dataURL be InfrastructureCapacity/SuperDome3.aspx?

My code is:

string dataURL = Server.UrEncode("InfrastructureCapacity/SuperDome2.aspx");
//Create the chart with dataURL as strDataURL
return FusionCharts.RenderChartHTML("FusionWidgets/SparkLine.swf", dataURL, "", "SuperDome2Capacity", "250", "35", false);

So whats the problem?

THanks

Ben

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Could you please send us the screen-shot of the error that you are getting as attachment?

Please note that you need to enable your debug-mode before you take the screen-shot of the error.

Awaiting your reply. :hehe:

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Ben,

Glad that your issue is resolved and its working fine now.

Keep smiling and keep FusionCharting. :(

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