Page 1 of 1

Saving bar series to templates

Posted: Thu Jan 08, 2009 6:48 am
by 14045174
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.

Posted: Thu Jan 08, 2009 10:03 am
by narcis
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.

Posted: Thu Jan 08, 2009 7:50 pm
by 14045174
OK, finally I've installed the latest version. This problem is fixed in it! Thanks a lot!

Posted: Thu Jan 08, 2009 9:39 pm
by 14045174
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);
            }
        }

Posted: Fri Jan 09, 2009 9:07 am
by narcis
Hi UserLS,

Yes, I could reproduce that one and added it (TF02013698) to the list to be fixed.