Saving bar series to templates

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

Saving bar series to templates

Post by UserLS » Thu Jan 08, 2009 6:48 am

There are two different cases (both can be reproduced for both vertical and horizontal bars with very little difference):
  • Create a bar series, do not change its color, go to pattern editor, make gradient visible and make sure gradient colors are different from the series color. Save to a template file and then load this template back. The gradient colors should be correct, but if you had a horizontal bar graph with vertical gradient direction - too bad, the direction is horizontal now.
  • Create a bar series, this time change its color, go to pattern editor, make gradient visible and make sure gradient colors are different from the series color. Save to a template file and then load this template back. The gradient colors now are using series color and the middle color (if was used) isn't used anymore. Half of the time, if I go to the pattern editor it will show the correct colors for gradient option, but if I did not go into each of them and reselect the same color - next time it will show the defaults for the selected series color.

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

Post by Narcís » Thu Jan 08, 2009 10:03 am

Hi UserLS,
# Create a bar series, do not change its color, go to pattern editor, make gradient visible and make sure gradient colors are different from the series color. Save to a template file and then load this template back. The gradient colors should be correct, but if you had a horizontal bar graph with vertical gradient direction - too bad, the direction is horizontal now.
I'm not sure to understand which the exact problem is. I can't reproduce it at designtime. I tried to reproduce it using code below and I think it works fine:

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.Gradient.Visible = true;
			bar1.Gradient.StartColor = Color.Red;
			bar1.Gradient.EndColor = Color.Yellow;

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

			tChart1.Export.Template.Save(stream);

			tChart1.Clear();

			Steema.TeeChart.Styles.HorizBar horizBar1 = new Steema.TeeChart.Styles.HorizBar(tChart1.Chart);

			horizBar1.FillSampleValues();
			horizBar1.Gradient.Visible = true;
			horizBar1.Gradient.Direction = System.Drawing.Drawing2D.LinearGradientMode.Vertical;

			stream.Position = 0;
			tChart1.Import.Template.Load(stream);
		}
Does this produce the problem at your end? Can you modify the code or post exact steps we should follow so that we can reproduce the issue here?
# Create a bar series, this time change its color, go to pattern editor, make gradient visible and make sure gradient colors are different from the series color. Save to a template file and then load this template back. The gradient colors now are using series color and the middle color (if was used) isn't used anymore. Half of the time, if I go to the pattern editor it will show the correct colors for gradient option, but if I did not go into each of them and reselect the same color - next time it will show the defaults for the selected series color.
I couldn't reproduce this one either. Could you please let us know how to reproduce it too? You may also want to check if latest release solves both problems at your end.

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 » Thu Jan 08, 2009 7:50 pm

OK, finally I've installed the latest version. This problem is fixed in it! Thanks a lot!

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

Post by UserLS » Thu Jan 08, 2009 9:39 pm

oops... You still have a slight problem here: if you run the following code the gradient colors are there! but the direction will be switched to horizontal.

Code: Select all

        private void testButton_Click(object sender, System.EventArgs e)
        {
            tChart1.Clear();
            var bar = new HorizBar(tChart1.Chart)
                          {
                              Color = Color.Yellow,
                              Gradient =
                                  {
                                      Direction = LinearGradientMode.Vertical,
                                      Visible = true,
                                      StartColor = Color.Red,
                                      EndColor = Color.Green,
                                      MiddleColor = Color.DeepPink
                                  }
                          };

            bar.FillSampleValues();

            using (var stream = new System.IO.MemoryStream())
            {
                tChart1.Export.Template.Save(stream);
                tChart1.Clear();
                stream.Position = 0;
                tChart1.Import.Template.Load(stream);
            }
        }

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

Post by Narcís » Fri Jan 09, 2009 9:07 am

Hi UserLS,

Yes, I could reproduce that one and added it (TF02013698) to the list to be 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

Post Reply