Gradient options

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

Gradient options

Post by UserLS » Tue Jan 13, 2009 3:44 pm

It seems to me that in the Dec 19th release non-linear gradient options are broken. At least they both produce the same result, while the previous versions produced distinctively different results.

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

Post by Narcís » Tue Jan 13, 2009 3:56 pm

Hi UserLS,

I can't see any difference with 3rd Nov and 19th Dec releases using this code:

Code: Select all

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

		private void InitializeChart()
		{
			Bar bar1 = new Bar(tChart1.Chart);

			bar1.FillSampleValues();
			bar1.Gradient.Visible = true;
			bar1.Gradient.Style.Visible = true;
			bar1.Gradient.Style.Direction = Steema.TeeChart.Drawing.PathGradientMode.FromCenter;
			//bar1.Gradient.Style.Direction = Steema.TeeChart.Drawing.PathGradientMode.Radial;
		}
Can you please confirm the version in which you noticed the differences and modify the code snippet above so that we can reproduce the problem 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 » Tue Jan 13, 2009 5:26 pm

I do use the Dec 19 version. I did not write any code, just go into chart editor, panel, gradient options. Select direction "from center", set the colors. Now change the direction to "Radial". If you are using middle color - you will see the right behavior. But now go into colors and check "no middle" box. Now both "Radial" and "From Center" will produce exactly the same image.

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 14, 2009 11:34 am

Hi UserLS,

Yes, that's correct, radial gradients need at least three colours to work. Try using this code:

Code: Select all

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

		private void InitializeChart()
		{
			tChart1.Walls.Back.Gradient.StartColor = Color.Red;
			tChart1.Walls.Back.Gradient.MiddleColor = Color.White;
			tChart1.Walls.Back.Gradient.EndColor = Color.Blue;
			tChart1.Walls.Back.Gradient.UseMiddle = true;
			tChart1.Walls.Back.Gradient.Style.Visible = true;
			tChart1.Walls.Back.Gradient.Style.Direction = Steema.TeeChart.Drawing.PathGradientMode.Radial;
		}
I can see a difference here changing Radial to FromCenter. Setting UseMiddle=false there's no difference.
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