Changelog

Faster charts from the community

Eight community pull requests make hover, live and large charts faster, and fix negative stacks.

  • performance
  • accessibility
  • community
  • bar-chart
  • line-chart
  • area-chart
  • candlestick-chart
  • heatmap-chart
  • sankey-chart
  • live-line-chart

Today we merged eight pull requests from four contributors. Most of them make charts do less work on every hover, re-render and frame, and each one shipped with before-and-after measurements. You don't need to change any code to get them. Update your components from the registry.

Performance

Andrea Cappuccio (@hood) went through the charts one by one:

  • Candlestick charts draw decimated candles. When a chart has far more candles than the plot is wide, CandlestickChart draws the OHLC buckets it already computes, and each candle widens to fill its bucket. With 5,000 candles, a hover update drops from 22.5 ms to 0.57 ms. Very large datasets (around 120,000 rows) no longer throw a RangeError. #331
  • Bar chart children stay put on hover. Grid, axes and custom children no longer re-render on each mouse move, only the parts that read hover state. #329
  • Paused live charts go idle. A paused LiveLineChart stops re-rendering once its range settles, and the hover tooltip finds the visible window by binary search instead of filtering the whole history each frame. #333
  • Heatmap hover updates only the cells that change. Moving between cells re-renders the cells whose highlight changes, and none when hover dimming is off. Hover is 63% faster on a one-year heatmap. #335
  • Sankey links and nodes skip mouse moves. Plain pointer movement now re-renders only the tooltip. Render time across 200 moves fell from 963 ms to 79 ms. #337

Merlijn van den Berg (@iammerlijn) made LineChart and AreaChart skip their data pipeline when the parent re-renders for reasons other than data, such as a tab, a filter input or a timer. At 10,000 points a parent re-render goes from 9.7 ms to 1.1 ms per frame, and brush drags are 24–50% faster. #377

Negative values in stacked bars

@akashwork9 fixed negative values in stacked bars. In a stacked BarChart or a ComposedChart with stacked bars, positive values now stack up from zero and negative values stack down from it. Before, mixed-sign segments overlapped and the axis left out the negative side. Bars in composed charts also always keep the zero baseline in view. #375

Reduced motion

Muhammad Usman (@usman8786) made line, area and composed charts respect prefers-reduced-motion. With reduced motion on, they start at rest instead of playing the enter animation, and the loading pulse shows as a static line instead of a sweep. #378

Thank you

Thanks to everyone who opened an issue, sent a pull request or measured a chart. If you'd like to contribute, the GitHub repo has open issues, and Studio is the fastest way to try a change.

See the bar chart, candlestick chart and line chart docs.