Sign in to follow this  
ppr

ASP.Net C#

Recommended Posts

Hi all

I am trying to make drill down chart but when i run the page it just show the text chart twise. After that I copy and paste whole example given in fusionchart V3 and tryied again but the same output shown.

can any one help me .

the code is

for default page:

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<

html>

<

head>

<title>Untitled Page</title>

<script language="Javascript" src="../FusionCharts/FusionCharts.js">

//You need to include the above JS file, if you intend to embed the chart using JavaScript.

//Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer

//When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.

</script>

<script language="JavaScript">

function updateChart(factoryIndex)

{

var strURL = "FactoryData.aspx?factoryId=" + factoryIndex;

strURL = escape(strURL);

var chartObj = new FusionCharts('../FusionCharts/Column2D.swf', 'FactoryDetailed', '600', '250', '0', '0');

var chartObj = getChartFromId("FactoryDetailed");

chartObj.setDataURL(strURL);

}

function getTimeForURL(){

var dt = new Date();

var strOutput = "";

strOutput = dt.getHours() +

"_" + dt.getMinutes() + "_" + dt.getSeconds() + "_" + dt.getMilliseconds();

return strOutput;

}

</script>

</

head>

<

body>

<form id="form1" runat="server">

<%

=GetFactorySummaryChartHtml()%>

<br>

<%

=GetFactoryDetailedChartHtml()%>

</form>

</

body>

</

html>

code behind page:

using

System;

using

System.Configuration;

using

System.Data;

using

System.Linq;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.HtmlControls;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Xml.Linq;

using

InfoSoftGlobal;

using

System.Text;

using

DataConnection;

public

partial class _Default : System.Web.UI.Page

{

public string GetFactorySummaryChartHtml()

{

//xmlData will be used to store the entire XML document generated

StringBuilder xmlData = new StringBuilder();

xmlData.Append(

"<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units' >");

//Create recordset to get details for the factories

string factoryQuery = "select a.FactoryId, a.FactoryName, sum(b.Quantity) as TotQ from .Factory_Master a, Factory_Output b where a.FactoryId=b.FactoryID group by a.FactoryId, a.FactoryName ";

DbConn oRs = new DbConn(factoryQuery);

//Iterate through each record

while (oRs.ReadData.Read())

{

xmlData.AppendFormat(

"<set label='{0}' value='{1}' link='javaScript:updateChart({2})' />", oRs.ReadData["FactoryName"].ToString(), oRs.ReadData["TotQ"].ToString(), oRs.ReadData["FactoryId"].ToString());

}

//Close chart element

xmlData.Append(

"</chart>");

//Create the chart - Pie 3D Chart with data from xmlData

return FusionCharts.RenderChart("../FusionCharts/Pie3D.swf", "" , xmlData.ToString() , "FactorySum", "500", "250", false, true);

}

public string GetFactoryDetailedChartHtml()

{

//Column 2D Chart with changed "No data to display" message

//We initialize the chart with <chart></chart>

return FusionCharts.RenderChart("../FusionCharts/Column2D.swf?ChartNoDataText=Please select a factory from pie chart above to view detailed data.", "", "<chart></chart>", "FactoryDetailed", "600", "250", false, true);

}

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