Skip to main content

Dependency-free time-series web realtime graphing library developed in-house at CRISiSLab

Works with
This package works with Browsers
JSR Score
3 months ago (0.11.1)


Live demo | GitHub | NPM

TimeLine is the dependency-free time-series web realtime graphing library developed using Typescript in-house at CRISiSLab.

We use TimeLine in production here.

However, this library is designed for one use-case: rendering live seismograph data. It might not be ideal for your use-case. You should also check out huww98/TimeChart.



npm i @crisislab/timeline

Typescript definitions are included in the package.

Important notes!

  • data should be sorted by x-value, with smallest values first. If you always add new data onto the end, this shouldn't be a problem.
  • Call chart.recompute() whenever you've updated the data array. You can use this to batch changes by waiting until you're done modifying data before recomputing.
  • The chart won't draw anything if there are less than two points.


Basic live data
import {
} from "@crisislab/timeline";

const data: TimeLineDataPoint[] = [];
const timeWindow = 30 * 1000;
const chart = new TimeLine({
	container: document.getElementById("chart-container") as HTMLElement,
	// Note that these aren't used by the chart itself, they're just used by plugins
	timeAxisLabel: "Time",
	valueAxisLabel: "Random numbers",
	plugins: [
		// By default, the chart doesn't draw an x or y axis.
		// You can use these built-in plugins though.
		timeAxisPlugin((x) => new Date(x).toLocaleTimeString()),

let prev = 0;
setInterval(() => {
	const y =
		prev + Math.floor(Math.random() * 10) * (Math.random() > 0.5 ? -1 : 1);
	prev = y;
		value: y,

	// Call chart.recompute() when you're done updating `data`
}, 50);

More examples in the examples folder.


There are several plugins included:

  • timeAxisPlugin: Adds an x-axis (but not an axis label)
  • valueAxisPlugin: Adds an y-axis (but not an axis label)
  • axisLabelPlugin: Adds axis labels for the X and Y axis
  • pointerCrosshairPlugin: Adds a crosshair that follows the mouse
  • highlightNearestPointPlugin: Draws a marker on the nearest point to the mouse
  • doubleClickCopyPlugin: Makes double clicking on the canvas copy the values of the nearest point in tsv (csv) format to the clipboard


This project was inspired by TimeChart by huww98. We were originally using huww98's library, but found that webGL was excessive for our needs, and created too many problems to justify continuing to use it. Our library's API design is inspired by huww98's library, and the visuals are similar, but under the hood it's completly different. Our library uses the Canvas API instead of WebGL for rendering, so it won't be as performant for huge amounts of data.