Line Chart (template)

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <script src="http://json-stat.org/lib/json-stat.js"></script>
    <link rel="stylesheet" href="http://idescat.github.io/visual/visual.css" />
    <script src="http://idescat.github.io/visual/lazyvisualsetup.js"></script>
  </head>

  <body>
    <div id="visual" class="visual"></div>

    <script>
    url="";
    query={};

    function main(obj){
      ds=JSONstat(obj).Dataset(0);

      //Line Chart
      visual({
        lang: "en",
        type: "tsline",

        title: "Time Series Template",
        footer: "Source...",

        time: [ "2013", "2014", "2015", "2016" ],
        data: [
          {
            label: "Series1",
            val: [100, 200, 300, 400]
          },
          {
            label: "Series2",
            val: [50, 100, 150, 250]
          }
        ]
      });
    }

    POST(url, query, main);

    function POST(url, query, main){
      fetch( url, { method: "post", body: JSON.stringify(query) } )
        .then(function(resp) {
          resp.json().then(main);
        })
      ;
    }
    </script>
  </body>
</html>