Sign in to follow this  
Powderworks

Mscolumn2D - No Data

Recommended Posts

Getting a no data message

 

I am sure I have got it wrong in the Code any suggestions would be helpful

Here is the code

public string GetFactorySummaryChartHtml()

{

//In this example, we show how to connect FusionCharts to a database.

//For the sake of ease, we've used an Access database which is present in

//../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each

//other.

 

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

StringBuilder xmlData = new StringBuilder();

 

//Generate the chart element

xmlData.Append("<chart caption='' subCaption='OUTSTANDING RECOMMENDATIONS' pieSliceDepth='30' UseRoundEdges = '1' showBorder='0' useRoundEdges = '1' formatNumberScale='0' numberSuffix=''>");

//Create recordset to get details for the factories

//string factoryQuery = " SELECT Count(Recommendations) as TotNo FROM recommendations WHERE Complete = "No" , Count(Recommendation) as TotYes FROM recommendations WHERE Complete = "Yes"" ;

string factoryQuery = "SELECT location.LocationName, recommendations.Complete, Count(*) as TotQ FROM recommendations INNER JOIN inspection ON recommendations.InspectionID = inspection.InspectionID INNER JOIN location ON inspection.LocationID = location.LocationID GROUP BY recommendations.Complete,location.LocationName";

 

 

DbConn oRs = new DbConn(factoryQuery);

 

//Iterate through each record

while (oRs.ReadData.Read())

{

String seriesName = " ";

 

 

 

if (oRs.ReadData["Complete"].ToString() == "Complete")

{

seriesName = "Complete";

}

if (oRs.ReadData["Complete"].ToString() == "Outstanding")

{

seriesName = " Outstanding";

}

if (oRs.ReadData["Complete"].ToString() == "In Progress")

{

seriesName = "In Progress";

}

if (oRs.ReadData["Complete"].ToString() == "Not Accepted")

{

seriesName = "Not Accepted";

}

 

xmlData.AppendFormat("<set label='{0}' value='{1}' />", (oRs.ReadData["LocationName"].ToString()), oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());

 

//xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["Complete"].ToString(), oRs.ReadData["TotQ"].ToString());

 

}

 

oRs.ReadData.Close();

//Close chart element

xmlData.Append("</chart>");

 

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

 

return FusionCharts.RenderChart("FusionCharts/MSColumn2D.swf?noCache=112", "", xmlData.ToString(), "FactorySum3", "400", "400", false, false);

 

 

}

Share this post


Link to post
Share on other sites

Hi,

 

The XML that is being built is generating XML for a single series chart like Pie. Your XML can be in a format similar to:

<chart>
<set label='foo' value='1' />
<set label='boo' value='2' />
<set label='moo' value='3' />
</chart>

 

However, since you are rendering a Multi-series chart, you need to build the XML following a different XML format which may look like:

 

<chart>
<categories>
<category label='foo'/>
<category label='boo'/>
<category label='moo'/>
</categories>
<dataset>
<set value='1'/>
<set value='2'/>
<set value='3'/>
</dataset>
</chart>

 

For more details on Multi-series XML structure please read: http://docs.fusioncharts.com/charts/?DataFormats/XML/MultiSeries.html

Share this post


Link to post
Share on other sites

Thanks for comming back to me . I have read the information I am taking data from a MS SQL database and cant see how you program the XML file

Do you any examples of how to set up the XML file in ASP.net

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