ThinkGeo.com    |     Documentation    |     Premium Support

Class Break Flooding

Hi,

The default behavior of class break appears to be that if a value is below the minimum level that it is not styled while on the maximum value side any value greater than the maximum receives the style assigned. For example, if I have breaks at 0 and 10 and we have a data value of 100, it will receiver whatever color 10 is set to. If we have a data value of -1, that value receives no color.

My question is what is the best way to be able to alter the behavior such that data value -1 receives the color assigned to level 0 and that data value 100 does not get colored.

I think the following code would do it, but the fact that you would need to specify a precision to the aboveTen class break to get it to be transparent seems error prone. Is there a better way?

        ClassBreak belowZero = new ClassBreak(double.MinValue, new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Red)));
        ClassBreak zero = new ClassBreak(0, new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Red)));
        ClassBreak ten = new ClassBreak(10, new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Blue)));
        ClassBreak aboveTen = new ClassBreak(10.001, new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Transparent)));

Hi Damian,

Class break work for a group of value but not only for one value, for special value you should want to choose ValueStyle.

When you set a ClassBreak value, that means the color you want to show from this value to a higher ClassBreak value or the max if it’s already the biggest value.

That’s why we need to set double.MinValue, or else the value smaller than the smallest ClassBreak value won’t be rendered.

So if you want to make some value not get rendered, you can set two ClassBreak values, one is smaller than it to render transparent and the other bigger than it to go on set color.

Please let me know whether I misunderstand your requirement.

Regards,

Don

Hi Don,

That pretty much confirms what I thought. My main issue was the precision of the value of the aboveTen class break. I don’t want to test my data for the max value every time as I work on some pretty large datasets and this is time consuming for the user. So, supplying the 10.001 could be error prone if my dataset has values between 10.0 and 10.001. Not a big deal, just not very ergonomic code.

Hi Damian,

Thanks to let us know your scenario, our developer discuss about that.

It looks you don’t want to set the above part of the biggest value for class break. But the problem is our design is, the smallest value will be picked as start level, so that’s why the smaller value will be ignored, but the range always point to max, the class break range only can be split by other class break level, so that’s why you need to set transparent for the above part. And for the sample you mentioned, the 10.0 need to be rendered by a style but all the value above that won’t be rendered, because 10.0 it’s a special value but not a value range, so you can try to render it by the value style at the same time to cover it, and just set >=10.0 as transparent.

So currently maybe your solution is the best way.

But thanks to let us know your scenario, it’s helpful to make us think about our API again, which is helpful for make our API better.

Regards,

Don