## chron prefab

Version 2.32
Prefabs

Manual page for chron_prefab(PL)

View the chron prefab examples

chron is a prefab for plotting chronological data.`` Data may be expressed as dates, times, or a combination of date and time called datetime.`` chron can produce bar or line plots (1 to 4 bar sets or lines).`` It can also tabulate by week, month, day, hour, etc. (see the tab parameter).`` Time is shown along the X axis.`` The data file must be in chronological order.``

## Parameters

Prefab parameter name | Data type | Default | Description | Examples (ignore line wrapping)
Standard parameters |  |  | Any of the standard prefab parameters may be used. You must specify data (the name of the input data file). X axis stub format, increment, and range should use reasonable defaults automatically (versions 2.31+); if desired you can override the defaults by specifying xstubfmt, xinc, or xnearest explicitly.
x | data field | must be specified | Identifies the data field which contains dates, times, or datetimes. | `x=2 x=tdate`

y
y2
y3
y4

data field

y must be specified (except when tabulating)

Identifies the data field(s) that contain values to plot. If you're not tabulating (see below), y, y2, y3, and y4 are available to produce one, two, three, or four curves or bar sets, respectively, and all values must be numeric. If you are tabulating only one y is available, and it can contain alpha or numeric data.

`y=3
y=bp1 y2=bp2 y3=baseline`

datefmt | a date format | must be specified,unless plotting time values only. | Specifies the date notation present in the x field of your data. If plotting datetime values, specify only the date portion. | `datefmt=dd-mmm-yyyy`
err err2 err3 err4 | data field |  | Identifies the data field(s) that contain numeric error amounts, such as standard deviations, for the error bars. err2, err3, and err4 are available for producing error bars on additional curves or bar sets. | `err=5`
mode | `bars` or `line` | `bars` | Type of plot to render. | `type=line`
unittype | `date` or `time` or `datetime` | `date` | Specifies the type of chronological scaling, and should be the same as the datatype of your x field. Datetime with windowing specs can also be used here. | `unittype=datetime`

autoyears
automonths
autodays

`yes`
or
`format`

These may be used to automatically mark year, month, or day boundaries along the X axis. For example, if your X axis increment is months, you can use `autoyears=yes` to display the year below each year transition. You can specify `yes` or an appropriate display format. More information. Note: The old name for autoyears is xyears.

`autoyears=yes`
`automonths=Mmm`

omitweekends | `yes` or `no` | `no` | If `yes`, allows 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. | `omitweekends=yes`

tab

One of: `hour day week month quarter-year year`

If specified, data will be tabulated on week, month, etc. For example, if your data has a number of entries for June 10, 2003 you can use this to plot one bar showing the number of entries for that date. If a y data field is being used, the y values will be summated. If no y data field has been specified, instances (rows) will be counted. tab is incompatible with y2 .. 4 and ptselect. Note: tab (as well as related parameters x, y, datefmt) cannot be #set from within the data file.

`tab=week`

tabmode | `mid` or `first` | `mid` | This parameter is used with tab and influences how date adjustment will be done. `mid` causes dates/times to be adjusted to the middle of the interval. `first` causes dates/times to be adjusted to the beginning of the interval. | `tabmode=first`
timefld | data field |  | Specifies a data field that holds time values. Normally when plotting datetimes the date and time are combined into one data field, separated by a period (.), but you can use timefld to allow the date and the time to be in two separate fields. This parameter is available only with tab. | `timefld=ptime`
xnearest | One of: `hour day month quarter year` |  | This may be used to force X axis min and max to be located on round value boundaries. For example, `nearest=month` would cause X min and max to be located at month boundaries. Old name: nearest. | `xnearest=month`

xmargin

amount

When you are doing bars, chron may pad the X axis min and max. For example if your data are datetime and you are doing bars, it will add an extra day on either end. Sometimes this is what is desired, but if not, you can use `xmargin=0` to suppress this. You can also use this to add more padding at X axis min and max. amount is in days for date and datetime, and minutes for time.

`xmargin=0`

curve | `yes` or linedetails |  | Causes a moving average curve to be generating using the first set of data points (only). curve should not be confused with the lines being drawn with `mode=line`.. it is a completely separate operation. | `curve=" color=blue width=0.5"`
order | integer | `5` | This is an additional parameter that may be used to control the number of points considered when computing the moving average curve (higher value = smoother curve). | `order=10`

Parameters available when `mode=bars`
If more than one bar set is being rendered, bars will be clustered unless the stack parameter is specified.

Prefab parameter name | Data type | Default | Description | Examples (ignore line wrapping)
color color2 color3 color4 | color | `gray` | Specify bar color(s). | `color=dullyellow`
barwidth | width or `line` | based on data, single bars | Controls the width of bars. width is a value in inches or cm. Or, `line` may be specified to render very thin bars. Note: generally the default bar width is acceptable for single bars, but for clusters it usually must be specified explicitly.</td< <td>`barwidth=0.2 barwidth=line`
stack | `yes` or `no` | `no` | If `yes`, show stacked bars instead of bar clusters. Note: ptselect cannot be used with stacked bars. | `stack=yes`
outline | `yes` or linedetails |  | Outline the bars. | `"outline= color=pink"`
crossover | value in Y |  | This 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. | `crossover=0`

Parameters available when `mode=line`

Prefab parameter name | Data type | Default | Description | Examples (ignore line wrapping)
linedet linedet2 linedet3 linedet4 | linedetails | `width=1 color=black` | Controls the appearance of rendered line(s). If doing multiple lines you can specify `linedet2` without having to specify `linedet` (etc.) | `"linedet= color=red width=0.5"`
fill fill2 fill3 fill4 | color |  | If specified, the area under the line will be filled with the specified color. If doing multiple lines you can specify `fill2` without having to specify `fill` (etc.) | `fill=dullyellow`
step | `yes` or `no` | `no` | Render a stairstep line. Applies to all lines. | `step=yes`

gapmissing

`yes`
or
`small`

If `yes`, unplottable data values will trigger a gap to occur 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. Applies to all lines. Note that this doesn't detect data points that are simply omitted; a non-plottable value (such as a `NA` missing data code) must be present in the data.

`gapmissing=small`

lineclip | `yes` or `no` | `no` | If `yes`, the lineplot will be clipped to the plotting area. | `lineclip=yes`

data display engine
Copyright Steve Grubb

Markup created by unroff 1.0, `` `` August 23, 2005.