|
Click here to skip over examples
EXAMPLE 1 - Dates
pl -prefab chron data=data14 x=1 y=2 datefmt=yy/mm/dd xinc="1 month" \
stubfmt=M xyears=yyyy yrange="0 25" barwidth=line color=red \
title="# hits per day" omitweekends=yes
The data14 file:
00/12/21 1
00/12/22 1
00/12/23 2
00/12/27 1
...etc.
EXAMPLE 2 - Dates - tabulated by week
pl -prefab chron data=data14 x=1 y=2 datefmt=yy/mm/dd xinc="1 month" \
stubfmt=M xyears=yyyy color=green tab=week title="# hits per week"
EXAMPLE 3 - Dates - tabulated by week
pl -prefab chron data=data19 x=2 y=1 datefmt=mmddyy xinc="1 month" \
stubfmt=M xyears=yyyy color=green tab=week include2=annot \
title="# website visitors per week" rectangle="1 1 4 2.5" ygrid=yes \
mode=line step=yes fill=red
The data19 file:
18 071301
16 071401
15 071501
34 071601
...etc.
In the above example, notice that rectangle (new in 2.02) was used to set a smaller
size, and a file containing script code for the annotation is included.
EXAMPLE 4 - Dates - tabulated by month
pl -prefab chron data=data14 x=1 y=2 datefmt=yy/mm/dd xinc="1 month" \
stubfmt=M xyears=yyyy color=powderblue tab=month tabmode=first \
nearest=month barwidth=0.2 curve=yes
EXAMPLE 5 - Datetimes - tabulated by hour
pl -prefab chron data=data16 x=1 tab=hour datefmt=yy/mm/dd xinc="1 day" \
barwidth=line stubfmt=MMMdd unittype=datetime timefld=2 \
title="# hits per hour"
The data16 file:
01/09/05 09:43:35
01/09/05 09:43:40
01/09/05 13:15:00
01/09/05 13:15:11
...etc.
Note that a file such as this (data13) could also be used, and timefld
would not need to specified:
01/09/05.09:43:35
01/09/05.09:43:40
01/09/05.13:15:00
01/09/05.13:15:11
..etc.
EXAMPLE 6 - Times - tabulated by hour
pl -prefab chron data=data15 x=1 tab=hour unittype=time xinc="1 hour" \
nearest=hour barwidth=0.2 stubfmt=HHA \
title="# events per hour" color=coral
The data15 file:
07:47:49
07:47:52
07:47:54
..etc.
EXAMPLE 7 - hourly temperature readings plotted for one week
pl -prefab chron data=data22 header=yes x=1 y=2 datefmt=mm/dd/yyyy \
xinc="1 day" mode=line unittype=datetime title="temperatures this week"
The data22 file has data for one week and begins like this:
datetime temp
12/08/2002.00:00 22
12/08/2002.06:00 24
12/08/2002.12:00 31
12/10/2002.00:00 30
How to run these examples
DESCRIPTION
chron is a
prefab
for plotting chronological data.
Data may be expressed as
dates
,
times
(seconds portion is optional)
,
or a combination of date and time called
datetime
.
chron can produce bar or line plots, and can plot explicit values or
tabulate by week, month, day, hour, etc.
Time is shown along the X axis.
The data file must be in chronological order.
PARAMETERS
-
-
Standard prefab parameters
are all supported except err.
data and x are always required.
Data field x must contain dates, times, or datetimes.
Data field y may contain values.
xinc supports
constructs
such as "1 month"; if only a
number is given, it is assumed to be days (the default for xinc is 7 days).
-
-
unittype specifies the type of chronological scaling.
Default is date. Allowable values are time, datetime and
datetime
.
-
-
mode is either bars (the default) or line.
-
-
datefmt is the
date format
you are using. This must be specified unless
using the default format (as set in a
config file
, otherwise mmddyy).
If plotting datetime values, datefmt specifies only the date portion.
If plotting time values, datefmt is ignored.
-
-
stubfmt is the
date format
or
time format
to be used for X axis stubs.
The defaults are MMMdd (date) and HHa (time).
You can use stubvert=yes to render stubs vertically.
-
-
xyears allows years to be displayed along X axis below date X stubs.
Use yy for 2 digit year eg 01, yyy for eg '01, and yyyy
for eg 2001.
-
-
omitweekends may be specified as yes to allow the graph to be
drawn such that Friday is followed immediately by Monday. Any data points
falling on a Saturday or Sunday are silently adjusted to the nearest weekday.
-
-
tab tabulates data
by hour, day, week, month, quarter-year, or year.
If a y data field is being used, the y values will be totaled;
otherwise, instances will be counted.
Tabulation is done by internally adjusting dates and then counting.
-
-
tabmode is used with tab.
Allowable values are mid and first (default is mid).
mid causes tabulations to be based on a date or time in the
middle of the interval; for first the beginning of the interval is used.
mid is appropriate for some types
of plots while first is better for others.
-
-
timefld specifies a
data field
that holds time values.
When doing tabulations, this parameter may be used to indicate
that the time and date will be in two separate fields
(normally when plotting
datetimes
the date and time is combined into one data field, separated by a period).
-
-
nearest may be used to specify cutoffs for automatic scaling in X.
For example, nearest=month would cause X min and max to fall on
month boundaries.
Allowable values are hour, day, month, quarter, and year.
-
-
curve may be specified as yes or as a
linedetails value
, and causes a moving average curve to be fit and drawn. order
(default = 5) may be used to control the number of points considered when
computing the moving average curve (higher value = smoother curve).
If mode is bars:
-
-
barwidth controls the width of bars
This is a value in inches,
or may be given as line for very thin bars.
-
-
color controls the
color
of bars, if mode=bars.
-
-
crossover may be specified as the value in Y where bars begin
to point downward instead of upward. For instance, crossover=0
is often useful when dealing with financial income, to show loss
using downward bars.
If mode is line:
-
-
linedet controls the
appearance
of the line, if mode=line.
-
-
step may be given as yes to get a stairstep line.
-
-
fill may be given as a
color
, resulting in the area under the line being filled.
-
-
gapmissing may be specified as yes or small.
If yes, missing data will cause a gap in the line (normally
the line connects plottable points without a gap). small is
the same as yes except that it leaves a small overhang.
Note: Because filter processing is applied to data as they are read,
tabulate cannot be set from within the data file.
If tabulate is used, x, y and datefmt cannot
be set from within the data file.
|
data display engine
Copyright Steve Grubb
|