Display problem with Legend

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Display problem with Legend

Post by VarMelb » Fri Mar 26, 2010 4:16 am

Hi Support,

once the legend items have been changed as follows

tChart1.Legend.Items[(int)numericUpDown1.Value].Text = textBox2.Text

the legend items no longer remain in the legend box when the window is resized. This happens in the TChart demo application.

In the demo application:
Under All features/Miscellaneous/Legend/Legend items
If the window is resized the legend redraws ok.

But if one of the legend items has been changed (in the text box) and then the window is resized the legend does not redraw correctly.

Can you provide a work around for this?

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Fri Mar 26, 2010 4:14 pm

Hi Mark,

Yes, this is a known bug already in the defect list to be fixed in further releases (TV52012509). I've incremented the issue priority.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: Display problem with Legend

Post by VarMelb » Sun Mar 28, 2010 10:30 pm

Hi Yeray,

thank you for the quick update.

I do hope this can be fixed asap as this is problem for our customer.

When can we expect the next maintenance release of TChart for .Net 4.0?

I had spent some time wondering if there was something that I was doing wrong as in my code the series items in the legend were over writing the legend title! Then I resized the window!

It is unfortunate that some of TChart's excellent features are marred by defects that (at least to me) indicate in sufficient testing at Steema. I'm not sure if it's just the particular way our software needs to use the TChart features but it sure is frustrating at times!

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Tue Mar 30, 2010 8:57 am

Hi Mark,

At this moment, I'm afraid I can't think on another workaround different than drawing your custom legend manually with canvas routines.

Note that TeeChart sources are constantly changing, adding new features and fixing identified problems. Applying these changes, unfortunately, may affect other functionalities (sometimes positively and sometimes negatively) and, as you'll understand, we can't test all the functionalities in detail each time we change something. Anyway, I'd like to apologize for the inconvenience.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: Display problem with Legend

Post by VarMelb » Tue Mar 30, 2010 9:10 pm

Hi Yeray,

well it was easier (ie, less work) for me to fix the defect in the TChart source code and rebuild TChart.dll for our application than to write a custom legend control. The unfortunate part is that we now have a customized TChart.
Applying these changes, unfortunately, may affect other functionalities (sometimes positively and sometimes negatively) and, as you'll understand, we can't test all the functionalities in detail each time we change something.
Well, automated testing can go a long way to mitigate the problem of not be able to test everything in detail manually. For example, we run 1000's of tests everytime our software builds on the build PC's and a build is run whenever there is a pending change in the source code respository.

Anyway this is not the forum to debate this and I thankyou for your time.

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Thu Apr 01, 2010 10:08 am

Hi Mark,
VarMelb wrote:well it was easier (ie, less work) for me to fix the defect in the TChart source code and rebuild TChart.dll for our application than to write a custom legend control. The unfortunate part is that we now have a customized TChart.
The issue is that setting the Items.Text also sets Items.Custom to true, meaning that the automatically calculated positions are ignored. So, changing this around so that setting the Text doesn't set Custom to true means that 1) you can set text and have automatic positioning 2) if you *later* set Custom to True you can use custom positioning.

Is this how you fixed it?
VarMelb wrote:Well, automated testing can go a long way to mitigate the problem of not be able to test everything in detail manually. For example, we run 1000's of tests everytime our software builds on the build PC's and a build is run whenever there is a pending change in the source code respository.

Anyway this is not the forum to debate this and I thankyou for your time.
Thanks for your commentaries, we'll try to improve our methodology. And don't worry! Constructive suggestions are always welcome.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: Display problem with Legend

Post by VarMelb » Wed Apr 07, 2010 10:37 pm

Hi Yeray,

sorry for the delay - I've been on leave.
The issue is that setting the Items.Text also sets Items.Custom to true, meaning that the automatically calculated positions are ignored. So, changing this around so that setting the Text doesn't set Custom to true means that 1) you can set text and have automatic positioning 2) if you *later* set Custom to True you can use custom positioning.

Is this how you fixed it?
I mostly deleted code (about 4 or 5 lines) in DrawLegendItem. Do you want me to post here or email it to you?

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Thu Apr 08, 2010 8:58 am

Hi Mark,

DrawLegendItem has about 230 lines of code. It would be better if you could send your modifications to our upload page.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: Display problem with Legend

Post by VarMelb » Thu Apr 08, 2010 9:37 pm

Hi Yeray,

I have uploaded the modified Legend.cs file.

You will note that the modified code does not support custom positioning of legend items which is ok for our application but not really a general solution. As I see it the problem appears to be due to the one flag (Item.Custom) being used to identify two possible changes, item text and item position. Our application only needs to change item text so using the default item position in a legend was a good quick fix that works for us. The better solution is to make the X and Y custom position of an item relative to the top left position of the legend.

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Fri Apr 09, 2010 9:20 am

Hi Mark,

I think that our solution should be more flexible and shouldn't break other charts.
As you are a source code customer, I've sent the latest Legend.cs to you by mail.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: Display problem with Legend

Post by VarMelb » Wed Apr 21, 2010 1:20 am

Hi Yeray,

I have incorporated the code you emailed me into our custom build and it works fine.

Thankyou for the support.

regards
Mark

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Display problem with Legend

Post by Yeray » Wed Apr 21, 2010 11:00 am

Hi Mark,

I'm glad to hear that!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply