Home · Command reference

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.

Argument order sets the axes. First series: left. Second series: right. Reverse the arguments to exchange their axis assignments.

Syntax, two-series lists and alias

DUAL_LINE_CHART(leftSeries,rightSeries)
DUAL_LINE_CHART(LIST(leftSeries,rightSeries))
DUAL_CHART(leftSeries,rightSeries)
FormRequirement
Two argumentsBoth arguments must be individual series.
One argumentA data-series list containing exactly two series.
DUAL_CHARTRegistered 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

ElementSource
Horizontal axisObservation dates.
Left vertical axisThe first input series, with its units label.
Right vertical axisThe second input series, with its units label.
ScalesSeparate linear vertical scales in the supplied implementation.
Default titleFirst 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.

Crossings and visual slopes are scale-dependent. Two lines crossing does not mean their values are equal. Apparent closeness, steepness and co-movement can change with the axis ranges. Use correlation, a scatter plot or regression to quantify a relationship.

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

IssueWhat to check
Three or more seriesUse a shared-scale LINE_CHART, separate charts or a slideshow. This command assigns one series to each side.
One list with the wrong sizeThe list must contain exactly two series.
Two arguments containing lists or chartsThe two-argument form requires individual series. Extract or select the data series first.
Unexpected axis assignmentCheck argument order. The renderer’s internal drawing order does not change first-input-left and second-input-right.
Different date coverageSelect an intended sample before charting. The list form explicitly applies a common-range operation; the two-series form does not.
Different frequenciesChoose appropriate aggregation before comparing exact period movements. Charting does not resample.