Page 1 of 1

Setting color scales for the colorgrid

Posted: Fri Jan 23, 2004 11:36 am
by 8120359
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

Posted: Tue Jan 27, 2004 10:35 am
by Pep
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(); 		
		}