Skip to content

Instantly share code, notes, and snippets.

Last active Dec 12, 2015
What would you like to do?
Simple time series data modeling with dataseries.js.

Simple time series data modeling composed of a trend, seasonality and random component with dataseries.js.

<!doctype html>
<meta charset="utf-8"/>
<script src=""></script>
<script src=""></script>
<script src=""></script>
body {
font-family: Georgia; Arial; sans-serif;
padding: 0;
margin: 0;
#graph svg .axis path,
#graph svg .axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
#graph svg .graph {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
<div id="graph"></div>
<script type="text/javascript">
var data = ds.generators.f(function(x) {
return ds.functions.linear(x, { a: 1, b: 1 })
+ ds.functions.sin(x, { f: 0.5 })
+ ds.random.rand(-0.2, 0.2);
.inputs(ds.range(0, 1, 0.01))
.time(new Date(), ds.time.DAY)
.margin({top: 20, right: 20, bottom: 40, left: 60})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment