musicman
Members-
Content count
6 -
Joined
-
Last visited
Everything posted by musicman
-
I have a page that is producing correct XML. If I use the page as the source, the graph doesn't render properly, but if I copy/paste the XML that that page produces to a separate XML document and use that as the source, then the graph works. Here's my code: protected void Page_Load(object sender, EventArgs e) { DbConn1 oRs; string strQuery; string strXML; strXML = "<graph bgColor='F1f1f1' caption='Admissions' animation='1' yAxisMinValue='0' formatNumber='1' numdivlines='3' divLineColor='333333' decimalPrecision='0' showLegend='1' showColumnShadow='1' formatNumberScale='0'>"; strXML += "<categories font='Arial' fontsize='10' fontcolor='000000'>"; strXML += "<category name='Applied' hovertext='Applied' />"; strXML += "<category name='Admitted' hovertext='Admitted' />"; strXML += "<category name='Enrolled' hovertext='Enrolled' />"; strXML += "</categories>"; strXML += "<dataset seriesname= 'First-Time Students' color='FF0000'>"; strQuery = "select * from admissions where student_type = 'First-Time Students' "; oRs = new DbConn1(strQuery); //Iterate through each Record while (oRs.ReadData.Read()) { strXML += "<set value='" + oRs.ReadData["student_count"].ToString() + "' />"; } oRs.ReadData.Close(); strXML += "</dataset>"; strXML += "<dataset seriesname= 'Transfer Students' color='009900'>"; strQuery = "select * from admissions where student_type = 'Transfer Students' "; DbConn1 oRs2 = new DbConn1(strQuery); //Iterate through each Record while (oRs2.ReadData.Read()) { strXML += "<set value='" + oRs2.ReadData["student_count"].ToString() + "' />"; } oRs2.ReadData.Close(); strXML += "</dataset>"; strXML += "</graph>"; Response.ContentType = "text/xml"; Response.Write(strXML); } Produces the following XML: - <graph bgColor="[b]F1f1f1[/b]" caption="[b]Admissions[/b]" animation="[b]1[/b]" yAxisMinValue="[b]0[/b]" formatNumber="[b]1[/b]" numdivlines="[b]3[/b]" divLineColor="[b]333333[/b]" decimalPrecision="[b]0[/b]" showLegend="[b]1[/b]" showColumnShadow="[b]1[/b]" formatNumberScale="[b]0[/b]">- <categories font="[b]Arial[/b]" fontsize="[b]10[/b]" fontcolor="[b]000000[/b]"> <category name="[b]Applied[/b]" hovertext="[b]Applied[/b]" /> <category name="[b]Admitted[/b]" hovertext="[b]Admitted[/b]" /> <category name="[b]Enrolled[/b]" hovertext="[b]Enrolled[/b]" /> </categories>- <dataset seriesname="[b]First-Time Students[/b]" color="[b]FF0000[/b]"> <set value="[b]1103[/b]" /> <set value="[b]912[/b]" /> <set value="[b]443[/b]" /> </dataset>- <dataset seriesname="[b]Transfer Students[/b]" color="[b]009900[/b]"> <set value="[b]231[/b]" /> <set value="[b]156[/b]" /> <set value="[b]101[/b]" /> </dataset> </graph> Any help on where I've gone wrong would be appreciated. I figure I'm just missing something. Also, I am using the stacked column charts.
-
Help with SQL query to XML conversion
musicman replied to Arindam's topic in FusionCharts and ASP.NET
The xml that is being produced is correct, no zeros or non-numbers. As I stated before if I use the aspx page as the source, my chart is incorrect, but if I take the xml that is produced by the aspx page and copy/paste it into an xml document and use that as the source then the chart is correct. I've attached the data aspx page as well as the data xml document. This produces an incorrect graph: <% string strDataURL; strDataURL3 = "admissiondata.aspx"; Response.Write(FusionCharts.RenderChart("FusionCharts/FCF_StackedColumn3D.swf", strDataURL3, "", "Admissions1", "425", "300", false, false)); %> This does not: <% string strDataURL2; strDataURL2 = "admissions.xml"; Response.Write(FusionCharts.RenderChart("FusionCharts/FCF_MSColumn3D.swf", strDataURL2, "", "Admissions2", "425", "300", false, false)); %> Both contain or output the same exact xml data. admissiondata.zip admissions.xml -
Help with SQL query to XML conversion
musicman replied to Arindam's topic in FusionCharts and ASP.NET
Still no luck. I've attached what the chart looks like that is being produced. As well as the correct chart, which is being produced by the xml I pasted into a new document. -
Help with SQL query to XML conversion
musicman replied to Arindam's topic in FusionCharts and ASP.NET
I'm calling it using the following code: <% string strDataURL3; strDataURL3 = "admissiondata.aspx"; Response.Write(FusionCharts.RenderChart("FusionCharts/FCF_StackedColumn3D.swf", strDataURL3, "", "Admissions3", "425", "300", false, false)); %> Tried what you posted and get the following error: CS0103: The name 'Literal1' does not exist in the current context -
That worked, thank you.
-
I need help graphing the below query. I can't seem to figure it out. select CONVERT(VARCHAR(11),tkt_time,106) AS 'Time', count(tkt_id) as TotTickets from ticketgroup by CONVERT(VARCHAR(11),tkt_time,106)order by CONVERT(VARCHAR(11),tkt_time,106) descGives me an output of: 28 Feb 2008 6 27 Mar 2008 1 26 Mar 2008 5 24 Mar 2008 1 19 Mar 2008 2 18 Mar 2008 1 08 Apr 2008 1 07 Apr 2008 1 06 Mar 2008 2 05 Mar 2008 6 04 Mar 2008 11 04 Apr 2008 2 The reason for the Convert is because tkt_time is stored as a TIMESTAMP and of course since I want a count of tickets for that day not that specific time thus it had to be converted. DbConn oRs; string strQuery; //strXML will be used to store the entire XML document generated string strXML; //Generate the graph elementstrXML = "<graph caption='Number of Trouble Tickets' subCaption='By Day' decimalPrecision='0' showNames='1' formatNumberScale='0'>"; //Iterate through each datestrQuery = "select * from Ticket"; oRs = new DbConn(strQuery); while (oRs.ReadData.Read()) // { //Now create second recordset to get details for this datestrQuery = "select count(tkt_id) as TotTickets from ticket where tkt_time=" + oRs.ReadData["tkt_time"].ToString(); DbConn oRs2 = new DbConn(strQuery);oRs2.ReadData.Read(); //Generate <set name='..' value='..' /> strXML += "<set name='" + oRs.ReadData["tkt_time"].ToString() + "' value='" + oRs2.ReadData["TotTickets"].ToString() + "' />"; //Close recordsetoRs2.ReadData.Close(); //}oRs.ReadData.Close(); //Finally, close <graph> elementstrXML += "</graph>"; //Set Proper output content-typeResponse.ContentType = "text/xml"; //Just write out the XML data //NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVERResponse.Write(strXML); I would think that the above code would give me: 1 2008-02-28 14:41:47.187 1 2008-02-28 14:42:15.623 1 2008-02-28 14:43:24.310 1 2008-02-28 14:54:28.260 1 2008-02-28 15:22:55.530 Same as above, just not converted nor grouped. But it doesn't even work. I have tried the original query just by itself and I get the correct data for the first date in the table, but of course it stops at that because I'm not iterating through each date. I'm at a loss for what to do. These are the kind of queries that we need graphed. I'm very new to asp.net and programming in general, so any help would be much appreciated. Here's what I've tried: DbConn oRs; string strQuery; //strXML will be used to store the entire XML document generated string strXML; //Generate the graph elementstrXML = "<graph caption='Number of Trouble Tickets' subCaption='By Day' decimalPrecision='0' showNames='1' formatNumberScale='0'>"; //Iterate through each date strQuery = "select * from Ticket"; oRs = new DbConn(strQuery); while (oRs.ReadData.Read()) // { //Now create second recordset to get details for this datestrQuery = "select count(tkt_id) as TotTickets from ticket where CONVERT(VARCHAR(11),tkt_time,106)=" + oRs.ReadData["CONVERT(VARCHAR(11),tkt_time,106)"].ToString(); DbConn oRs2 = new DbConn(strQuery);oRs2.ReadData.Read(); //Generate <set name='..' value='..' /> strXML += "<set name='" + oRs.ReadData["CONVERT(VARCHAR(11),tkt_time,106)"].ToString() + "' value='" + oRs2.ReadData["TotTickets"].ToString() + "' />"; //Close recordsetoRs2.ReadData.Close(); //}oRs.ReadData.Close(); //Finally, close <graph> elementstrXML += "</graph>"; //Set Proper output content-typeResponse.ContentType = "text/xml"; //Just write out the XML data //NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVERResponse.Write(strXML);