npm lightweight-charts 5.1.0
v5.1.0

one day ago

Version 5.1.0 introduces data conflation, a powerful performance optimization feature designed for charts with very large datasets. For most use cases with typical dataset sizes, this feature will operate transparently in the background. However, if you're working with datasets containing tens of thousands of data points or more, conflation can dramatically improve rendering performance when users zoom out.

Major Updates in 5.1

Data Conflation

Data conflation is an automatic performance optimization that merges data points when zoomed out, significantly improving rendering performance for large datasets. When bar spacing falls below a threshold where multiple data points would be rendered in less than 0.5 pixels of screen space, the library intelligently combines them into single points.

Key features:

  • Opt-in activation: Conflation is disabled by default and can be enabled via the enableConflation option.
  • Configurable options: Control conflation behavior through new time scale and series options:
    • enableConflation - Enable or disable the feature (default: false).
    • conflationThresholdFactor - Adjust the zoom level threshold for activation and create smoothing effects. Higher values (2.0, 4.0, 8.0+) result in smoother-looking charts, particularly useful for sparklines and small charts where smooth appearance is prioritized over showing every data point.
    • precomputeConflationOnInit - Pre-calculate conflated data on initialization for improved zoom performance at the cost of initial load time and memory usage (default: false).
    • precomputeConflationPriority - Control background computation priority when using the Prioritized Task Scheduling API (default: 'background').
  • Custom series support: Plugin developers can implement custom aggregation logic through the new CustomConflationReducer interface.

This feature is particularly beneficial for applications displaying historical data spanning years or real-time feeds that accumulate large amounts of data over time. For typical use cases with moderate dataset sizes, conflation can remain disabled without any impact.

(PR #1945)

Enhancements

  • Added doNotSnapToHiddenSeriesIndices option to CrosshairOptions. When enabled, the crosshair will snap to the nearest visible series data point instead of snapping to hidden series indices. (PR #1995)

Bug Fixes

  • Fixed price axis label positioning when using plugin views that don't implement the optional fixedCoordinate() method. Previously, labels were incorrectly treated as positioned at coordinate 0, causing false overlap detection. (PR #1993), fixes #1986), contributed by @tpunt)

  • Fixed time scale fitContent method to properly respect the rightOffset option when rightOffsetPixels is not set. This addresses a regression introduced in version 5.0.9. (PR #1989, fixes #1988)

Contributors

We'd like to thank our external contributors for their valuable contributions to this release:

Changes since the last published version.

Don't miss a new lightweight-charts release

NewReleases is sending notifications on new releases.