<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic arcpy charts, setting the class break values? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-charts-setting-the-class-break-values/m-p/1041836#M60596</link>
    <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I have a script that loops though a dataframe, runs a query and exports each subset to a feature table. Then i use arcpy.chart to generate calendar heat charts. I have set the classification method to 'natural breaks' but that gives be classes with heaps of decimals (see attached). Is there anyway to round the class breaks? I am exporting them to svg's so I guess I could do some sort of replace, but just wondering if there is an easier method?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-03-30_16-35-41.png" style="width: 711px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/9632i9BA17031FF6DD633/image-dimensions/711x391?v=v2" width="711" height="391" role="button" title="2021-03-30_16-35-41.png" alt="2021-03-30_16-35-41.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 05:39:12 GMT</pubDate>
    <dc:creator>PeterMilenkovic</dc:creator>
    <dc:date>2021-03-30T05:39:12Z</dc:date>
    <item>
      <title>arcpy charts, setting the class break values?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-setting-the-class-break-values/m-p/1041836#M60596</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;I have a script that loops though a dataframe, runs a query and exports each subset to a feature table. Then i use arcpy.chart to generate calendar heat charts. I have set the classification method to 'natural breaks' but that gives be classes with heaps of decimals (see attached). Is there anyway to round the class breaks? I am exporting them to svg's so I guess I could do some sort of replace, but just wondering if there is an easier method?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-03-30_16-35-41.png" style="width: 711px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/9632i9BA17031FF6DD633/image-dimensions/711x391?v=v2" width="711" height="391" role="button" title="2021-03-30_16-35-41.png" alt="2021-03-30_16-35-41.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 05:39:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-setting-the-class-break-values/m-p/1041836#M60596</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-03-30T05:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy charts, setting the class break values?</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-setting-the-class-break-values/m-p/1042255#M60602</link>
      <description>&lt;P&gt;Ok, I played around with it and the best solution could come up with was to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Read the svg&lt;/LI&gt;&lt;LI&gt;Find the legend values by searching child nodes that contain&amp;nbsp;'≤'&lt;/LI&gt;&lt;LI&gt;Creating a list of legend values&lt;/LI&gt;&lt;LI&gt;Creating a new list to round the legend values&lt;/LI&gt;&lt;LI&gt;Modifying the original list (step 3) to re-insert a thousand separator ','&lt;/LI&gt;&lt;LI&gt;String replace on the svg file&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;doc = xml.dom.minidom.parse(r"O:\users\pmilenkovic\PythonScripts\NotebookSandbox"  +os.sep + loc +'d_daily.svg')

    name = doc.getElementsByTagName('text')

    leg_lab=[]
    dec_pos = []
    for tx in name:
        if re.search('≤',str(tx.childNodes)):
            tx.normalize()
            
            leg_lab.append(str(tx.firstChild.data).replace(',','').replace('≤','').strip())


    leg_lab_replace = []
    for ll in leg_lab:
        leg_lab_replace.append(round(float(ll)))



    leg_lab_to_replace = []
    for ll in leg_lab:
        if ll.find('.') == 4:
            leg_lab_to_replace.append(ll[:1]+','+ll[1:])
        elif ll.find('.') == 5:
            leg_lab_to_replace.append(ll[:2]+','+ll[2:])
        else:
            leg_lab_to_replace.append(ll)

  
    #input file
    fin = open(r"O:\users\pmilenkovic\PythonScripts\NotebookSandbox" +os.sep + loc +'d_daily.svg', "rt")
    #output file to write the result to
    data = fin.read()
    for ll, nll in zip(leg_lab_to_replace,leg_lab_replace):
    
        data = data.replace(str(ll),str(nll))
    fin = open(r"O:\users\pmilenkovic\PythonScripts\NotebookSandbox" +os.sep + loc +'d_daily.svg', "wt")

    fin.write(data)
    #close input and output files
    fin.close()  &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 01:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-setting-the-class-break-values/m-p/1042255#M60602</guid>
      <dc:creator>PeterMilenkovic</dc:creator>
      <dc:date>2021-03-31T01:31:47Z</dc:date>
    </item>
  </channel>
</rss>

