Skip to content

Scale action

Use this action with change({ id: 'Scale', context }).

Context

  • id?: Get | Update (Update is assumed if omitted)
  • scale: Linear (same as undefined) or Logarithmic
  • marginBars: number of right-margin bars on the time axis
  • minPadding: deprecated compatibility input, ignored
  • maxPadding: deprecated compatibility input, ignored
  • preventLabelOverlap: true | false (deprecated compatibility alias for vertical overlap)
  • preventVerticalLabelOverlap: true | false
  • preventHorizontalLabelOverlap: true | false
  • includePercentChangeWithLastValue: true | false
  • snapAnnotationsToPrices: true | false
  • primaryOnTheLeft: true | false
  • nonEodLabelWithDate: true | false
  • ordinalName: string
  • labels: array of axis-label updates
    • item shape: { axis: 'vertical', text, index, paneIndex? }
  • contractTransition: line-style object (enabled, color, dashStyle, width, fillColor)
  • cycleTransition: line-style object (enabled, color, dashStyle, width, fillColor)

Behavior

  • scale applies to the main price axis only.
  • marginBars sets right margin in bars (not pixels), default 0.
  • preventLabelOverlap and preventVerticalLabelOverlap apply to the Y axis only.
  • preventHorizontalLabelOverlap applies to the X axis only.
  • snapAnnotationsToPrices applies to the Y axis only and snaps annotation points to the nearest visible price on the main plot.
  • primaryOnTheLeft controls the visual side of the primary Y axis (false = right side, true = left side).
  • nonEodLabelWithDate and ordinalName apply to X-axis labeling.
  • labels updates per-axis labels by axis index (optionally scoped by paneIndex).
  • contractTransition and cycleTransition update transition-line styling on the X axis.

Sub-actions

Get

Returns current scale/axis settings.

Parity notes:

  • Get mirrors most updateable scale state.
  • minPadding and maxPadding are compatibility inputs only (ignored) and are not part of returned state.
  • labels is write-only label-update input and is not returned by Get.
  • preventLabelOverlap is 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 },
});