Jump to content
Software FX Community

Server Error: Specified cast is not valid?


User (Legacy)

Recommended Posts

Posted

I have the following code after I have installed the stats extension. This 

is copied straight from the docs and put into a simple .aspx page. However I

get the error at the bottom of the page....

-------------------------------------------------------------------------------------------------------------------------------------------<%@ Page Language="C#"%><%@ Import Namespace="SoftwareFX.ChartFX"%><%@ Import Namespace="SoftwareFX.ChartFX.Borders"%><%@ Import Namespace="SoftwareFX.ChartFX.Data"%><%@ Import Namespace="SoftwareFX.ChartFX.Internet.Server"%><%@ Import Namespace="SoftwareFX.ChartFX.Internet.Server.GalleryObj"%><%@ Import Namespace="SoftwareFX.ChartFX.Annotation"%><%@ Import Namespace="System.Drawing"%><%SoftwareFX.ChartFX.Internet.Server.Chart chart1 = newSoftwareFX.ChartFX.Internet.Server.Chart(this);//Populating the Chart with random datachart1.OpenData(COD.Values,1,100);int j;Random rnd = new Random();double d1 = rnd.Next(100)+100;double d2 = rnd.Next(100);double d3 = rnd.Next(10);for (j = 0; j < 100; j++){ int nSpecial = rnd.Next(40); if (nSpecial == 1) chart1.Value[0,j] = 200 + rnd.Next(100); else if (nSpecial == 2) chart1.Value[0,j] = rnd.Next(100); else chart1.Value[0,j] = 100 + ((Math.Sin(((j*10+d2))/d1) +1)*40)+rnd.Next(10)+d3;}chart1.CloseData(COD.Values);//Create and add the Statistical extension. Not required if added atDesign-TimeSoftwareFX.ChartFX.Statistical.WinForms.Statistics statistics = newSoftwareFX.ChartFX.Statistical.WinForms.Statistics();statistics.Chart = chart1;chart1.GalleryObj = statistics.Gallery.FrequencyPolygon;statistics.Gallery.FrequencyPolygon.LimitLeft = 6;statistics.Gallery.FrequencyPolygon.LimitRight = 14;// Generate a chart of 400x280 pixelsResponse.Write(chart1.GetHtmlTag("450","280","image"));%>Once run I get this.... -------------------------------------------------------------------------------------------------------------------------------------------Server Error in '/charting' Application.Specified cast is not valid.Description: An unhandled exception occurred during the execution of thecurrent web request. Please review the stack trace for more informationabout the error and where it originated in the code.Exception Details: System.InvalidCastException: Specified cast is not valid.Source Error:Line 33: //Create and add the Statistical extension. Not required if addedat Design-TimeLine 34: SoftwareFX.ChartFX.Statistical.WinForms.Statistics statistics = newSoftwareFX.ChartFX.Statistical.WinForms.Statistics();Line 35: statistics.Chart = chart1;Line 36:Line 37: chart1.GalleryObj = statistics.Gallery.FrequencyPolygon;Source File: C:\Inetpub\wwwroot\charting\testStats.aspx Line: 35Stack Trace:[invalidCastException: Specified cast is not valid.] SoftwareFX.ChartFX.Statistical.WinForms.Statistics.set_Chart(Objectvalue) +117 ASP.testStats_aspx.__Render__control1(HtmlTextWriter __output, ControlparameterContainer) in C:\Inetpub\wwwroot\charting\testStats.aspx:35 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243 System.Web.UI.Page.ProcessRequestMain() +1926Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NETVersion:1.1.4322.2032 -------------------------------------------------------------------------------------------------------------------------------------------Any help?Terrance A. Snyder

Posted

You are using the wrong statiscal component, you have:

new SoftwareFX.ChartFX.Statistical.WinForms

This is the Windows Form version, you are using the Chart FX Web Forms

component you must do:

new SoftwareFX.ChartFX.Statistical.Server

--

FP

Software FX

Posted

Thanks, I appreciate the fast response.

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:OaqMintNFHA.3800@webserver3.softwarefx.com...

> You are using the wrong statiscal component, you have:

>

> new SoftwareFX.ChartFX.Statistical.WinForms

>

> This is the Windows Form version, you are using the Chart FX Web Forms

> component you must do:

>

> new SoftwareFX.ChartFX.Statistical.Server

>

> --

> FP

> Software FX

>

Posted

Another question so I don't bog down this newsgroup. The documentation shows 

View C# Code, and also an aspx icon that when clicked shows what I assumed

to be .aspx code. If I put this in a .aspx file I got that error from

before. Is there anywhere on your site on in the docs that go over the API

with samples for developing applications with C# on .aspx pages for the

stats, I have bought the full version and am completely confused as to how

to use it....

Terrance A. Snyder

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:OaqMintNFHA.3800@webserver3.softwarefx.com...

> You are using the wrong statiscal component, you have:

>

> new SoftwareFX.ChartFX.Statistical.WinForms

>

> This is the Windows Form version, you are using the Chart FX Web Forms

> component you must do:

>

> new SoftwareFX.ChartFX.Statistical.Server

>

> --

> FP

> Software FX

>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...