Jscript: Invalid character error !!
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


12»»

Jscript: Invalid character error !! Expand / Collapse
Author
Message
Posted 5/31/2007 4:18:29 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/18/2007 5:18:47 PM
Posts: 8, Visits: 13
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....

Post #1153
Posted 6/1/2007 10:40:32 PM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 10/3/2008 2:42:18 AM
Posts: 2,117, Visits: 498
Can you please pass on the full HTML and XML output?

Thanks,
Pallav Nadhani
FusionCharts Team
Post #1163
Posted 6/4/2007 2:38:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/18/2007 5:18:47 PM
Posts: 8, Visits: 13
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.

Post #1189
Posted 6/4/2007 2:41:13 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/18/2007 5:18:47 PM
Posts: 8, Visits: 13
Also, the code is behind a "https" protocol. Dunno if that makes any diff with the JS and chart interactivity.

Thanks

Post #1190
Posted 6/6/2007 1:01:18 AM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 10/3/2008 2:42:18 AM
Posts: 2,117, Visits: 498
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.

Thanks,
Pallav Nadhani
FusionCharts Team
Post #1205
Posted 6/6/2007 3:27:50 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/18/2007 5:18:47 PM
Posts: 8, Visits: 13
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.

Post #1227
Posted 6/7/2007 1:34:02 AM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 10/3/2008 2:42:18 AM
Posts: 2,117, Visits: 498
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.

Thanks,
Pallav Nadhani
FusionCharts Team

Post #1238
Posted 6/11/2007 11:46:15 AM