Experiencing trouble with ArcGIS Pro 2.3.2 sym.renderer to assign symbology to a layer in a map project using only python. I am automating map creation, and layer creation, symbolization. I am trying to assign symbology to a layer (polygons) using the GraduatedColorsRenderer. I update the renderer, classification method and assign it a field. Then I define the classBreakValues and the breakCount. I can only get one classification break even though i have defined 5 or more.
It appears that the sym.renderer.breakCount will not allow me to assign any value to it. Whenever I assign it to any integer it seems to not take it. When I print out the value of the sym.renderer.breakCount it is always set to 1 regardless of what I set it to. For the classification methods i have tried ManualInterval, EqualInterval, Quantile.
Here is my code:
for lyr in m.listLayers():
if lyr.name == "Binning Analysis":
sym = lyr.symbology
sym.renderer.colorRamp = aprx.listColorRamps('Blues (Continuous)')
sym.renderer.classificationMethod = 'EqualInterval'
classBreakValues = [5, 15, 35, 60, 1000]
classBreakLabels = ["1 - 5", "6 - 15", "16 - 35", "36 - 60", "> 60"]
sym.renderer.breakCount = len(classBreakValues)
#sym.renderer.breakCount = 5
count = 0
for brk in sym.renderer.classBreaks:
brk.upperBound = classBreakValues[count]
brk.label = classBreakLabels[count]
count += 1
lyr.symbology = sym
I also put this code in the ArcGIS Pro Python window with a bunch of debug print statements to make sure all of my assignments were valid. Every thing seems valid. But the one thing that keeps happening in the Python window:
sym.renderer.breakCount = 5 #### Or any other number does not matter print(sym.renderer.breakCount) 1 ### always outputs 1 no matter what i assign
Can anyone assist? Any help would be appreciated, thank you.