Simple streaming time series graphs. Automatically scales the y-axis points based on the graph height.
$ component install matthewmueller/time-series
var graph = document.getElementById('graph')
var series = Series(graph).scale('60s')
var line = series.line()
line.color('#00BEFF')
setInterval(function() {
line.add(rand())
}, 500)
var line2 = series.line()
line2.color('#CF3E2A')
setInterval(function() {
line2.add(rand())
}, 1000)
function rand() {
return Math.random() * 100 | 0
}
Initialize TimeSeries
Set the scale
Create a new line
Autoscale the y-axis. Defaults to true
.
Set the color of the line
Set the width of the stroke
Add a point to the time series. The time
value is optional and will default to new Date
.
MIT