ThinkGeo.com    |     Documentation    |     Premium Support

GradientStyle example?

Map Suite newbie, here. I am searching for a way to draw a set of features with a gradient fill, with the added requirement that the amount of gradient vary based on a column value of each feature. (E.g. if my gradient is from green-to-red with values 1-10, a value of 1 should have green only, and a value of 10 should be green-to-red). The class "GradientStyle" looks like it is exactly what I need, but I don't quite understand what attritribute of a layer it should be applied to. I have found only 1 small code example of use of a gradient. I would appreciate an example, or just being pointed at the proper attribute to set to use the GradientStyle, or another method of achieving my requirement. TIA!


Janene M.



Janene,


Welcome you to ThinkGeo Map Suite Desktop Forum!
 
I think you Gradient Style is exactly what you are trying to find, following is some snippet of codes you can take reference when using the Gradient Style.

ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(AreaStyles.Country1);
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


GradientStyle gradientStyle = new GradientStyle("POP_CNTRY", 0, new GeoSolidBrush(GeoColor.SimpleColors.Green), 2000000000, new GeoSolidBrush(GeoColor.SimpleColors.Red));
gradientStyle.RequiredColumnNames.Add("POP_CNTRY");
worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(gradientStyle);

Also, if you want, you also can try to use the ClassBreakStyle or ValueStyle to achieve your requirement, please take a look at the following HowDoI samples:


Styles\Draw features based on values
Styles\Draw thematic features
 
Let me know if you have any other questions.
 
Thanks.
 
Yale

Thanks, Yale, this got me what I wanted. 



Janene



Janene, you are welcome! 
  
 Let me know if you have any more questions! 
  
 Thanks. 
  
 Yale