Plot action
Use this action with change({ id: 'Plot', context }).
Context
Key fields:
id:Add|Get|Delete|Update- selectors:
main,uid,index,type - payload fields (sub-action/type dependent):
- creation keys:
studyId,fundamentalId,symbol,expression,seasonal - update keys:
forward,seasonal,expression,symbol,frequency,visible,precision,showPrevious - style/data keys:
inputs,curves,offsets,levels,bands,basis - placement keys:
placement,paneIndex,oppositeScale,cloneUid,cloneIndex
- creation keys:
Behavior
Plot is a multi-action API for creating and maintaining chart plots.
Sub-actions
Get
Returns plot data without changing chart state.
- Use
main: trueto retrieve the main plot. - You can target a specific plot by
uid(preferred) orindex. - Returned items are normalized plot objects that include identity/location metadata (
uid,index,paneIndex,axisIndex), display metadata (title), and plot-specific state. - The
curvesshape matches taxonomy defaults (getTaxonomy) andstudies.lst.json.
Delete
Removes one or more plots.
- Identify by
uid(preferred) or byindex(typically withtype). - Delete requests are coalesced and executed in one batch.
- After deletion, plot indexes can shift. Refresh plot data with
Getbefore using index-based calls again.
Add
Adds new plots.
- Supported add types:
Study(requiresstudyId)IncomeStatement/BalanceSheet(requiresfundamentalId)Expression(requiresexpression)Symbol(requiressymbol)Seasonal(requiresseasonal)
uidis generated by chart and cannot be supplied.Symbol/Expression/Seasonalcan target pane/axis withpaneIndexandoppositeScale.Seasonaldefaults tooffsets: [0]when offsets are not provided.Studysupportsinputs,curves,levels,bands,basis, andplacement.
Study basis options:
- Omit
basis(or setbasis: { kind: 'main' }) to base the study on the main plot. - Use
basis: { kind: 'seasonal', uid, offset }to base the study on a seasonal plot curve.
basis examples:
// Main basis (default)chart.change({ id: "Plot", context: { id: "Add", type: "Study", studyId: "MA", basis: { kind: "main" }, },});// Non-main basis: specific seasonal plot + seasonal offsetchart.change({ id: "Plot", context: { id: "Add", type: "Study", studyId: "MA", basis: { kind: "seasonal", uid: "<seasonal-plot-uid>", offset: 0, }, },});Notes:
- Today, the only non-main study basis is
seasonal. uidmust reference an existing seasonal plot andoffsetmust exist in that seasonal plot.- Some studies cannot be based on seasonal plots; incompatible basis/plot combinations are rejected.
Study placement options:
undefined: use study defaults (overlayorstandalone)overlay: place on main axisstandalone: create a new pane and axiswithMain: main pane with a secondary axisclone: clone placement from existing study (cloneUidpreferred;cloneIndexalso supported)
Update
Updates an existing plot.
- Identify by
uid(preferred),index, ormain: true. - Supports updating visibility (
visible) and precision (precision). - Supports updating inputs, expressions, symbols, forwards, seasonals, basis, placement, offsets, and curves.
- For fundamentals, supports
frequencyupdates. - For most plots, curve count must match existing curve count.
fieldsin curve definitions are not updated and can be omitted.showPreviousapplies to the main symbol/expression plot update path.
Main-plot curve notes:
- For
OHLCandCandlestick,attributesare meaningful. - If omitted,
OHLCuses a single color. Candlestickdefaults toOpenVsCloseif not set.
Forward/seasonal notes:
- Forward
offsetsare in days. - Seasonal
offsetsare in years. - If a seasonal update provides
Noffsets andN+1curves, the last curve is treated as average; matching counts means no average curve. - For forward and seasonal plots, use
Linestyle curves.
Study update notes:
placementcan move a study between overlay/standalone/withMain/clone placements.detachedScale: trueenables detached scale for the study.
For details on curve.zones, levels, and bands, see Study taxonomy.