Scale action
Use this action with change({ id: 'Scale', context }).
Context
id?:Get|Update(Updateis assumed if omitted)scale:Linear(same asundefined) orLogarithmicmarginBars: number of right-margin bars on the time axisminPadding: deprecated compatibility input, ignoredmaxPadding: deprecated compatibility input, ignoredpreventLabelOverlap:true|false(deprecated compatibility alias for vertical overlap)preventVerticalLabelOverlap:true|falsepreventHorizontalLabelOverlap:true|falseincludePercentChangeWithLastValue:true|falsesnapAnnotationsToPrices:true|falseprimaryOnTheLeft:true|falsenonEodLabelWithDate:true|falseordinalName: stringlabels: array of axis-label updates- item shape:
{ axis: 'vertical', text, index, paneIndex? }
- item shape:
contractTransition: line-style object (enabled,color,dashStyle,width,fillColor)cycleTransition: line-style object (enabled,color,dashStyle,width,fillColor)
Behavior
scaleapplies to the main price axis only.marginBarssets right margin in bars (not pixels), default0.preventLabelOverlapandpreventVerticalLabelOverlapapply to the Y axis only.preventHorizontalLabelOverlapapplies to the X axis only.snapAnnotationsToPricesapplies to the Y axis only and snaps annotation points to the nearest visible price on the main plot.primaryOnTheLeftcontrols the visual side of the primary Y axis (false= right side,true= left side).nonEodLabelWithDateandordinalNameapply to X-axis labeling.labelsupdates per-axis labels by axis index (optionally scoped bypaneIndex).contractTransitionandcycleTransitionupdate transition-line styling on the X axis.
Sub-actions
Get
Returns current scale/axis settings.
Parity notes:
Getmirrors most updateable scale state.minPaddingandmaxPaddingare compatibility inputs only (ignored) and are not part of returned state.labelsis write-only label-update input and is not returned byGet.preventLabelOverlapis returned as a deprecated compatibility field.
Example:
const scaleState = chart.change({ id: "Scale", context: { id: "Get" },});Update
Updates one or more scale/axis settings.
Example:
chart.change({ id: "Scale", context: { primaryOnTheLeft: true },});