Temlates

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Temlates

Post by UserLS » Mon Jan 05, 2009 11:07 pm

I have created a chart with horizontal bar series. Made series marks not visible and exported it to the template file. Later I load this template and the series marks are visible. Why?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 07, 2009 9:18 am

Hi UserLS,

This works fine for me here using latest TeeChart for .NET v3 available at the download area and this code:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.FillSampleValues();
			bar1.Marks.Visible = false;

			System.IO.MemoryStream stream = new System.IO.MemoryStream();

			tChart1.Export.Template.Save(stream);
			tChart1.Clear();

			stream.Position = 0;
			tChart1.Import.Template.Load(stream);
		}
Also, I've found there's a similar issue (TF02013483) here and checked that it was fixed in 3rd November 2008 release (Build 3.5.3225.32183/4/5) as can be seen in the release notes.

Could you please try using last public version available and, if necessary, modify the code snippet above so that we can reproduce the issue here?

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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Wed Jan 07, 2009 9:34 am

You are creating a simple bar series - that works. Try horizontal bar series. This one (and only one as far as I can tell) is broken.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 07, 2009 9:41 am

Hi UserLS,

Ok, I could reproduce this here using the code below and added the defect to the bug list (TF02013684) to be fixed. In the meantime, a workaround is uncommenting the foreach statement in the example.

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			line1.FillSampleValues();

			Steema.TeeChart.Styles.Series s = line1;
			Steema.TeeChart.Styles.Series.ChangeType(ref s, typeof(Steema.TeeChart.Styles.HorizBar));

			System.IO.MemoryStream stream = new System.IO.MemoryStream();

			tChart1.Export.Template.Save(stream);

			stream.Position = 0;

			tChart1.Import.Template.Load(stream);

			//foreach (Steema.TeeChart.Styles.Series b in tChart1.Series)
			//{
			//  b.Marks.Visible = false;
			//} 
		}
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Wed Jan 07, 2009 9:46 am

I cannot do this. See, the problem is: the user created a graph, saved it to a template and later loads it into his report. I have no idea, if in the original graph marks are visible or not, and user expects to load the graph exactly the way he saved it!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 07, 2009 9:51 am

Hi UserLS,

In that case the only solution I can think of is saving an array with marks settings before exporting the chart and then loading them back:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			line1.FillSampleValues();

			Steema.TeeChart.Styles.Series s = line1;
			Steema.TeeChart.Styles.Series.ChangeType(ref s, typeof(Steema.TeeChart.Styles.HorizBar));

			Boolean[] visibleMarks = new Boolean[tChart1.Series.Count];

			for (int i = 0; i < visibleMarks.Length; i++)
			{
				visibleMarks[i] = tChart1[i].Marks.Visible;
			}

			System.IO.MemoryStream stream = new System.IO.MemoryStream();

			tChart1.Export.Template.Save(stream);

			stream.Position = 0;

			tChart1.Import.Template.Load(stream);

			for (int i = 0; i < visibleMarks.Length; i++)
			{
				tChart1[i].Marks.Visible = visibleMarks[i];
			} 
		}
If this is not feasible at your end you'll have to wait for the issue being fixed.
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Wed Jan 07, 2009 2:12 pm

In theory we can do it, but basically what you suggest is: every time I save a template, I need to write another file, which contains all the information, you failed to include into a template file. When I load it back, I need to find that second file, which goes with the template and after loading apply all the fixes.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 07, 2009 2:34 pm

Hi UserLS,

I posted this only as a workaround suggestion until a fix is implemented and not as a permament solution. This issue has been added to the TeeChart for .NET v3 bug list (TF02013684) to be fixed for next releases. I think this should be easy to fix as it is the same as TF02013684 but for horizontal series. I strongly recommend you to be aware at this forums or subscribe to our RSS news feed for new release announcements and what's fixed/implemented on them.

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

Post Reply