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|falsehorizontalAxisPosition:bottom|top|both(defaultbottom)nonEodLabelWithDate: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
Scale.Getreadsscalefrom the main axis.Scale.Updatescaleapplies to all axes in the main pane.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).horizontalAxisPositionsetsdisplay.xAxis.position. The top strip appears above all chart panes, inside the chart below any host toolbar. Inbothmode, tick labels, crosshair dates, and annotation dates appear on both strips and share the same time scale. Hiding the X axis hides both strips.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 },});Show the time axis at both edges:
chart.change({ id: "Scale", context: { horizontalAxisPosition: "both" },});