title: Remove data after adding it (chart.js)
body: <p>I have an add data function in my bar-chart but I would like to be able to remove this data with onclick. How do I do this?</p>
  
  <pre><code>var canvas = document.getElementById("barChart");
  var ctx = canvas.getContext('2d');
  // We are only changing the chart type, so let's make that a global variable along with the chart object:
  var chartType = 'bar';
  var myBarChart;
  
  // Global Options:
  Chart.defaults.global.defaultFontColor = 'grey';
  Chart.defaults.global.defaultFontSize = 16;
  
  var data = {
    labels: [ "2012", "2013", "2014", "2015", "2016", "2017"],
    datasets: [{
      label: "Miljoner ton",
      fill: true,
      lineTension: 0.1,
      backgroundColor: "rgba(0,255,0,0.4)",
      borderColor: "green", // The main line color
      borderCapStyle: 'square',
      pointBorderColor: "white",
      pointBackgroundColor: "green",
      pointBorderWidth: 1,
      pointHoverRadius: 8,
      pointHoverBackgroundColor: "yellow",
      pointHoverBorderColor: "green",
      pointHoverBorderWidth: 2,
      pointRadius: 4,
      pointHitRadius: 10,
      data: [56.38, 59.3, 61.81, 58.83, 52.32, 66.86],
      spanGaps: true,
    }]
  };
  
  // Notice the scaleLabel at the same level as Ticks
  var options = {
    scales: {
      yAxes: [{
        ticks: {
          beginAtZero: true
        }
      }]
    },
    title: {
      fontSize: 18,
      display: true,
      text: 'Källa: Globallife.org',
      position: 'bottom'
    }
  };
  
  
  function addData() {
      myBarChart.data.labels[7] ="Ekologisk palmolja";
      myBarChart.data.datasets[0].data[7] = 14;
      myBarChart.update();
  }
  
  // We add an init function down here after the chart options are declared.
  
  init();
  
  function init() {
    // Chart declaration:
    myBarChart = new Chart(ctx, {
      type: chartType,
      data: data,
      options: options
    });
  }
  </code></pre>