title: Filter a legend Item with Chartjs.org V2.7
body: <p>I am building a series of doughnut charts and I would like to remove the second item in the legend, so when I generate the legend with the generateLegend() method I just want to get the first value.</p>
  
  <p>In the <a href="http://www.chartjs.org/docs/latest/configuration/legend.html#html-legends" rel="nofollow noreferrer">documentation</a> there is an option that reads </p>
  
  <blockquote>
    <p>Filters legend items out of the legend. Receives 2 parameters, a Legend Item and the chart data</p>
  </blockquote>
  
  <p>But I can't find an example how to use it. In this <a href="https://codepen.io/ryansegus/pen/VMKqdN" rel="nofollow noreferrer">Pen</a> you can see the 2 labels in the middle, I just want to show the first label. I tried different approaches with no success. Just deleting the item doesn't work for me because the <code>&lt;li&gt;</code> item still there. Here's the code I am using.</p>
  
  <pre><code>$id = function(id) {
    return document.getElementById(id);
  };
  
  var langDataEs = {
    type: "doughnut",
    data: {
      datasets: [
        {
          data: [75, 25],
          backgroundColor: ["#8dc63f", "#1d1d1d"]
        }
      ],
      labels: ["es", "learning"]
    },
    options: {
      legend: {
        display: false,
        /* I would like to remove the item "learning" */
        filter: function() {
  
        },
      },
      responsive: true
    }
  };
  
  langChartEs = new Chart($id("langEs").getContext("2d"), langDataEs);
  $id("es").innerHTML = langChartEs.generateLegend();
  </code></pre>
  
  <p>Thanks in advance for any pointers.</p>