Page 1 of 1
Using function tag with Magnifier
Posted: Thu Jul 09, 2015 7:52 am
by 16071129
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.
Re: Using function tag with Magnifier
Posted: Thu Jul 09, 2015 10:04 am
by Christopher
Hello,
The problem is with the line:
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.
Re: Using function tag with Magnifier
Posted: Fri Jul 10, 2015 7:00 am
by 16071129
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.
Re: Using function tag with Magnifier
Posted: Fri Jul 10, 2015 8:53 am
by Christopher
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.