Select to view content in your preferred language

NumberFormat settings not applying

603
6
02-12-2020 03:41 AM
GeoffYoung
Emerging Contributor

I am relatively new to ESRI products, so this might be a trivial question but I would be grateful if anyone can point me in the right direction. I am currently using ArcGis Pro 2.4 SDK.

I have set a renderer (CIMClassBreaksRenderer) NumberFormat (CIMNumericFormat) to ZeroPad=false, and applied it to a FeatureLayer (using SetRenderer). When the feature renders, the feature values in the Contents pane have padded zeroes but the property is set to false (as applied in the code) in the Advanced Symbology. If you alter anything temporarily on the Advanced Symbology pane, the zero padding setting is then applied to the values. Anyone know why this is not applied on initial 

0 Kudos
6 Replies
UmaHarano
Esri Regular Contributor

Hi Geoff

Which version of Pro are you on?

0 Kudos
GeoffYoung
Emerging Contributor

Hi Uma,

I'm on Pro 2.4.3.

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Geoff

I am seeing the same issue.  This is a bug. I have submitted an issue to the development team and will post when it gets addressed.

Thanks for reporting this!

Uma

0 Kudos
GeoffYoung
Emerging Contributor

Thanks, Uma.

0 Kudos
UmaHarano
Esri Regular Contributor

I can confirm that this has been fixed in version 2.6. Pro 2.6 will be released later this summer. You will be able to do something like this to get the correct label on the TOC that reflects the Number Format you use.

CIMClassBreaksRenderer renderer = (CIMClassBreaksRenderer)featureLayer.CreateRenderer(gcDef);
renderer.NumberFormat = new CIMNumericFormat {
    RoundingValue = 9,
    RoundingOption = esriRoundingOptionEnum.esriRoundNumberOfDecimals,
    ZeroPad = false
}; 

foreach (var br in renderer.Breaks) {
     var specialChar = br.Label.Substring(0, 1);
     var value = NumberFormat.ValueToString(numberFormat, br.UpperBound);
     br.Label = $"{specialChar}{value}";
}‍‍‍‍‍‍‍‍‍
0 Kudos
GeoffYoung
Emerging Contributor

Thanks Uma.

Regards,

Geoff

0 Kudos