RainbowStats™ · Command reference
DUAL_LINE_CHART — Two Vertical Axes
Compare two time series using separate left and right scales.
DUAL_LINE_CHART places the first input series on the left vertical axis and the second on the right. Use it when exactly two series have different units or magnitudes and their timing is worth comparing.
Quick start: unemployment and payroll employment
DUAL_LINE_CHART(SERIES_SINCE(UNRATE,20010101),SERIES_SINCE(PAYEMS,20010101))Run this example in RainbowStats
The unemployment rate uses the left axis in percent. Payroll employment uses the right axis in thousands of persons. Both series begin in January 2001.
Syntax, two-series lists and alias
DUAL_LINE_CHART(leftSeries,rightSeries)
DUAL_LINE_CHART(LIST(leftSeries,rightSeries))
DUAL_CHART(leftSeries,rightSeries)| Form | Requirement |
|---|---|
| Two arguments | Both arguments must be individual series. |
| One argument | A data-series list containing exactly two series. |
DUAL_CHART | Registered alias for DUAL_LINE_CHART. |
The command returns a line-chart object. It accepts no positional title argument and no arbitrary collection of more than two series.
Date-range behavior differs by form
For the one-list form, the dispatcher calls getSameDateRange() before constructing the chart. In the two-series form, it uses the two input series directly without that explicit common-range call. Apply date selection or alignment yourself when an identical comparison sample is important.
A shared date range alone does not imply identical observation dates, data frequency or complete coverage. Neither form automatically aggregates the input series.
Read each line against its own axis
| Element | Source |
|---|---|
| Horizontal axis | Observation dates. |
| Left vertical axis | The first input series, with its units label. |
| Right vertical axis | The second input series, with its units label. |
| Scales | Separate linear vertical scales in the supplied implementation. |
| Default title | First series name followed by “vs” and the second series name. |
Compare turning points and timing, then read magnitudes using the correct axis. Separate scales make differently sized series visible, but they do not make their numerical levels directly comparable.
For two series with compatible units and a meaningful common scale, LINE_CHART can make the comparison easier to interpret.
Examples: list input and explicit frequency matching
Use a two-series list
u = SERIES_SINCE(UNRATE,20010101)
p = SERIES_SINCE(PAYEMS,20010101)
DUAL_LINE_CHART(LIST(u,p))Compare a monthly yield average with an employment rate
yield = AGGREGATE_TO_PERIOD(SERIES_SINCE(DGS10,20010101),MONTHLY,MEAN)
u = SERIES_SINCE(UNRATE,20010101)
DUAL_LINE_CHART(yield,u)This explicitly averages daily Treasury yields within each month. The unemployment series is already monthly. Check the resulting date labels before interpreting exact timing: a monthly aggregate can retain a different observation date from the unemployment series.
Compare quantities with different units
payroll = SET_NAME(SERIES_SINCE(PAYEMS,20010101),"Payroll employment")
production = SET_NAME(SERIES_SINCE(INDPRO,20010101),"Industrial production index")
c = DUAL_LINE_CHART(payroll,production)
SET_TITLE(c,"Employment and industrial production")Employment uses the left scale and production the right. These are levels in different units, not percentage growth rates.
Make names, units and title explicit
left = SET_NAME(SERIES_SINCE(UNRATE,20010101),"Unemployment rate — left axis")
right = SET_NAME(SERIES_SINCE(PAYEMS,20010101),"Payroll employment — right axis")
c = DUAL_LINE_CHART(left,right)
SET_TITLE(c,"U.S. unemployment and payroll employment")Set readable series names before charting. Axis labels come from the corresponding input series’ units. Use SET_UNITS before chart construction if a transformation makes the inherited label inaccurate.
For example, after differencing unemployment, the values represent percentage-point changes. After multiplying fractional log changes by 100, label them as percent log changes. Changing a label alone does not transform the numbers.
Working with the data and common errors
| Issue | What to check |
|---|---|
| Three or more series | Use a shared-scale LINE_CHART, separate charts or a slideshow. This command assigns one series to each side. |
| One list with the wrong size | The list must contain exactly two series. |
| Two arguments containing lists or charts | The two-argument form requires individual series. Extract or select the data series first. |
| Unexpected axis assignment | Check argument order. The renderer’s internal drawing order does not change first-input-left and second-input-right. |
| Different date coverage | Select an intended sample before charting. The list form explicitly applies a common-range operation; the two-series form does not. |
| Different frequencies | Choose appropriate aggregation before comparing exact period movements. Charting does not resample. |
- Inspect source gaps. Lines can connect across missing dates; visual continuity does not establish continuous observations.
- Keep both axes visible and labeled. Interpretation depends on knowing which series uses each scale.
- Check economic meaning. Similar time patterns do not by themselves establish causality, a hedge ratio or forecast usefulness.
- Display the final chart. End an MCP script with the chart variable or chart-producing expression.