Import.Template.Load not working properly

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AndyRea
Newbie
Newbie
Posts: 5
Joined: Mon Jan 15, 2018 12:00 am

Import.Template.Load not working properly

Post by AndyRea » Fri Sep 28, 2018 2:10 pm

I'm trying to save the config of 3 charts in the registry when the application closes. i have an issue that amongst other things [ but an obvious one ] if I have set the bottom axis to be auto scaled, you can see it is set to auto if you inspect it, then export a stream, rewind the stream and re-import it to the same chart, the axis is no longer auto

if I do the following:

frm.tcAmGraph.Axes.Bottom.Automatic
[true]

var stream3 = new MemoryStream();
frm.tcAmGraph.Export.Template.IncludeData = false;
frm.tcAmGraph.Export.Template.Save(stream3);

stream3.Position = 0;
frm.tcAmGraph.Import.Template.Load(stream3);

frm.tcAmGraph.Axes.Bottom.Automatic
[false]

what am i missing?

thanks

Andy
Last edited by AndyRea on Mon Oct 01, 2018 4:35 pm, edited 1 time in total.

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

Re: Import.Template.Load not working properly

Post by Christopher » Mon Oct 01, 2018 7:20 am

Hello Andy,

using the latest publicly available version of TeeChart.dll (4.1.2018.05040) I cannot reproduce this issue:
2018-10-01_09-11-07.jpg
2018-10-01_09-11-07.jpg (53.75 KiB) Viewed 14915 times
which version of TeeChart.dll are you using?
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

AndyRea
Newbie
Newbie
Posts: 5
Joined: Mon Jan 15, 2018 12:00 am

Re: Import.Template.Load not working properly

Post by AndyRea » Mon Oct 01, 2018 10:57 am

v4.0.30319

will get the latest and try again

AndyRea
Newbie
Newbie
Posts: 5
Joined: Mon Jan 15, 2018 12:00 am

Re: Import.Template.Load not working properly

Post by AndyRea » Mon Oct 01, 2018 4:16 pm

I was wrong it was the latest

i'm more puzzled now

if i use the editor dialog to save out a .ten file of the chart ( with 1 fast line series and it's colour set to red ) and then

tcFmGraph.Import.Template.LoadFileDialog();

to load that file back in, the red trace goes back to the default blue trace ( application not stopped in between )

what am I missing? have attached the .ten file for anyones bemusement
Attachments
teechart.png
teechart.png (9.97 KiB) Viewed 14911 times
Chart1.zip
(4.01 KiB) Downloaded 1151 times

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

Re: Import.Template.Load not working properly

Post by Christopher » Tue Oct 02, 2018 6:13 am

Hello,

using the following code:

Code: Select all

		public Form1()
		{
			InitializeComponent();

			CreateCharts();

			InitializeChart();

		}

		private TChart tChart1, tChart2;
		private void InitializeChart()
		{
			FastLine fastLine = new FastLine(tChart1.Chart);
			fastLine.FillSampleValues();
			fastLine.Color = Color.Red;
		}

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

			tChart2.Import.Template.Load(stream);
		}

		private void CreateCharts()
		{
			tChart1 = new TChart();
			tChart2 = new TChart();

			tChart1.Dock = DockStyle.Fill;
			tChart2.Dock = DockStyle.Fill;

			tChart1.Header.Text = Utils.Version;

			splitContainer2.Panel1.Controls.Add(tChart1);
			splitContainer2.Panel2.Controls.Add(tChart2);
		}
I obtain the following result:
2018-10-02_08-11-03.gif
2018-10-02_08-11-03.gif (38.52 KiB) Viewed 14903 times
here the FastLine series color does not seem to be affected by template exportation and importation.
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