RainbowStats™ · Command reference
LINE_CHART — Time-Series Lines
Plot one or more series against time on a shared vertical scale.
LINE_CHART builds a line chart from individual data series, data-series lists, or a mixture of both. Use it to compare levels, rates, changes and model-derived series that can be interpreted on the same scale.
Quick start: unemployment and U-6
LINE_CHART(SERIES_SINCE(UNRATE,20010101),SERIES_SINCE(U6RATE,20010101))Run this example in RainbowStats
This plots two monthly labor-market rates from January 2001 onward on the same vertical scale. Both source series are expressed in percent.
LINE_CHART(x,y) directly. Wrapping the series in LIST(x,y) is optional.Syntax, list support and aliases
LINE_CHART(series)
LINE_CHART(series1,series2,...)
LINE_CHART(seriesList)
LINE_CHART(series1,seriesList,...)| Input form | Behavior |
|---|---|
| One series | Plots that series as one line. |
| Several series | Adds each series to the chart in argument order. |
| One data-series list | Adds the list’s members as separate lines. |
| Series and lists together | Collects individual series and flattens the supplied lists into the chart. |
LINE_GRAPH and LINECHART are registered aliases. The command returns a chart object, which can be displayed directly, titled with SET_TITLE, or included in SLIDESHOW.
The dispatcher collects series and lists only. Other object types are skipped; if no valid series are collected, it returns an explanatory message. Do not pass a chart, regression object, title string or numeric option as though it were a data series.
Shared axes and meaningful comparisons
The horizontal axis represents dates. Tested results place all input series on the left vertical axis using a shared linear scale. Different series keep their source values; the chart does not automatically standardize, rebase or convert their units.
| Comparison | Recommended approach |
|---|---|
| Rates or values with compatible units | Use LINE_CHART to compare their levels on one scale. |
| Variables with different units or very different magnitudes | Consider DUAL_LINE_CHART for exactly two series, with clear axis labels. |
| Changes or growth rates | Transform each input deliberately with DIFF or LOGDIFF before charting. |
| A relationship between two variables | Consider POLY_SCATTER or a regression. A line chart shows timing, not an estimated relationship. |
A much larger series can compress a smaller series visually. A shared axis is useful only when the values are intended to be read together on that scale.
Examples: lists, transformations and model output
Chart one series
LINE_CHART(SERIES_SINCE(UNRATE,20010101))Use a data-series list
rates = LIST(SERIES_SINCE(UNRATE,20010101),SERIES_SINCE(U6RATE,20010101))
LINE_CHART(rates)Combine a series with a list
u = SERIES_SINCE(UNRATE,20010101)
other = LIST(SERIES_SINCE(U6RATE,20010101),SERIES_SINCE(JTSJOR,20010101))
LINE_CHART(u,other)This produces three lines. Each value remains in its source units; the three rates also have different economic definitions and denominators.
Compare monthly percentage-point changes
u = SET_UNITS(SET_NAME(DIFF(SERIES_SINCE(UNRATE,20010101)),"Unemployment-rate change"),"Percentage points")
v = SET_UNITS(SET_NAME(DIFF(SERIES_SINCE(JTSJOR,20010101)),"Job-openings-rate change"),"Percentage points")
LINE_CHART(u,v)Chart a regression residual series
r = REGRESSION(LIST(SERIES_SINCE(UNRATE,20010101),SERIES_SINCE(U6RATE,20010101)))
LINE_CHART(EXTRACT(r,"residuals"))residuals returns a series suitable for LINE_CHART. An extract such as actualvsfitted already returns a chart and should be displayed directly.
Set the title, series names and units
u = SET_NAME(SERIES_SINCE(UNRATE,20010101),"Unemployment rate")
v = SET_NAME(SERIES_SINCE(JTSJOR,20010101),"Job openings rate")
c = LINE_CHART(u,v)
SET_TITLE(c,"U.S. unemployment and job openings")Use SET_NAME on each input series before building the chart to give the lines readable names. Use SET_UNITS on the input when its transformed values need an accurate units label.
SET_UNITS(x,"Percent") changes metadata, not the values. For raw log changes expressed in percent, multiply by 100 before assigning the label.The supplied builder gives an untitled-by-user chart a default such as “Chart of 2.” Use SET_TITLE for a descriptive heading rather than adding a title as a positional argument to LINE_CHART.
Working with the data
- Choose the sample explicitly. Apply
SERIES_SINCEorSERIES_BETWEENbefore charting. - Check dates and gaps. The command does not impose a missing-data completeness rule. A connected line across a gap does not establish observations on intervening dates.
- Match frequency deliberately. A common chart can contain daily and monthly series, but this does not aggregate, interpolate or synchronize them. Use an explicit frequency-conversion rule when needed.
- Inspect units and scale. Rates, percentage-point changes, log changes, price levels and index values are different quantities.
- Return the chart last. In an MCP script, put the chart variable or chart-producing expression on the final line to display it.