Working with date/time data in Grapher

Grapher has the capability to generate a graph using data associated with dates, times, or both. When the data in the worksheet is stored in date/time format, Grapher will typically recognize the format and generate the axis displaying the dates. By default, Grapher adheres to your Windows locale setting, but you can customize the date/time formats. Furthermore, you can customize the date/time formats on your data and graph axis.

 

Topics covered in this article:

Modify date/time formatting, including non-English labels

Combining separate date time columns

Keep date/time format from reverting to numbers or text

Displaying Numeric Values as Dates

Creating date/time axes

Setting the date/time interval on an axis

Graphing numeric values as dates

Golden Discoveries (Blog)

 

Modify date/time formatting, including non-English labels

Grapher automatically adjusts your plot date/time formats according to your Windows system locale language. Additionally, you can manually set the date/time format to any preferred language. If the custom date/time format used is not recognized by Grapher or if you wish to modify the date/time formatting or interval, follow these steps:

  1. Select the axis.
  2. In the Property Manager window, click on Labels.
  3. Click the Expand Button next to the General section to expand it, if necessary.
  4. In the General section, in the Use date/time format field make sure the box is checked.
  5. In the General section, in the Major label date/time format field click the Select button.
  6. The Date/Time Format Builder window will pop up.
    1. Select the appropriate language in the Language (Country) list and click Insert. For instance, German (Germany) - [$407].
    2. Select the appropriate Predefined date/time formats option and click Insert.
    3. If the format you want is not listed, type it manually in the Date/Time format (edit to change) box (e.g., MMMM).
    4. Click OK and the date/time format is displayed on the axis.

Combining separate date time columns

Many programs format data files with time, date, and plotting value in separate columns. When all times are from the same date, the time column suffices for graphing. However, for multiple days, combining date and time into one column is necessary for accurate graph display. Within Grapher, you have the option to combine the date and time columns and place the outcome in a new column.
  1. In the Object Manager window, right-click on your data layer and select Display Worksheet.
  2. Note your Date column, Time column, and the first/last rows to be combined.
  3. Click Data Tools | Data | Transform.
  4. In the Transform window:
    1. In the Transform with: dropdown select Column variables (e.g., C = A + B).
    2. Enter your Transform equation (e.g., D=A+B).
    3. Fill in the First row and Last row.
    4. Click OK.
  5. Format the new column: Select it, click Data Tools | Format | Format Cells, and set the Type to Date/Time.

Keep date/time format from reverting to numbers or text

Grapher can read dates and times in data files, but some formats, like BLN, don't support date/time formatting in worksheets. If your data is saved to a BLN file, follow these steps to preserve your formatting:

  1. Click File | Open in Grapher and select the file.
  2. Highlight the column that should be date/time format.
  3. Click Data Tools | Data | Text to Number to convert text.
  4. Click Data Tools | Format | Format Cells.
  5. Set Type to Date/Time and choose the desired format. Click OK.
  6. Click File | Save As and change the Save as type to DAT, XLS, or XLSX.

Displaying Numeric Values as Dates

The number 1 can symbolize any date or time, and the increment is flexible. For example, the value 2 can refer to the next day if you’re using a serial date format, or an entirely different time interval. In the example below, value 1 represents January 1, 2012, and the value 2 represents January 2, 2012.

Numeric numeric dates example
The dates in the left column are in custom numeric format.

Creating date/time axes

To create a graph from date/time data, click Graphs | Create | <category> | <plot type>. Select the data file and click Open. The axis will automatically be in date/time format.

Setting the date/time interval on an axis

  1. In the Property Manager, select the date/time axis.
  2. Click on the Ticks tab.
  3. In Major Ticks, check Use date/time spacing.
  4. Click the Every Year button next to Date/time spacing.
  5. In the Date/Time Spacing window, set your desired interval (e.g., 3 Months for quarterly).
  6. Click OK.

Graphing numeric values as dates

You can create a graph that displays date/time labels on your axis even when your data contains numeric values. To convert the numbers to dates:

  1. Select the axis in the Object Manager.
  2. In the Property Manager, click the Labels tab.
  3. Set the Label source to Numeric date/time.
  4. Click Set next to Date/time settings.
  5. In the Date/Time Labels dialog:
    1. Set the Axis value (e.g., 1) and the corresponding Date (e.g., 1/1/2012).
    2. Set the Axis increment and Corresponding time increment (e.g., Day).
    3. Click Set date/time format and choose your preferred style (e.g., MMM-dd).
    4. Click OK.

Date/time axis values

Golden Discoveries (Blog)

Was this article helpful?
...

Comments

0 comments

Please sign in to leave a comment.