Compare action
Use this action with change({ id: 'Compare', context }).
Context
id?:Get|Update(Updateis assumed if omitted)plots: array of comparison plotstype:Symbol|Expression|SeasonalsymbolwhentypeisSymbolexpressionwhentypeisExpressionseasonalwhentypeisSeasonaloppositeScale:true|false(leftScaleis still accepted but deprecated)curves: optional curve overrides
symbols: deprecated compatibility alias for symbol-only compare listalignOnExpirations:true|false
Behavior
Configures comparison plots against the main plot.
- Supports symbol, expression, and seasonal comparison plots.
- Existing comparison plots are replaced by the incoming
plotslist. - By default, comparison plots share the main axis.
oppositeScale: trueputs a plot on the secondary/opposite axis.- If
curvesis omitted, comparison plots render as lines with automatic colors. - Curve values are merged with defaults, so partial overrides are fine.
alignOnExpirations: trueoverlays eligible non-seasonal plots (mainly futures) as if they traded in the same year; the tooltip still shows actual trade dates.- Seasonal comparison plots align internally, so
alignOnExpirationsdoes not control seasonal alignment.
Get returns the same top-level shape (plots, alignOnExpirations).
Compatibility note: returned plot axis side uses leftScale naming (legacy alias for opposite/secondary axis).
Example:
chart.change({ id: "Compare", context: { plots: [ { type: "Symbol", symbol: "AAPL" }, { type: "Seasonal", seasonal: "CLM24", oppositeScale: true }, ], alignOnExpirations: true, },});