<?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 Re: arcpy.charts.Line fails with simple csv in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248219#M66558</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;, I completely understand your confusion with respect to the error message. We will look into either improving the error message or possibly accepting `Result` objects as a valid `dataSource` argument.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take care,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2023 20:17:21 GMT</pubDate>
    <dc:creator>ChristopherAllen</dc:creator>
    <dc:date>2023-01-13T20:17:21Z</dc:date>
    <item>
      <title>arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1245909#M66426</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must be missing something simple for a line chart.&amp;nbsp; I have a simple csv file X,Y data ... values are doubles and I want to create a line chart but it blows up with the error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="1 2 3 4 5 6 7" color="#FF0000"&gt;File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="1 2 3 4 5 6 7" color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\charts.py", line 449, in exportToSVG&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="1 2 3 4 5 6 7" color="#FF0000"&gt;svgRes = self.getSVG(width if width != None else self.displaySize[0],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="1 2 3 4 5 6 7" color="#FF0000"&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\charts.py", line 445, in getSVG&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="1 2 3 4 5 6 7" color="#FF0000"&gt;return _convertArcObjectToPythonObject(self._arc_object.getSVG(width, height))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;If I use the 'scatter' chart type, works fine but I don't get the nice line thru the data...&amp;nbsp; so I don't think it's the data or csv format.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcPro 3.0.2&lt;/P&gt;&lt;P&gt;CODE (running in a simple windows cmd window via C:\Users\fspataro\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\python.exe):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
out_svg_file = r"T:\scratch\analysis2\test.svg"
temp_csv_file = r"T:\scratch\analysis2\test.csv"
c = arcpy.charts.Line(x='X', y='Y', dataSource=temp_csv_file)
c.exportToSVG(out_svg_file, width=400, height=400)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA (save as test.csv):&lt;/P&gt;&lt;P&gt;X,Y&lt;BR /&gt;0.00,8.32&lt;BR /&gt;3.27,8.66&lt;BR /&gt;6.54,9.06&lt;BR /&gt;9.81,9.44&lt;BR /&gt;13.08,9.86&lt;BR /&gt;16.35,10.38&lt;BR /&gt;19.62,11.02&lt;BR /&gt;22.89,11.74&lt;BR /&gt;26.17,12.67&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 00:22:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1245909#M66426</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2023-01-06T00:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1245996#M66433</link>
      <description>&lt;P&gt;Pretty strange stuff, but if you convert the csv table to a dbf and pass that to the chart.Line method by using the path, it works.&amp;nbsp; It doesn't work if you assign the result of the arcpy.conversion.TableToTable method to a variable for the dataSource, (demonstrated below) BUT will work if you use the path string:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.conversion.TableToTable(temp_csv_file, r'T:\scratch\analysis2', 'tble')
c = arcpy.charts.Line(x='X', y='Y', dataSource=r'T:\scratch\analysis2\tble.dbf')
c.exportToSVG(out_svg_file, width=400, height=400)&lt;/LI-CODE&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="Screenshot 2023-01-06 070405.png" style="width: 395px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59863i865235EC74E4D267/image-dimensions/395x368?v=v2" width="395" height="368" role="button" title="Screenshot 2023-01-06 070405.png" alt="Screenshot 2023-01-06 070405.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying the result path assignment:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;tble = arcpy.conversion.TableToTable(temp_csv_file, r'C:\GeoNet', 'tble')
c = arcpy.charts.Line(x='X', y='Y', dataSource=tble)&lt;/LI-CODE&gt;&lt;P&gt;RuntimeError: dataSource: Valid layer, table or path to a dataset expected. Provided value: C:\GeoNet\tble.dbf .&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 14:08:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1245996#M66433</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-01-06T14:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246116#M66439</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole chart dataSource things is really odd... It works fine with a 'FeatureLayer' if you're running the code inside the ArcPro py window but standalone code with arcpy.MakeFeatureLayer doesn't work --- full on 'blow up' of the process.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did add the 'aggregation='min' on the constructor and got some sort of result but it was a bit off...&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to submit a bug on this and see what tech-support says.&amp;nbsp; I'll report back on the findings.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 18:07:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246116#M66439</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2023-01-06T18:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246613#M66480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/11168"&gt;@FredSpataro&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for reporting this! I can reproduce the crash with the code you've posted using your data saved to a CSV. I'm logging an internal issue, but please feel free to submit a bug to technical support if you wish to track the progress.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code you posted should work without explicitly setting an `aggregation` in the constructor (this should just draw an unaggregated line chart), but it looks like you also tried setting `aggregation='min'` and that was also not drawing the chart how you expected. I tried with the following code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;c = arcpy.charts.Line(x='X', y='Y', aggregation='min', dataSource=r'c:\temp\test.csv')
c.exportToSVG(r'c:\temp\test.svg')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And it looks like the chart rendered as expected:&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="callen_esri_0-1673298472185.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60012i62C946DB68F85D75/image-size/medium?v=v2&amp;amp;px=400" role="button" title="callen_esri_0-1673298472185.png" alt="callen_esri_0-1673298472185.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if you are seeing the chart draw incorrectly when setting `aggregation='min'`, could you please post a screenshot if possible?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:10:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246613#M66480</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2023-01-09T21:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246807#M66489</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/485810"&gt;@ChristopherAllen&lt;/a&gt;&amp;nbsp;Thanks for the verification.&amp;nbsp; The 'aggregation=min' chart looks good when I use the full data.&amp;nbsp; Looks like I was tinkering and had converted the values to integers to see if 'doubles' were the cause...this produced non-unique values and then the aggregation kicked in and made the chart a bit off.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 15:17:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246807#M66489</guid>
      <dc:creator>FredSpataro</dc:creator>
      <dc:date>2023-01-10T15:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246911#M66492</link>
      <description>&lt;P&gt;Great, thanks for following up! Glad to hear that it works when setting an aggregation, but we will address the bug you reported when no aggregation is set (ie, when the chart is unaggregated).&lt;/P&gt;&lt;P&gt;Take care,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 17:58:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1246911#M66492</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2023-01-10T17:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1247939#M66530</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/11168"&gt;@FredSpataro&lt;/a&gt;&amp;nbsp;,&amp;nbsp;I just wanted to follow up to let you know that this will be fixed in the upcoming Pro 3.1 release. Thanks again for reporting!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 03:07:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1247939#M66530</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2023-01-13T03:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248196#M66550</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You're correct, the second example is failing because `tble` is a `Result` object rather than the path. The following should work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;c = arcpy.charts.Line(x='X', y='Y', dataSource=str(tble))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 19:35:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248196#M66550</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2023-01-13T19:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248204#M66552</link>
      <description>&lt;P&gt;That is understandable to convert it to string first, but odd and mildly frustrating that the error message from the RuntimeError includes the valid path and on the surface, is a bit misleading. We know that the path info is there from the Result object, but it is not being parsed under the hood for the process, but is for the error.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 19:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248204#M66552</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-01-13T19:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.charts.Line fails with simple csv</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248219#M66558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous User&amp;nbsp;, I completely understand your confusion with respect to the error message. We will look into either improving the error message or possibly accepting `Result` objects as a valid `dataSource` argument.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take care,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 20:17:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-charts-line-fails-with-simple-csv/m-p/1248219#M66558</guid>
      <dc:creator>ChristopherAllen</dc:creator>
      <dc:date>2023-01-13T20:17:21Z</dc:date>
    </item>
  </channel>
</rss>

