Graduated Colors Rendering Doesn't Work With Negative Values

917
2
05-12-2020 05:03 PM
DominicChen
New Contributor

I'm trying to rendering a point feature layer with graduated colors rendering and manual interval method using Pro SDK. The field is double format. The values of all records of that field are negative. I take a reference from ProSnippets Render and ArcGIS Pro SDK Community Sample Code and implement the code. However, the rendering regards all the negative values as out-of-range and fails to render with correct symbol. If I apply with another break method (e.g. natural break) or with positive values, it won't have that problem.

Here are the code snippets:

List<CIMClassBreak> listClassBreaks = new List<CIMClassBreak>
{
    new CIMClassBreak
    {
        Symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 12).MakeSymbolReference(),
        UpperBound = -4124.13
    },
    new CIMClassBreak
    {
        Symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.GreenRGB, 12).MakeSymbolReference(),
        UpperBound = -3389.27
    },
    new CIMClassBreak
    {
        Symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.BlueRGB, 12).MakeSymbolReference(),
        UpperBound = -2321.95
    },
    new CIMClassBreak
    {
        Symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.GreyRGB, 12).MakeSymbolReference(),
        UpperBound = -1566.68
    },
    new CIMClassBreak
    {
        Symbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.WhiteRGB, 12).MakeSymbolReference(),
        UpperBound = -38.51
    }
};‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

CIMClassBreaksRenderer cimClassBreakRenderer = new CIMClassBreaksRenderer
{
    ClassBreakType = ClassBreakType.GraduatedColor,
    ClassificationMethod = ClassificationMethod.Manual,
    //Field = SDKHelpers.GetNumericField(featureLayer),
    Field = "NewPressure",
    Breaks = listClassBreaks.ToArray()
};
featureLayer?.SetRenderer(cimClassBreakRenderer);

Could anyone give some advice or ways to work around? Thank you very much.

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

Hi Dominic

Please add the MinimumBreak property in the CIMClassBreaksRenderer. That allows it to display the values. Like this:

CIMClassBreaksRenderer cimClassBreakRenderer = new CIMClassBreaksRenderer
{
    ClassBreakType = ClassBreakType.GraduatedColor,
    ClassificationMethod = ClassificationMethod.Manual,
    //Field = SDKHelpers.GetNumericField(featureLayer),
    Field = "NewPressure",
    MinimumBreak = -15, //Replace with your minimum value
    Breaks = listClassBreaks.ToArray()
};
DominicChen
New Contributor

That solves my problem. Thank you, Uma!

0 Kudos