Skip to content

n3-charts/line-chart-vanilla

Repository files navigation

vanilla-line-chart Build Status Coverage Status Join the chat at https://gitter.im/n3-charts/line-chart-vanilla

vanilla-line-chart is an easy-to-use JavaScript library for creating beautiful charts in plain JavaScript and it is built on top of D3.js.

n3-charts lead image

This a vanillaJS Version of n3-line-charts and still under heavy development. Go check out our well tested AngularJS directive instead.

Getting started

You can install vanilla-line-chart by forking this repo.

git clone git@github.com:n3-charts/line-chart-vanilla.git
cd line-chart-vanilla
npm install
gulp

Next, you need to reference LineChart.js and LineChart.css in your index.html file.

<script src=".tmp/build/LineChart.js"></script>
<link rel="stylesheet" href=".tmp/build/LineChart.css">

Here is an example how your HTML file should look like.

<!doctype html>
<html ng-app="app">
  <head>
    <!-- Reference AngularJS and D3.js -->
    <script src="node_modules/d3/d3.min.js"></script>
    <!-- Reference vanilla-line-chart -->
    <script src=".tmp/build/LineChart.js"></script>
    <link rel="stylesheet" href=".tmp/build/LineChart.css">
  </head>
  <body>
    <div id="chart" style="height:500px"></div>
    <script>
      var data = {
        dataset: [
          {x: 0, y: 0, other_y: 0, val_2: 0, val_3: 0},
          ...
         ]
       };

      var options = {
        axes: {x: { key: "x" }},
        series: [ ... ], ...
      };

      var lineChart = new n3Charts.LineChart("#chart", options, data);
      lineChart.update();
    </script>
  </body>
</html>

Authors

vanilla-line-chart is made with love and care by Christoph Körner & Sébastien Fragnaud.