Page 1 of 1

Import.Template.Load not working properly

Posted: Fri Sep 28, 2018 2:10 pm
by 15682814
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

Re: Import.Template.Load not working properly

Posted: Mon Oct 01, 2018 7:20 am
by Christopher
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 12289 times
which version of TeeChart.dll are you using?

Re: Import.Template.Load not working properly

Posted: Mon Oct 01, 2018 10:57 am
by 15682814
v4.0.30319

will get the latest and try again

Re: Import.Template.Load not working properly

Posted: Mon Oct 01, 2018 4:16 pm
by 15682814
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

Re: Import.Template.Load not working properly

Posted: Tue Oct 02, 2018 6:13 am
by Christopher
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 12277 times
here the FastLine series color does not seem to be affected by template exportation and importation.