[Chartjs]-Want only line not area under it in chart js

4👍

Just add the option fill:false in your datasets.

var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart.Line(ctx, {
  data: {
    labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
    datasets: [{
  
      label: 'apples',
      data: [12, 19, 3, 17, 6, 3, 7],
      fill:false
    }, {
      label: 'oranges',
      data: [2, 29, 5, 5, 2, 3, 10],
      fill:false
    }]
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script>
<div class="container"  style="width:600px;height:600px;">
  <h2>Order rate Dashboard</h2>
  <div>
    <canvas id="myChart"></canvas>
  </div>
</div>

1👍

http://www.chartjs.org/docs/#line-chart-dataset-structure

<html>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script>
    <head></head>
    <body>
<div class="container"  style="width:600px;height:600px;">
  <h2>Order rate Dashboard</h2>
  <div>
    <canvas id="myChart"></canvas>
  </div>
</div>

<script>
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
  type: 'line',
  data: {
    labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
    datasets: [{
     fill: false,
      label: 'apples',
      data: [12, 19, 3, 17, 6, 3, 7]
    }, {
      fill: false,
      label: 'oranges',
      data: [2, 29, 5, 5, 2, 3, 10]
    }]
  }
});
</script>
    </body>
</html>

Leave a comment