Using function tag with Magnifier

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Quant
Advanced
Posts: 142
Joined: Tue Dec 30, 2014 12:00 am

Using function tag with Magnifier

Post by Quant » Thu Jul 09, 2015 7:52 am

Dear Steema,
I am using Moving Average function on my chart. also keeping object of class in tag of Moving Average. This works fine but when I am enabling magnifier tool. Chart crashes with error.
Kindly find the Simple Sample Project from below link.
SeriesTagMagnifier.zip
Simple Sample Project
(14.71 KiB) Downloaded 826 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Using function tag with Magnifier

Post by Christopher » Thu Jul 09, 2015 10:04 am

Hello,

The problem is with the line:

Code: Select all

tMovAvg.Tag = MyPopup;
If you comment this line out, there is no problem. The issue is that the Magnifier tool serializes the Chart by binary serialization, and a System.Windows.Forms.Form cannot be serialized. You can assign other values to Tag and have them serialized, e.g.

Code: Select all

object o = 50;
tMovAvg.Tag = o;
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Quant
Advanced
Posts: 142
Joined: Tue Dec 30, 2014 12:00 am

Re: Using function tag with Magnifier

Post by Quant » Fri Jul 10, 2015 7:00 am

Dear Steema,
We require to keep propertybag class object related to that particular series. We are placing n number of moving averages on chart and keeping all settings related with respective function. This works as expected without any problem except The Magnifier tool where we get error. We cant serialize propertybag class. So kindly resolve issue in Magnifier tool.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Using function tag with Magnifier

Post by Christopher » Fri Jul 10, 2015 8:53 am

Quant wrote:We cant serialize propertybag class. So kindly resolve issue in Magnifier tool.
This problem is generic to serialization, and is not specific to the Magnifier tool. You can see it is a generic problem by running code such as the following:

Code: Select all

    private void InitializeChart()
    {
      Form newForm = new Form();
      Bar series = new Bar(tChart1.Chart);
      series.FillSampleValues();
      series.Tag = newForm;
    }

    private void button2_Click(object sender, EventArgs e)
    {
      MemoryStream ms = new MemoryStream();
      tChart1.Export.Template.Save(ms);

      ms.Position = 0;
      tChart2.Import.Template.Load(ms);
    }
I'm afraid the only way to avoid this problem is to avoid trying to serialize the System.Windows.Forms.Form class.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply