Skip to main content

Module scales

Module scales 

Source
Expand description

Price ranges, coordinate transforms, axis ticks and label formatting.

Use PriceScale and its per-frame PriceMap to map prices to screen coordinates. PriceFormatter and TimeFormatter customize axis labels; HorizontalScale supports non-time axes such as strikes and maturities.

Structs§

CurrencyFormatter
Currency formatter with symbol.
CustomPriceFormatter
Custom price formatter using a closure
CustomTimeFormatter
Custom time formatter using a closure
DefaultPriceFormatter
Default price formatter with configurable precision
DefaultTimeFormatter
Default time formatter using standard formats
LocaleTimeFormatter
Locale-aware time formatter: month and weekday names and the AM/PM marker in the locale’s language, laid out as DefaultTimeFormatter does.
MaturityScale
A horizontal scale of maturities in months, for yield curves, encoded with key_time.
PercentageFormatter
Percentage price formatter
PriceFormatterBuilder
Builder for creating price formatters
PriceHorizontalScale
A horizontal scale of prices, such as the strikes of an option chain, encoded with key_time.
PriceMap
Per-frame price-to-pixel mapping.
PriceMark
A single price tick mark on the Y axis
PriceMarkGenerator
Smart price axis mark generator Implements “nice numbers” algorithm for price ticks
PriceMarkGeneratorConfig
Configuration for price mark generation, set per scale through PriceScaleOptions::tick_marks.
PriceRange
A min/max price range, used throughout the scale engine.
PriceScale
One price axis: options and the visible range in scale units, fitted to the data until the user scales it by hand.
PriceScaleMargins
Space auto-scaling leaves above and below the data, as fractions of the pane height.
PriceScaleOptions
Configuration options for a PriceScale.
PriceTransform
How one series’ prices become scale units.
RelativeTimeFormatter
Relative time formatter (e.g., “2h ago”, “yesterday”)
ScientificFormatter
Scientific notation formatter
TickMark
A single tick mark on the time axis
TickMarkContext
Display time and chart locale for one time-axis tick.
TickMarkGenerator
Smart time axis mark generator Implements intelligent mark distribution algorithm
TickMarkGeneratorConfig
Configuration for tick mark generation
TickMarkLayout
Where the tick marks of a horizontal axis are laid out.
TickMarkWeight
Weight of a tick mark (0-100 scale) Higher weight = more important mark = displayed at lower zoom levels
TimeFormatterBuilder
Builder for creating time formatters
VolumeFormatter
Volume formatter (K, M, B suffixes)

Enums§

PriceScaleId
Identifies one of a pane’s price axes.
PriceScaleMode
Scaling mode for the price (Y) axis.
StudyFormat
Units used in study legends, axes, tooltips and data windows.
TickMarkType
Type of tick mark on the time scale
TimezoneMode
Timezone display mode for time axis labels.

Traits§

HorizontalScale
What the keys of the horizontal axis mean: which of them are labelled, how, and how the crosshair label reads.
PriceFormatter
Trait for custom price formatting on the Y axis.
TimeFormatter
Trait for custom time formatting Allows users to customize how time labels are displayed on the axis

Functions§

bar_countdown
Formats the time left in an open bar, using an exact host or session close when supplied. Without an exact close, calendar months end at the next month’s first day and intraday bars end no later than UTC midnight, as in BarClock. Closed or future bars have no label.
instrument_price_precision
Instrument decimals, falling back to the decimal places needed to write its minimum tick. Invalid tick sizes are ignored; explicit decimals take precedence.
key_time
The bar time standing for a numeric key on a horizontal scale other than time: the key as seconds from the Unix epoch, to the nanosecond, so times sort as their keys do.
time_key
The numeric key a bar time stands for, the inverse of key_time.