Skip to main content

Version 32.2.0

· 4 min read

Welcome to Version 32.2.0.

This release adds a way to read series and indicator values at any time, without waiting for the crosshair to move, brings the session highlight properties into the overrides types, and lets you hide and show trading primitives instead of removing them. Let's dive into the highlights.

Key updates​

Chart values without waiting for the crosshair​

Series and indicator values arrived with the crossHairMoved event, which fires as the crosshair moves. There was no way to request them on demand, so while the crosshair rested over a last bar taking real-time updates, your app could not see the values changing on screen.

The new getEntityValues method reads the same data at any time. It returns what the data window currently shows, along with the position the values were read at.

// Values under the crosshair, or on the latest bar when it is away from the chart.
const { values, atCrosshairPosition } = widget.activeChart().getEntityValues();
console.log(values['_seriesId'].values, atCrosshairPosition);

While the crosshair is over the chart, values matches the entityValues property of the event. When it is away, the values fall back to the latest bar of every source — as the data window does — and atCrosshairPosition is false. Keys in values are indicator IDs; the main series is always '_seriesId'.

Each value now also carries the color shown for it in the data window, so a custom legend can match the chart without reimplementing the palette. It is undefined for values that have no color.

Session highlights in the overrides types​

The session highlight properties now have type declarations: both session backgrounds and the vertlines.sessBreaks line. ChartPropertiesOverrides lists them all, so the widget constructor's overrides option type-checks these names as you write them, and the API Reference documents them.

overrides: {
// Transparency runs from 0 (opaque) to 100 (fully transparent).
'backgrounds.preMarket.color': '#ff9800',
'backgrounds.preMarket.transparency': 80,
'vertlines.sessBreaks.color': '#787b86',
},

Refer to Chart overrides for the full list of properties.

Show and hide trading primitives​

Order lines, position lines, and execution shapes could only be taken off the chart by removing them. Bringing one back meant re-creating it, and re-applying its price, text, styling, and callbacks along with it.

In Trading Platform, setVisible now hides a primitive created with createOrderLine, createPositionLine, or createExecutionShape while it keeps all of that intact, and getVisible reads the flag back.

const orderLine = await widget.activeChart().createOrderLine();

// Hide the line along with its price axis label, then show it again later.
orderLine.setVisible(false);

A primitive is drawn only when two settings allow it: its own flag, and the tradingProperties.showOrders, tradingProperties.showPositions, or tradingProperties.showExecutions chart property that applies to every primitive of a kind at once. For that reason getVisible returns the value you set, not whether the primitive is currently on screen. Refer to Trading primitives for details.

Documentation​

Multiple-chart layouts, explained​

The new Multiple-chart layout guide shows a diagram for every MultipleChartsLayoutType value, from two charts up to eight, with the index marked on each position. It also covers switching the layout, resizing charts, and reading the current one through the API.

Bar alignment on multi-period resolutions​

The new Bar alignment section explains how the library places bars on resolutions that span several days, weeks, or months. Periods are counted from the start of the year, so on 3D the bar that follows 2022-12-30 is 2023-01-01 rather than 2023-01-02. Enable disable_resolution_rebuild if you need bar times exactly as your datafeed provides them.

Conclusion​

This release also includes important bug fixes: the bar countdown now counts to the session close instead of a full interval, Pivot Points Standard plots on intraday resolutions without scrolling back through history, and charts synced by Date Range Sync keep the same bar spacing as the chart being dragged. For the full list of updates, improvements, and fixes, see the Release notes.