Fourier-js

06/06/2021

This is a tiny little library I made using d3.js for visualizing time series. I needed a good way to display timeseries for my twitter-svm project but I couldn't find anything that met my needs, so this is the result. It needs a lot of work, but the basic functionality is there. Right now it only supports area charts, but adding more graph types is fairly trivial.

Right now the smoothing is a little awkward, and the auto-sizing is very rough. There's also a strange bug where the x-axis transformations get queued when the window isn't in focus. But enough of the negatives!

The basic usage is as such:

var myObj = new Object();
myObj.val = 0;
myObj.index = 0;
setInterval(function () {myObj.val = Math.sin(myObj.index*.1); myObj.index++;}, 300);
myGraph = new graph('#graph', myObj, 20);

All you need to do is pass it a selector, an object with a value property which can be updated with whatever method you please (websockets etc...) and the size of your window in seconds and presto you got yourself a timeseries: