2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Hooks

useStreamingData

Updated: February 22, 2026
View on GitHub
The useStreamingData hook creates smooth, animated data streams for real-time visualizations. It interpolates between data points and maintains a sliding window of values, perfect for live charts and dashboards. Used in components: Not used internally by Once UI components
  • Smooth interpolation between data points
  • Configurable sliding window size
  • Customizable update intervals
  • Pause/resume streaming
  • Reset to initial state
  • RequestAnimationFrame-based updates
Create a streaming line chart: Stream multiple data series:
Prop
Type
Default
initialData
T[]
windowSize
number
intervalMs
number
stepMs
number16
xKey
keyof T
numericKeys
Array<keyof T>
getNextTarget
({ lastPoint, nextX }) => Partial<T>
  • Initialization: Starts with initialData trimmed to windowSize
  • New point creation: Every intervalMs, creates a new data point
  • Interpolation: Smoothly animates from current to target values
  • Sliding window: Maintains only the last windowSize points
  • Animation: Updates every stepMs using requestAnimationFrame
  • Use stepMs: 16 for 60fps (smooth)
  • Use stepMs: 33 for 30fps (more efficient)
  • Keep windowSize reasonable (20-50 points)
  • Avoid expensive calculations in getNextTarget
System monitoring dashboard:
  • useStreamingViewport - Similar but with dynamic viewport adjustment
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club