The baseline last supplied, or null if none (see setBaseline).
The declared range this scale is holding, or null. See setFixedRange.
Whether a real price range has been applied (see _scaled).
Recompute the visible range from data extremes + configured margins.
The range stays in price units in every mode, so the rebasing modes need no separate pass: their transform is affine with a positive scale factor, which maps a margin of 10% of the price span onto a margin of 10% of the percent span. Log is the one that pads in price space and shows it, which is long-standing behaviour and left alone here.
Format a price for axis/label display. While a rebase is in force the label is the rebased value, "+3.42%" or "103.42", and it outranks a custom price formatter: a currency prefix on a percent change would read as money that is not there. The formatter takes over again the moment the mode does.
Decimal precision implied by minMove (or the visible range if unset).
While a rebase is in force the labels are percent/index points, where a price tick size means nothing: precision comes from the transformed span instead, with two decimals as the floor traders expect of a percentage ("+3.42%") and more only when the visible band is tighter than that.
A scale carrying no tick is not quoting an instrument, so the span is all
there is to go on. That alone reads too coarse on a bounded oscillator: an
RSI spanning 0 to 100 implies a step of 1 and prints a whole-number ladder,
so a reading of 62.24 lands on a rung labelled "62" and a trader comparing
it to a 70 level is reading a number that has been rounded past the part
they care about. minPrecision is the floor for that case, and it is the
same two decimals the percent branch above already settles on for the same
reason.
Forget the measured range and go back to the placeholder.
Called when a scale loses its last series: the range it holds described something that is no longer on the chart, and whatever arrives next may plot nothing at all. An indicator whose entire output is a table plots no values, and inheriting a departed oscillator's 0..100 left its pane labelled with a ladder it had no prices for.
A manually scaled axis is left alone: the user set that range, and nothing would recompute it if it were thrown away.
Set the baseline the rebasing modes (percentage, indexed-to-100) quote
against. Ignored by linear and logarithmic.
The baseline is data, not geometry, so the scale cannot find it alone: the autoscale pass supplies the first value of the visible range each frame. That is what makes panning re-base, so the axis always reads as change measured from the left edge of what is on screen.
Pass null when there is nothing to measure (no series, no visible bars).
A rebasing mode without a baseline falls back to the identity transform
and behaves exactly like linear, rather than answering confidently with
nonsense before the first frame.
Note what a rebase does not do: it is affine over a range held in price units, so it relabels the pane rather than reshaping it. One series looks the same as it does on a linear scale, by definition (percent change is a straight-line function of price). Two instruments become comparable when each sits on its own scale with its own baseline, which is the overlay mechanism, not a second transform here.
Declare the range this scale must hold, or pass null to withdraw it.
It is what an indicator that owns its pane asks for (RSI 0..100, a signal
line -1..1): a band whose meaning is in the numbers themselves, so fitting
it to the values on screen would destroy the reading rather than improve
it. The scale goes manual while one is held, because the range is declared
and not measured, and setAutoScale(true) returns to it.
Withdrawing (null) leaves the range where it is; the caller decides whether the scale goes back under autoscale, because it is the one that knows whether anything is left on the pane to measure.
Merge partial options (minMove, mode, inverted, margins) at runtime.
Override the numeric formatting used for axis tick labels, the last-price
tag, and price-line labels (e.g. a currency or percent format). Pass null
to restore the default tick-size-aware toFixed.
Tick prices for the axis ladder, at most maxTicks of them. Linear and log
get the nice ladder over the price range, exactly what the axis renderer
used to build for itself.
The rebasing modes need it built in label space: a nice price is an ugly percentage, and a ladder of "+3.47%, +6.94%" is not a ladder. So the nice values are chosen over the transformed range and mapped back to the prices the axis positions with.
Whether the range tracks the data (true) or has been set manually (false).