How to hide section in a Chart.js Pie Chart
<p>In Chart.js you can hide a section of a chart by clicking on the label on top.<br>
<a href="https://i.stack.imgur.com/tOrGV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tOrGV.png" alt="enter image description here"></a><br>
<em>picture of a pie chart with hidden section</em>  </p>

<p>I want a section of the chart to be hidden on startup. With another type of chart I would use the dataset hidden property, but pie chart sections do not correspond with the datasets. So if you do the same the entire dataset is hidden, not just the needed section.</p>

<p>(Extra information: I use a pie chart with multiple datasets)</p>

<p>The closest I have come to a solution is this code:</p>

<pre class="lang-js prettyprint-override"><code>for (i = 0, ilen = (chart.data.datasets || []).length; i &lt; ilen; ++i) {
  meta = chart.getDatasetMeta(i);
  meta.data[index].hidden = !meta.data[index].hidden;
}

chart.update();
</code></pre>

<p>Or I could overwrite the generateLabels function.</p>

<p>Can anyone help me find a better solution?</p>

<p>Thank you</p>