Problem with loading template files

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Problem with loading template files

Post by VH1 » Tue Mar 20, 2007 9:17 am

Version
1.1.2531.28391

Steps to create problem: -
1/ Create a chart.
2/ Add a Bar Series.
3/ Add random data.
4/ Add a "Mark Tips" Tool from the TeeChart Editor Tools Section.
5/ Verify the tooltips are showing.
6/ Create a GetText handler for the Mark Tips tool.
7/ Verify the Mark Tips toll uses this handler.
8/ Now execute the following: -

this.tChart1.Export.Template.Save("test.ten");
this.tChart1.Import.Template.Load("test.ten");

You will find that when loading the template file, the chart still thinks it has the Mark Tips tool and the handler you created (which is what I expect), however, the handler is now never used. The only work around I could find was to delete the Mark Tips tool, recreate the handler and add it back again after loading.

Therefore I conclude, that when using the "Mark Tips" tool, the template file is incorrect.

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 Mar 20, 2007 12:14 pm

Hi VH1,

Event handlers are not exported with TeeChart. After importing a chart you should manually re-assign the events you wish to be used.
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Tue Mar 20, 2007 1:44 pm

After loading, if I look at the Mark Tips tool object....

The GetText property is still populated with the correct information.

Please take a look at
GetText->
System.MulticastDelegate->
System. Delegate->
Method->
System.Reflection.RuntimeMethodInfo->
Name

This holds the name of the method which should be called for the GetText event handler. I agree TeeChart should not store the actual event handler in the template file, but merely a reference to it.

As far as I can see, this information is exactly what is required, however, it seems after loading it does not do anything with it anymore.

I am guessing there are some checks being made in the MarkTips tool object and for some reason it thinks it does not have the event reference anymore?

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 Mar 20, 2007 2:27 pm

Hi VH1,

Could you please send us a simple example project we can run "as-is" to reproduce the behaviour you're reporting here?

You can either post your files at news://www.steema.net/steema.public.attachments 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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Tue Mar 20, 2007 3:28 pm

Please find the example uploaded to your server under the name of VH1.

Filename: - WindowsApplication7.zip

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 Mar 20, 2007 3:51 pm

Hi VH1,

Thanks for the example.

After importing previously exported chart Marks display series Y values unless you reassign GetText event after importing the chart:

Code: Select all

			foreach (Steema.TeeChart.Tools.MarksTip mt in tChart1.Tools)
			{
				mt.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText_1);
			}
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

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Tue Mar 20, 2007 4:07 pm

Yes, I tried that already and that does not work.

Hence the reason for having to remove the MarkTips tool and then re-add it?

I guess I will have to go with the my workaround for now.

Marc
Site Admin
Site Admin
Posts: 1265
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Mar 20, 2007 6:14 pm

Hello,

Hmmm....

Re.

Code: Select all

foreach (Steema.TeeChart.Tools.MarksTip mt in tChart1.Tools)
{
   mt.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText_1);
}

The code appears to work on the test project you uploaded when added before the end of the button1_Click method. Only other change made to project was to update TeeChart reference to 1.1.2531.28391. Please check the TeeChart reference.

Regards,
Marc Meumann
Steema Support

VH1
Advanced
Posts: 105
Joined: Thu May 13, 2004 4:00 am
Location: UK

Post by VH1 » Wed Mar 21, 2007 11:47 am

Hmm, you are right, your code works...

Code: Select all

foreach (Steema.TeeChart.Tools.MarksTip mt in tChart1.Tools) 
{ 
   mt.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText_1); 
}
However, as I did not want to change all Marktips tools I originally tried just...

Code: Select all

this.marksTip1.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(this.marksTip1_GetText);
And that did not work.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Mar 21, 2007 1:44 pm

Hi.

This is because the reference to this.marksTip1 is set to null after you load the chart. After load you cannot reference marksTip1 anymore .. that is, unless you reassign the variable as:

Code: Select all

marksTip1 = tChart1.Tools[0] as MarksTip;
or alternatively, in your code reference tChart1.Tools[index] and not the marksTip1:

Code: Select all

(tChart1.Tools[0] as MarksTip).GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText_1); 
The same rule applies to chart Series.
Marjan Slatinek,
http://www.steema.com

Post Reply