DateTimeYChart



    PLOT DATETIMEYCHART
        X,RED LINE
      WITH
        TITLE CENTER "Big Trees Gaging Station"
        TITLE Y "Discharge, CFS"
        GRIDLINES
        SCALE X "2009-02-25" "2009-04-26" 14 days
        FORMAT X "%m-%d"
        LABELANGLE 0
    SELECT
        `datetime`, `02_00060`
        FROM UV;

The chart above is a plot of stream flow on the San Lorenzo River measured at the entrance to Hentry Cowell Park in Felton, CA. The script uses DATETIMEYCHART to plot stream flow against the logged times. This type of chart is especially useful when measurements have been made at irregular intervals or when two measurements are made using different intervals and you are plotting their UNION.

Use SCALE X to set the time scale on the X axis:

    SCALE X (beginning) (ending) (increment)

Use SQL DATETIME constants for the beginning and ending times, eg. ‘2009-04-03′, and include a time unit, eg. DAYS, HOURS, YEARS, in the increment. Dates without times refer to time 00:00:00. Examples:

    SCALE X '2009-04-03' '2009-04-04" 6 HOURS
    SCALE X '2009-04-03 09:00' '2009-08 09:00" 12 HOURS
    SCALE X '2009-04-03 12:00' '2009-08 12:00" 4 HOURS
    SCALE X '2009-04-03 12:00' '2009-03 12:10" 5 MINUTES

Use FORMAT X to format labels on the X axis. The format should be a string, eg. “%m-%d”, builty from these components:

    %Y - four digit year
    %y - two digit year
    %m - month (00-12)
    %b - abbreviated month name (Jan-Dec)
    %d - day of the month (00-31)
    %H - hours 00-23
    %i - minutes 00-59
    %S - seconds 00-59
    %s - seconds 00-59

Use LABELANGLE to change the orientation of labels on the X axis:

    LABELANGLE (0 or 90)

You can also use DATETIMEYCHART to make time lines:


    PLOT DATETIMEYCHART
        X, LIGHT BLUE VERTICK, SIZE OVERRIDE
      WITH
        FOREGROUND GRAY
        SCALE Y 0 20 20
        SCALE X '2009-04-13 00:00:00'
          '2009-04-13 24:00:00' 2 HOURS
        NO YAXIS
        NO SIDES
        LABELANGLE 0
        FORMAT X "%H"
        PAGE FOURTH
    SELECT
        dtime, 10, 20
        FROM ACCESS
        WHERE DAY(dtime) = '13';

Comments are closed.