Releases: tradingview/lightweight-charts
v5.0.9
Enhancements
- Added
rightOffsetPixelsoption toHorzScaleOptions, allowing margin space from the right side of the chart to be set in pixels. This option takes precedence overrightOffsetand ensures consistent pixel offset when usingfitContenton charts with different amounts of data. The pixel-based offset remains consistent during zoom operations. (PR #1957) - Added
popmethod to series API that removes a specified number of data points from the end of the series and returns the removed data. (PR #1949, fixes #1518, contributed by @tpunt) - Enhanced
takeScreenshotmethod with two new optional parameters:addTopLayer- includes top layer primitives in the screenshot (default: false)includeCrosshair- includes the crosshair whenaddTopLayeris enabled (default: false)
(PR #1977)
- Added
autoScaleoption toSeriesMarkersOptions, allowing control over whether markers are included in the auto-scaling calculation of the price scale. When enabled (default: true), the chart will adjust its scale to ensure markers are fully visible. (PR #1940, contributed by @zbinlin) - Added
baseoption to price format configuration as an alternative tominMove. This helps avoid floating-point precision limitations when dealing with extremely small price movements. (PR #1952) - Enhanced plugin API with additional functionality:
Bug Fixes
- Fixed price scale visible range calculation when in logarithmic scale mode by properly converting the range from log space and handling precision issues with rounding. (PR #1965, contributed by @tpunt)
Plugin & Indicator Examples
- Added Dual Range Histogram Series custom plugin example that visualizes paired positive and negative value ranges for each time point using a column-based display. (PR #1934)
- Added Pretty Histogram plugin example demonstrating non-standard histogram rendering. (PR #1930)
- Added examples demonstrating how to implement indicators (studies) within Lightweight Charts. See the Analysis Indicators tutorial for more information. (PR #1915)
Contributors
We'd like to thank our external contributors for their valuable contributions to this release:
v5.0.8
Enhancements
- Improved pane API with several new methods and options:
- Added
addDefaultPaneoption to chart options, allowing creation of charts with no initial panes - Added
addPanemethod toIChartApifor programmatically adding panes - Added
setPreserveEmptyPaneandpreserveEmptyPanemethods to control empty pane behavior - Added
getStretchFactorandsetStretchFactormethods to control relative pane sizes - Added
addCustomSeriesandaddSeriesmethods toIPaneApifor creating series directly on a specific pane - Updated
getHTMLElementto returnnullwhen a pane hasn't been created yet - These improvements provide greater flexibility when working with multi-pane charts
(PR #1894, fixes #1898, #1896, #1872, #1907)
- Added
- Added additional price scale tick mark formatting capabilities:
- Added
formatTickmarksmethod toIPriceFormatterinterface - Added
tickmarksPriceFormatterandtickmarksPercentageFormatteroptions toLocalizationOptionsBase - Added
tickmarksFormatteroption toPriceFormatCustom - These new formatters provide all tick mark values at once, allowing for context-aware formatting decisions such as determining the optimal precision level needed
(PR #1903)
- Added
v5.0.7
Enhancements
- Added price scale visible range control with new methods in
IPriceScaleApi:setVisibleRange,getVisibleRange, andsetAutoScale. These methods allow for programmatic control of the visible price range on a price scale. Also addedensureEdgeTickMarksVisibleoption toPriceScaleOptions, which ensures tick marks are always visible at the very top and bottom of the price scale, providing clear boundary indicators. These features are particularly useful for charts with zooming and panning disabled that are primarily for display purposes. (PR #1856) - Added control over the rendering stacking order of series markers through a new
zOrderoption in the series markers plugin. This enhancement provides greater flexibility in controlling marker visibility and layering in complex charts. (PR #1876).
v5.0.6
Enhancements
- Implemented series order functionality, allowing control over the rendering order of series within a pane. Series with higher order values are rendered on top of those with lower values. Added two new methods to
ISeriesApi:seriesOrder()to get the current order index andsetSeriesOrder(order)to set a specific order. (PR #1868)
v5.0.5
Bug Fixes
- Fixed an issue where the series marker plugin could throw an exception if the series data required for individual markers could not be found (such as when the data is cleared or changed via setData on the series). (PR #1845)
v5.0.4
Improvements
- Fixed performance degradation when adding series markers to charts with large datasets (15,000+ data points) by optimizing marker calculations to only run when necessary. (PR #1835, fixes #1808)
- Added price-based positioning for series markers, allowing more precise control over marker placement. New position types include
atPriceTop,atPriceBottom, andatPriceMiddle, which require apricevalue to be specified. (PR #1826, thanks to @EranGrin) - Added
MagnetOHLCtoCrosshairMode. This mode sticks the crosshair's horizontal line to the price value of a single-value series or to the open / high / low / close price of OHLC-based series. (PR #1831, thanks to @Jonney)
Bug Fixes
- Fixed an issue where the crosshair marker would be visible on the first data point when the chart is initially loaded, before any user interaction. This behavior has been reverted to match version 4, where the crosshair remains hidden until user interaction. (PR #1840)
v5.0.3
Bug Fixes
- Fixed an issue where changing the price scale for one pane would impact all panes in multi-pane setups. Added pane index parameter to the price scale API to ensure changes only affect the intended pane. (PR #1821, fixes #1817)
- Fixed an issue where a cursorStyle defined in a primitive hit-test wouldn't be applied. Additionally improved cursor style handling to maintain the correct cursor when the mouse remains in the same position while price/time scales are adjusted. (PR #1823)
v5.0.2
Bug Fixes
- Fixed an issue where the crosshair marker would remain visible after the mouse pointer has left the chart. (PR #1807)
v5.0.1
Version 5.0 represents a significant milestone in the evolution of Lightweight Charts™, delivering on our commitment to keep the library truly "lightweight". Despite adding numerous new features, improvements, and fixes, we've managed to reduce the bundle size by up to 16%, bringing the base bundle size down to just 35kB. This remarkable reduction was achieved through enhanced tree-shaking capabilities, modernized architecture, and careful optimization of core features.
This release introduces highly requested features like multi-pane support and new chart types. It also modernizes the codebase and improves its architecture to set a foundation for future enhancements without compromising on size.
Major Updates
Multi-Pane Support
One of our most requested features, multi-pane support is now available. It allows you to create complex chart layouts with multiple independent viewing areas. This enhancement enables sophisticated technical analysis setups and better visualization of related data series. Additional key benefits include:
- Full support for multiple panes within a single chart
- Independent scale and series management per pane
- Flexible pane sizing and arrangement options
See Panes for more information.
New Chart Types
Yield Curve Charts
- New specialized chart type for displaying yield curves
- Custom horizontal scale behavior with linear spacing
- Optimized whitespace handling
Options Charts
- Price-based horizontal scale support
- Specialized formatting and interaction handling
- Ideal for options chain visualization
See Chart types for more information about the Yield Curve Chart and Options Chart types.
Enhanced Color Support
- Expanded native support for sRGB-based colors (RGB, RGBA, hex, named colors, HSL)
- Support for expanded color gamuts like Display P3
- Ability to specify a custom color parser to add support for non-sRGB formats
- Reduced bundle size through browser-native color parsing
Architectural Improvements
- Watermark feature reimplemented as plugins (
TextWatermarkandImageWatermark) - Series Markers extracted as a plugin for better tree-shaking
- New Up/Down Markers Plugin for price change visualization
- Introduction of Pane Primitives for plugin attachment
Breaking Changes
- New unified series creation API (see migration guide)
- Dropped CommonJS support and updated JS syntax version to ES2020
- Watermark functionality moved to plugins
- Series markers implementation changed to plugin system
Enhancements
- Added relative gradient option for baseline and area series (
relativeGradient) - New time scale option for maximum bar spacing (
maxBarSpacing) - Added
priceLines()method toISeriesApiinterface - Enhanced watermark capabilities with multi-line text support
- Improved plugin system with Pane Primitives support
- Better tree-shaking capabilities for smaller bundle sizes
Bug Fixes
- Fixed primitive detachment update issues (#1594)
- Various performance and rendering improvements
Migration Guide
We've prepared a comprehensive migration guide to help you upgrade from v4 to v5. Key areas to note:
- Series Creation API changes
- Watermarks and Series Markers moving to separate plugins
- Plugin system updates
See the full migration guide: Migrating from v4 to v5
Technical Notes
This release uses ES2020 syntax and no longer supports CommonJS. If you need to support older environments, you'll need to set up transpilation for the lightweight-charts package in your build system using tools like Babel.
As always, we thank you for your support and help in making Lightweight Charts™ the best product on the financial web. We look forward to seeing what you build with these new capabilities!
You can always send us your feedback via GitHub.
Happy trading!
Team TradingView
v4.2.3
Minor Improvements
- Improve check for crosshair label visibility on the price scale. This improves upon previous work (#1743 in v4.2.2) by reducing the allocated space for the crosshair when it is enabled, but the label is disabled. (PR #1757)
Bug Fixes
- Added additional prototype pollution protection for internal merge helper function. (PR #1758)