zaphodbroxy Report post Posted May 31, 2007 Hi, I'm using a pie3d chart with drill down on all the pie pieces to build a bar chart as shown in the JS_dataurl example. When I click on the pie, I'm getting a "Line 1, character:15, Error: Invalid character" error. I tried in vain, but the code looks fine. Any help will be appreciated. Thanks <%@ Page language="c#" Codebehind="Charts.aspx.cs" AutoEventWireup="false" Inherits="hc.CPM.Charts" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Charts</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <SCRIPT LANGUAGE="Javascript" SRC="/hc/FusionCharts/FusionCharts.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function updateChart(CO_ID){ var strURL = "PR_Data.aspx?chgOrderID="+CO_ID; strURL = strURL + "&currTime=" + getTimeForURL(); strURL = escape(strURL); var chartObj = getChartFromId("ChangeOrderDetail"); chartObj.setDataURL(strURL); and so forth.... Share this post Link to post Share on other sites
Pallav Report post Posted June 1, 2007 Can you please pass on the full HTML and XML output? Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 4, 2007 Pallav, Thanks for the prompt reply.Here is the HTML. <%@ Page language="c#" Codebehind="Charts.aspx.cs" AutoEventWireup="false" Inherits="hc.CPM.Charts" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Charts</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <SCRIPT LANGUAGE="Javascript" SRC="/hc/FusionCharts/FusionCharts.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function updateChart(CO_ID){ var strURL = "PR_Data.aspx?chgOrderID="+CO_ID; strURL = strURL + "&currTime=" + getTimeForURL(); strURL = escape(strURL); var chartObj = getChartFromId("ChangeOrderDetail"); 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 MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:label id="Label8" style="Z-INDEX: 105; LEFT: 8px; POSITION: absolute; TOP: 96px" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small" BackColor="#8080FF" Width="112px" ForeColor="White" Height="16px">Click below to Start</asp:label> <asp:button id="btnAddViewPR" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 112px" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small" BackColor="#C0C0FF" Width="104px" Text="Add/View PR" BorderStyle="Ridge"></asp:button> <asp:button id="btnReports" style="Z-INDEX: 103; LEFT: 112px; POSITION: absolute; TOP: 112px" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small" BackColor="#C0C0FF" Width="104px" Text="Reports" BorderStyle="Ridge"></asp:button> <asp:label id="Label2" style="Z-INDEX: 100; LEFT: 120px; POSITION: absolute; TOP: 96px" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small" BackColor="#8080FF" Width="512px" ForeColor="White" Height="16px"></asp:label> <asp:label id="lblVERSION" style="Z-INDEX: 104; LEFT: 632px; POSITION: absolute; TOP: 96px" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small" BackColor="#8080FF" Width="104px" ForeColor="White" Height="16px"></asp:label> </form> <br> <br> <br> <br> <br> <br> <%=GetChangeOrderSummaryChartHtml()%> <br> <%=GetChangeOrderDetailChartHtml()%> </body> </HTML> ********Here is the XML formation code from the main page that shows the charts: (code snippet) // column2d chartBuilder.Append(FusionCharts.RenderChart("/hc/CPM/Column2D.swf?ChartNoDataText=Please select a Change Order from pie chart above to view detailed data.", "", "<chart></chart>", "ChangeOrderDetail", "600", "250", false, true)); ////Pie chart formation. this.strXMLDoc = "<chart caption='Change Orders' animation = '1' enableRotation ='1' slicingDistance = '15' use3DLighting = '1' bgColor='FFFFFF' decimalPrecision='5' formatNumberScale ='0' showPercentageValues='0' showNames='1' numberPrefix='$' showValues='1' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100'>"; this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coID + "' color='" + colorArray[colorCount] + "' link='updateChart("+coID+")'/>"; this.strXMLDoc += "</chart>"; chartBuilder.Append(FusionCharts.RenderChart("/hc/CPM/Pie3D.swf", "", this.strXMLDoc, "ChangeOrders", "500", "250", false, true)); *********Here is the XML formation code from the class that supplies the drill down xml.(code snippet) xmlData = "<chart palette='2' caption='"+coID+"' xAxisName='Date' showValues='1' labelStep='2' >"; while(this.reader.Read()) { string dateVal = this.reader.GetDateTime(3).Day +"/"+ this.reader.GetDateTime(3).Month; xmlData += "<set label='" + dateVal + "' value='" + this.reader.GetValue(2).ToString() + "'/>"; } xmlData += "</chart>"; this.Response.Clear(); this.Response.ContentType = "text/xml"; this.Response.Output.Write(xmlData); All the data comes from a Oracle database. Thanks a ton for the help. Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 4, 2007 Also, the code is behind a "https" protocol. Dunno if that makes any diff with the JS and chart interactivity. Thanks Share this post Link to post Share on other sites
Pallav Report post Posted June 6, 2007 Can you please run this code and let me have the final HTML output - as in this state, I do not see the links or data values. Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 6, 2007 Pallav, I'm trying to pass a literal value to the drill down chart (link = updateChart(chgOrderID)). The literal string has a "#" in it. Example: "CO#7" javascript gives an error saying "invalid character". I tried replacing the '#' with "HASH" and then reversing the same at the XML supplying page. it then says "COHASH7" is undefined. here is the source: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Charts</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="C#" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <SCRIPT language="Javascript" src="/hc/FusionCharts/FusionCharts.js"></SCRIPT> <SCRIPT language="JavaScript"> function updateChart(chgOrderid){ var strURL = "PR_Data.aspx?chgOrderID="+chgOrderid; strURL = strURL + "&currTime=" + getTimeForURL(); strURL = escape(strURL); var chartObj = getChartFromId("ChangeOrderDetail"); 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 MS_POSITIONING="GridLayout"> <form name="Form1" method="post" action="Charts.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtMzAyODQwOTUwOzs+5XKWDakbpiiBZcw8/FV0Aq1oZhM=" /> <span id="Label8" style="color:White;background-color:#8080FF;font-family:Verdana;font-size:XX-Small;font-weight:bold;height:16px;width:112px;Z-INDEX: 105; LEFT: 8px; POSITION: absolute; TOP: 96px">Click below to Start</span><input type="submit" name="btnAddViewPR" value="Add/View PR" id="btnAddViewPR" style="background-color:#C0C0FF;border-style:Ridge;font-family:Verdana;font-size:XX-Small;font-weight:bold;width:104px;Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 112px" /><input type="submit" name="btnReports" value="Reports" id="btnReports" style="background-color:#C0C0FF;border-style:Ridge;font-family:Verdana;font-size:XX-Small;font-weight:bold;width:104px;Z-INDEX: 103; LEFT: 112px; POSITION: absolute; TOP: 112px" /><span id="Label2" style="color:White;background-color:#8080FF;font-family:Verdana;font-size:XX-Small;font-weight:bold;height:16px;width:512px;Z-INDEX: 100; LEFT: 120px; POSITION: absolute; TOP: 96px"></span><span id="lblVERSION" style="color:White;background-color:#8080FF;font-family:Verdana;font-size:XX-Small;font-weight:bold;height:16px;width:104px;Z-INDEX: 104; LEFT: 632px; POSITION: absolute; TOP: 96px"></span></form> <br> <br> <br> <br> <br> <br> <!-- START Script Block for Chart ChangeOrders --> <div id='ChangeOrdersDiv' align='center'> Chart. </div> <script type="text/javascript"> var chart_ChangeOrders = new FusionCharts("/hc/CPM/Pie3D.swf", "ChangeOrders", "500", "250", "0", "1"); chart_ChangeOrders.setDataXML("<chart caption='Change Orders' animation = '1' enableRotation ='1' slicingDistance = '15' use3DLighting = '1' bgColor='FFFFFF' decimalPrecision='5' formatNumberScale ='0' showPercentageValues='0' showNames='1' numberPrefix='$' showValues='1' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100'><set value='13498' name='CO#1' color='0099FF' link='updateChart(CO#1)'/><set value='17083' name='CO#2' color='66CC66' link='updateChart(CO#2)'/><set value='45767' name='CO#3' color='CD6AC0' link='updateChart(CO#3)'/><set value='75227' name='CO#4' color='FF5904' link='updateChart(CO#4)'/><set value='13228' name='CO#5' color='996600' link='updateChart(CO#5)'/><set value='4097' name='CO#6' color='2299FF' link='updateChart(CO#6)'/><set value='96843' name='CO#7' color='662256' link='updateChart(CO#7)'/><set value='634257' name='Amount remaining' color='AB6AC0'/></chart>"); chart_ChangeOrders.render("ChangeOrdersDiv"); </script> <!-- END Script Block for Chart ChangeOrders --> <br> <!-- START Script Block for Chart ChangeOrderDetail --> <div id='ChangeOrderDetailDiv' align='center'> Chart. </div> <script type="text/javascript"> var chart_ChangeOrderDetail = new FusionCharts("/hc/CPM/Column2D.swf?ChartNoDataText=Please select a Change Order from pie chart above to view detailed data.", "ChangeOrderDetail", "600", "250", "0", "1"); chart_ChangeOrderDetail.setDataXML("<chart></chart>"); chart_ChangeOrderDetail.render("ChangeOrderDetailDiv"); </script> <!-- END Script Block for Chart ChangeOrderDetail --> </body> </HTML> Thanks. Share this post Link to post Share on other sites
Pallav Report post Posted June 7, 2007 I believe it's the set link which is causing a problem. Please try any of these variations to see if they work: link='updateChart("CO#3");' link="updateChart('CO#3');" Basically, we're providing the parameter to updateChart function in quotes, as it's a string. Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 11, 2007 Pallav, No luck with that. I'm having problems trying to fit the "quotes" in. It says "Invalid XML" when I try to move the quotations around like you suggested. This is the xml string that i'm building which is throwing an error. this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coID + "' color='" + colorArray[colorCount] + "' link='updateChart("+coID+")'/>"; Thanks for your help. Share this post Link to post Share on other sites
Pallav Report post Posted June 12, 2007 Since you've 3 nested quotes, you'll have to use ASCII code for one of them. Like, use the ascii code of " for the innermost quote. Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 12, 2007 Pallav, I did replace them with ASCII, but I still get the "Invalid XML" msg. this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coID + "' color='" + colorArray[colorCount] + "' link='updateChart("+coID+")')/>"; this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coID + "' color='" + colorArray[colorCount] + "' link='updateChart("+coID+")')/>"; this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coID + "' color='" + colorArray[colorCount] + "' link='updateChart("+coID+")')/>"; Thanks Share this post Link to post Share on other sites
Pallav Report post Posted June 13, 2007 We use something like this in PHP: $strLink = urlencode("updateChart(" . $intYear . "," . chr(34) . $ors['Country'] . chr(34) . ");"); $strXML .= "<set label='" . escapeXML($ors['Country'], $forDataURL) . "' value='" . $ors['Average'] . "' link='" . $strLink . "'/>"; And something like this in ASP: 'Generate the link strLink = Server.URLEncode("updateProductChart(" & intYear & "," & oRs("MonthNum") & "," & ors("CategoryId") & ");") 'Append data strDataXML = strDataXML & "<set value='" & oRs("Total") & "' link='" & strLink & "'/>" Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 18, 2007 Pallav, I'm still getting the same error. "COHASH7" is undefined. string coIDcoded = "COHASH7"; string strLink = Server.UrlEncode("updateChart("+coIDCoded+");"); this.strXMLDoc += "<set value='" + coAMT.ToString() + "' name='" + coIDCoded + "' color='" + colorArray[colorCount] + "' link='"+strLink+"'/>"; Thanks. Share this post Link to post Share on other sites
zaphodbroxy Report post Posted June 18, 2007 Pallav, Got it working. Thanks for your help. Some tricky url encoding did the job. Thanks Share this post Link to post Share on other sites