-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement Request - Hide Legend Per-Dataset #3189
Comments
hi, i had the same problem and developed the following patch to support a new dataset-attribute hiddenLegend: true|false
|
Hi I'm using 2.0.2 and I need this patch but it doesn't work:
What version was the patch for @mcpohl ? |
the version was 2.2.2 |
I'm trying to use this feature on 2.7.0 but the legend item is still being displayed for the dataaset. Am I doing something wrong? datasets: [
{
label: 'Primary Line',
data: [12, 19, 3, 2, 9],
borderColor: 'rgb(0, 12, 192)',
borderWidth: 2,
hiddenLegend: true,
}
] |
v2.7.0 Under options, add the following:
Angular\Typescript:
|
I had to use Here's the code I used to hide items in the legend that had "empty" data:
|
i try this, but it does not work, weird |
I tried this, but it is not working. Can anyone tell me how can I achieve this? |
Remove label from dataset you want to hide and this should do the magic. |
Update for Chart.js 3.x: legend options have been placed inside "plugins" options: {
plugins: {
legend: {
labels: {
filter: (legendItem, chartData) => {
return // true or false;
}
}
}
}
} |
Current it is easy to remove the legend from charts via the global or chart level config options. However, it would be very useful for me to be able to remove the legend on a per-dataset level.
Currently:
Requested API:
The text was updated successfully, but these errors were encountered: