Select to view content in your preferred language

Scatter Plots and Date on X-axis

1220
4
05-10-2023 02:59 PM
JennaOlson
New Contributor

I am working on Charts in ArcGIS Pro 3.1.1.  I need to use a Scatter Plot so that I can produce a trend line and not have a line connecting all of my data points.  My X-axis needs to be a date, date is not a numeric variable so is unacceptable.  I then created a new table and changed my dates to a number type. The Chart is close to what I need, but I now need an arcade expression or formula that I can use that will allow my numerical date to display as a date.  Example: 33258 needs to display as 1/20/1991 on my axis label.  Or if anyone has any better suggestions, I'm all ears.

 

Thanks!

0 Kudos
4 Replies
DanielFox1
Esri Contributor

Hi @JennaOlson 

You can create a new field in your attribute table and ensure that you set the field to date (see screenshot below) then using calculate field use the following as shown below this will display the numeric date back into a readable date value and you can display the chart of this information. 

Original Date

DanielFox1_0-1683818158371.png

Add new Field that is Date but has a number format as numeric

DanielFox1_1-1683818215432.png

(for my example I used the calculate field to ensure a numeric date was placed in this field, referencing the original date) 

DanielFox1_3-1683818365454.png

DanielFox1_6-1683818615026.png

 

Create a new field for Date that has no number format 

DanielFox1_2-1683818282581.png

Using the same method of calculating field I made the new field = the previous field which has a numeric format.

DanielFox1_4-1683818438332.png

Highlighted below is the converted numeric field to a readable date 

DanielFox1_5-1683818476520.png

Then you should be able to use the new field on your axis. I hope this has helped. 

 

0 Kudos
JennaOlson
New Contributor

Thank you so much for the step-by-step.  I've tried a couple of time to follow, but Whenever it looks like a date in the field, Pro, defaults it to a Date format and cannot be used a an option for the X-axis.  Maybe I missed a step though.  In your example, DateDATE is the result, but in the screen shot previous, DateTest = DateTest.  Is there another step?  I jsut can't figure out how to get a Data Type of Date to have a Number Format of Numeric.  Thanks again though for the reply!

0 Kudos
DanielFox1
Esri Contributor

Hi @JennaOlson 

So the field DateTest was a new field created which I set to have a number format of numeric ( I made this field to show how the conversion works as the data had a correctly formatted date field)

DanielFox1_0-1683878298328.png

In order to get the date in this format I used the calculate field expression (below)

DanielFox1_1-1683878354255.png

Meaning the original date is equal to the new field (DateTest) and thus changing the format (not a readable date). To change this back I made another field (DateDATE) but without setting any number formats, then using the calculate field the DateDATE = DateTest which then changes the format back (to a readable date). (apologises I put in the incorrect screenshot before on my last post) 

For your data you should be able to make one field (ie.DateDATE) without a number format, ensuring you set the field to "date" You will need to only calculate this field once and this should convert over.

When you get the date in the correct format and you don't see it in the dropdown you can select the expression option and double-click the field for your axis. Below you can see what the chart looks like with the correct date field selected.

DanielFox1_4-1683879188096.png

I hope this clears up any confusion. 

 

 

 

0 Kudos
ChristopherAllen
Esri Contributor

Hi @JennaOlson ,

While it is currently not possible to build a scatter plot with a date field on the x-axis, we are taking this idea under consideration. If you would like to formally request this functionality, feel free to submit an ArcGIS Idea (see here for submission guidelines).

Take care,

Chris

0 Kudos