Page 1 of 1

Tee Chart ActiveX 5 with C# .NET

Posted: Thu Jun 16, 2005 4:00 am
by 6924764
Hello,

I have been trying to use TeeChart v5 in the .Net Environment. I can display a graph using FillSampleValues, but I am running into issues using real data with some of TeeCharts expected Data Types.
For Example, in .NET C# TeeChart is expecting colors using a uint datatype. I am not able to use Color.Red or RGB(255,0,0). I was able to work around the issue by randomly generating colors then displaying a color code. Is there a better way to generate a reference list of colors for the uint datatype in C#?
Also, in attempting to add data points to a series using Series(index).AddXY I ran into an issue with the Double Data Type TChart is expecting for the X Values. My X Values are dates. DateTime datatype. I have not been able to figure out how to convert a DateTime to type double. The syntax: Convert.ToDouble(DateTime Variable) is invlaid. Any suggestions for adding a series with datetime x values?
Lastley I've noticed the ActiveX object doesn't work inside the form tags. I've been able to work around this by displaying the chart object outside of the tags but I was wondering if there was someway to make it work inside of the form tags.
I know version 5 is pre.Net and I can get TeeChart to work using classic asp and vbscript. I would just like to take advantage of .Net. features. Any help appreciated.

Thank you.

Posted: Mon Jun 20, 2005 2:40 pm
by Pep
Hi

1 and 2) Using the following code should work fine :

Code: Select all

1)
System.UInt32 blue = Convert.ToUInt32(ColorTranslator.ToOle(Color.Blue));
axTChart1.Series(0).AddXY(0,10,"",blue);
System.UInt32 customRGB = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(255,100,0)));
axTChart1.Series(0).AddXY(1,5,"",customRGB);

2)
axTChart1.Series(0).XValues.DateTime = true;
DateTime n = DateTime.Today;
axTChart1.Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yyyy";
axTChart1.Series(0).AddXY(n.ToOADate(),10,"", blue);
3) Yes, it works, I've been able to add a axTChart into the form tags just placing a TChart component into a WebForm (using the v 5.06).