JSFiddle - React, Tailwind, and code Playground

by Naoki Nishida

HTML

<title>Line with Nyaplotjs</title>
<script src='https://cdn.rawgit.com/domitry/Nyaplotjs/1d2e51d061312c82e8db7ff7a04ee85fdc4ef2c0/release/nyaplot.min.js'></script>
<body>
  <h2>
    Plot#parse
  </h2>
  <div id="vis"></div>
  <h2>
    Plot#to_png
  </h2>
  <div id="to_png"></div>
</body>

JavaScript

(function(){
  var xarr=[], yarr1=[], yarr2=[], N=500, curry1=0.0, curry2=0.0;

  for(var i=0;i < N;i++){
    xarr.push(i);
    yarr1.push(curry1+=(Math.random()-0.5));
    yarr2.push(curry2+=(Math.random()-0.5));
  }
  var plot = new Nyaplot.Simple.Plot();

  plot.line(xarr, yarr1, {color: "#66c2a5"});
  plot.line(xarr, yarr2, {color: "#fc8d62"});
  plot.title("Random walk");
  plot.xlabel("Number of steps");
  plot.render("#vis");
  plot.to_png("#to_png");
})();