Setting color scales for the colorgrid

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
HQO
Newbie
Newbie
Posts: 25
Joined: Thu Jun 05, 2003 4:00 am
Contact:

Setting color scales for the colorgrid

Post by HQO » Fri Jan 23, 2004 11:36 am

Question 1:
How I can specify the colors for each point in ColorGrid - series. For example, if value is lower than 3 then color of this point is yellow, if value is over 3 and lower than 4, the color of this point is green and so one...


Question 2:
Is there way to "disable" the automatic scalin in colorgrid series. Can I say that maximum value is 100 and minimun value is 0 and series use those information for color scaling. Now it's use maximum and minimum values from the data value array.

Thank's

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Jan 27, 2004 10:35 am

Hi,

you can do something like the following code :

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			colorGrid1.FillSampleValues(50);
			//apply a new Palette 
			colorGrid1.PaletteSteps=7; 
			colorGrid1.ClearPalette(); 
			double dataRange=colorGrid1.YValues.Maximum-colorGrid1.YValues.Minimum; 
			double minVal=colorGrid1.YValues.Minimum; 
			colorGrid1.AddPalette(minVal+(dataRange*0.1),Color.DarkBlue); 
			colorGrid1.AddPalette(minVal+(dataRange*0.2),Color.Blue); 
			colorGrid1.AddPalette(minVal+(dataRange*0.3),Color.LightBlue); 
			colorGrid1.AddPalette(minVal+(dataRange*0.5),Color.Yellow); 
			colorGrid1.AddPalette(minVal+(dataRange*0.7),Color.YellowGreen); 
			colorGrid1.AddPalette(minVal+(dataRange*0.8),Color.LightGreen); 
			colorGrid1.AddPalette(minVal+(dataRange*0.9),Color.Green); 
			colorGrid1.UseColorRange=false; 
			colorGrid1.UsePalette=true; 
			tChart1.Refresh(); 		
		}

Post Reply