Display Non-standard Date/Time Formats (Convert Numbers to Dates) in Grapher’s Worksheet

You can create a graph that displays date/time labels on your axis when your data contains numeric values. But Grapher requires additional steps to convert numbers to dates.

Grapher’s worksheets store two major number types: standard sequential values and non-standard sequential values. This is true for all spreadsheet programs.
  • Standard sequential values are those with a certain start date and a standard incremental sequence.
  • Non-standard sequential values have start dates and increments that you, the user, define.

 

Displaying Numeric Values as Dates

The value 1 can represent any date/time, and the increment can be any time interval you specify. In this case, the value 2 can refer to the next day if you’re using a serial date format. Or, the value 2 can represent an entirely different time interval.

 

In the example below, value 1 (not shown) represents January 1, 2012, and the data gets collected every day. The value 2 then represents January 2, 2012; the value 3 represents January 3, 2012, and so on.

Can Grapher display date_time labels for non-standard date numbers in the worksheet_ (226629447)_non-standard_numeric_dates.png
The dates in the left column are in
custom numeric format. Grapher will
set the axis to numeric when creating the graph.

How to do this:

To create a graph from this data, select your two worksheet columns and click the Home | New Graph | Line/Scatter | Line Plot command. The X axis will be in numeric format.

Can Grapher display date_time labels for non-standard date numbers in the worksheet_ (226629447)_non-standard_number_axis.png
The X axis is automatically displayed with numbers instead of dates.

 

After the graph is created, the axis can be converted to dates. To convert the numbers to dates:

  1. Click on the X Axis 1 in the Object Manager to select it.
  2. In the Property Manager, click on the Labels tab.
  3. In the General section, verify that Use date/time format is unchecked.
  4. Set the Label source to Numeric date/time.
  5. Click the Set button next to Date/time settings.
  6. In the Date/Time Labels dialog:
    1. Set the Axis value to 1.
    2. Set the Date to 1/1/2012.
    3. Set the Time to 12:00:00 AM.
    4. Set the Axis increment to 1
    5. Set the Corresponding time increment to Day.
    6. Click the Set date/time format button and set the Language (Country) and Predefined date/time formats to the desired format, such as English (United States) - [$409] and MMM-dd. If a predefined format is not listed, you can type the desired format in the Date/Time format (edit to change) box. Click OK.
    7. Click OK.

The axis converts your numeric values to dates using the non-standard number sequence you defined.

Note: Your axis tick label format must be set in the Format option in the Date/Time Labels dialog above.

Formatting your tick labels in the Label Settings section of the Property Manager will not affect the axis. This is because your axis is using a non-standard number sequence instead of traditional date/time formatting.

X_Axis_date_time_values.png
The X axis is changed to display with date/time values.

Update Your Tick Mark Spacing

To change your tick mark spacing, adjust these settings in the Ticks tab of the Property Manager. Be sure to adjust your spacing based on your non-standard values, and not on Grapher's default date/time spacing. 

How to do this:

  1. Click on the X Axis 1 in the Object Manager to select it.
  2. In the Property Manager, click on the Ticks tab.
  3. Highlight the value next to Spacing and type the desired value. A week in this situation is equal to 7. So, type 7 and press ENTER on the keyboard to make the Spacing change. Then change the Divisions in the Minor Ticks section to 7, so one minor tick mark is 1 day. 

 

Updated April 2023

Was this article helpful?
2 out of 5 found this helpful

Comments

0 comments

Please sign in to leave a comment.