Hello,
I am unable to set the BreakCount for 'ManualInterval' symbology. The value remains zero. What is the proper way to set the number of breaks?
It works for 'NaturalBreaks' classificationMethod but not for 'ManualInterval'. Changing the classification method in the code below and removing the references to classBreaks will work as expected.
<SPAN class="comment token">#ArcGIS Pro 2.1.2</SPAN>
<SPAN class="comment token">#Python 3.6.2, 64 bit</SPAN>
aprx <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mp<SPAN class="punctuation token">.</SPAN>ArcGISProject<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'CURRENT'</SPAN><SPAN class="punctuation token">)</SPAN>
cwd <SPAN class="operator token">=</SPAN> <SPAN class="string token">'c:\\temp'</SPAN>
workingLayer <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listMaps<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>listLayers<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
sourceTable <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListTables<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
sourceLayout <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listLayouts<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
metric <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Calc01Perc'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">0.5</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">0.5</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># (Field name, (min,max values))</SPAN>
sym <SPAN class="operator token">=</SPAN> workingLayer<SPAN class="punctuation token">.</SPAN>symbology
sym<SPAN class="punctuation token">.</SPAN>updateRenderer<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'GraduatedColorsRenderer'</SPAN><SPAN class="punctuation token">)</SPAN>
sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>classificationMethod <SPAN class="operator token">=</SPAN> <SPAN class="string token">'ManualInterval'</SPAN>
sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>classificationField <SPAN class="operator token">=</SPAN> sourceTable <SPAN class="operator token">+</SPAN> <SPAN class="string token">'_'</SPAN> <SPAN class="operator token">+</SPAN> metric<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'DEBUG fieldname: '</SPAN> <SPAN class="operator token">+</SPAN> sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>classificationField<SPAN class="punctuation token">)</SPAN>
sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>colorRamp <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listColorRamps<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Bathymetric Scale'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>breakCount <SPAN class="operator token">=</SPAN> <SPAN class="number token">10</SPAN> <SPAN class="comment token"># This does not stick for 'ManualInterval' or unspecified classificationMethod</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'DEBUG breakCount: '</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>breakCount<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">'= 10 ?'</SPAN><SPAN class="punctuation token">)</SPAN>
step <SPAN class="operator token">=</SPAN> <SPAN class="number token">0.1</SPAN>
breakVal <SPAN class="operator token">=</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">0.5</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'DEBUG len(classBreaks) = '</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>len<SPAN class="punctuation token">(</SPAN>sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>classBreaks<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> brk <SPAN class="keyword token">in</SPAN> sym<SPAN class="punctuation token">.</SPAN>renderer<SPAN class="punctuation token">.</SPAN>classBreaks<SPAN class="punctuation token">:</SPAN>
brk<SPAN class="punctuation token">.</SPAN>upperBound <SPAN class="operator token">=</SPAN> breakVal
breakVal <SPAN class="operator token">+=</SPAN> step
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'DEBUG next break: '</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>breakVal<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
workingLayer<SPAN class="punctuation token">.</SPAN>symbology <SPAN class="operator token">=</SPAN> sym<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>