Legend Transparency set in code causing runtime crash

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Legend Transparency set in code causing runtime crash

Post by Michael_Xu » Fri Feb 08, 2008 9:37 pm

Hi,

If I set:
chart1.Legend..Transparent = true;
chart1.Legend.Transparency = 100;

Then it has 95% of chance to have null reference exception from TeeChart and simply will not show anything. Even I add the code after the series have been added successfully, it still do the crash. Is this because the property is deeply inherited? Change it in the Editor using Legend - Format - Frame - Visible and Legend - Format - Color - Transparent is OK though. But I need to do it in the code!

Thanks,
Michael

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Post by Michael_Xu » Fri Feb 08, 2008 9:42 pm

Sorry,

chart1.Legend.Transparent = true;
chart1.Legend.Transparency = 100;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 12, 2008 9:27 am

Hi Michael_Xu,

I'm not able to reproduce the problem here using latest TeeChart for .NET v3 release available at the client area. Which TeeChart version are you using? If the problem persists could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Legend Problem

Post by Michael_Xu » Tue Feb 12, 2008 11:21 pm

Yes, the latest (eval) version runs OK with the test project (uploaded), the version has runtime crash was v2 (2.0.2306.26232). However, using the eval version, chart.DrawToBitmap() does not generate correctly, the bitmap is tiny and unviewable; if I use chart.Export.Image.PDF or JPEG .Save(), I can see a image with inverted colors.

Is this because it is eval version, or v3 fails at DrawToBitmap() ?

Please advise.

Thanks,
Michael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 13, 2008 11:07 am

Hi Michael,

As you can see in TeeChart for .NET v2 release notes, the version you use is quite an old one. I'm not able to reproduce the issue here using the version we posted yesterday at the client area. Could you please try if this version solves the problem at your end?

Regarding v3, this works fine for me here using Build 3.2.2945.19741, is this the same built you are using? The DrawToBitmap issue may be related to what I described here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Post by Michael_Xu » Wed Feb 13, 2008 4:35 pm

Thanks, Narcis,

I just installed 2.0.2964.31902 (uninstalled the old v2, then the new full version of v2, then the updated). It seems that PublicKeyToken has changed so I cannot run. What is the new PublicKeyToken?

Thanks,
Michael
mxu@p2es.com

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Post by Michael_Xu » Wed Feb 13, 2008 4:52 pm

Sorry, the PublicKeyToken has not changed. I will look into what else caused it not running.

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Post by Michael_Xu » Wed Feb 13, 2008 8:19 pm

Narcis,

I found the reason why some old projects would not run:

User has to manually replace the DLLs in
Program Files\Steema Software\TeeChart for .NET v2
(version 2.0.2887.28040) with the ones in
Program Files\Steema Software\TeeChart for .NET v2 Update Build
(version 2.0.2964.31902)

As for v3, yesterday I downloaded the eval version (TeeChartNET3VSNET2005Eval.exe) from public access, not the client area, right click this TeeChartNET3VSNET2005Eval.exe I can found in Properties / Digital Signatures a timestamp of Jan 24, 2008 8:52:35 AM.

I found other problems with v3 yesterday, with the same code I wrote for v2, the footer did not show up in v3; I assigned (specified) colors for series, v3 shows the colors are not specified. So I uninstalled v3 earlier this morning.

Thanks,
Michael

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 14, 2008 10:26 am

Hi Michael,
I found other problems with v3 yesterday, with the same code I wrote for v2, the footer did not show up in v3; I assigned (specified) colors for series, v3 shows the colors are not specified. So I uninstalled v3 earlier this morning.
Could you please also send us a simple example project we can run "as-is" to reproduce the problem here? We would try running it using latest v2 and v3 version and check if there are differences.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Color test

Post by Michael_Xu » Thu Feb 14, 2008 9:09 pm

Hi, Narcís,

The project I uploaded last time can be used for testing. I will upload again just in case.

bar1.Brush.Color = System.Drawing.Color.Gold;

fastLine1.Color = System.Drawing.Color.Blue;

Thanks,

Michael

Michael_Xu
Newbie
Newbie
Posts: 11
Joined: Fri Sep 01, 2006 12:00 am

Post by Michael_Xu » Thu Feb 14, 2008 9:12 pm

Uploaded as TeeChartLegendTest.rar

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Feb 15, 2008 11:12 am

Hi Michael,

Thanks for the example project. In v3, for series colors to work as you expect you need to use this:

Code: Select all

						bar1.Color = System.Drawing.Color.Gold;
Regarding footer, you need to add the following line:

Code: Select all

						chart1.Footer.Visible = true;
I've checked that your original code worked in v2 so I've added this (TF02012821) to our defect list to have the same behavior in v3.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Feb 15, 2008 11:50 am

Hi Michael,

After reviewing the series colors issues we found that you need to add them to the chart's series colection before modifying their colors. Code below works fine in v3:

Code: Select all

            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(chart1.Chart);
						Steema.TeeChart.Styles.FastLine fastLine1 = new Steema.TeeChart.Styles.FastLine(chart1.Chart);

            // bar1
						bar1.Brush.Color = System.Drawing.Color.Gold;
						//bar1.Color = System.Drawing.Color.Gold;
            bar1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked;
You'll need to remove or comment in the code below as well.

Code: Select all

						//chart1.Series.Add(bar1);

						//chart1.Series.Add(fastLine1);
Regarding the footer problem, in v3 it is set to not visible by default. Both, the color and footer issues, had different behavior in v2 because of some serialization issues on that version.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply