-
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
[FEATURE] Display stack label for Stacked groups #6025
Comments
+1 |
2 similar comments
+1 |
+1 |
is this released yet? where can I find this documentation? |
+1 Just came here looking for same feature. Group / sub-group labels. |
+1 searching around for this! |
+1 need this |
+1 Would like this |
This is actually resolved using datalabels plugin, and labels. Use labels as regular maybe adjusting vertical height to make room for datalabels. Also adjust datalabels vertical height and offset then use formatter
|
Stumbled across this issue and found @kpetrow solution quite interesting.
Under the hood: formatter: (value, context) => {
const { datasets } = context.chart.data;
const stacksCount = Object.keys(context.chart._stacks).length;
if (context.datasetIndex > datasets.length - 1 - stacksCount) {
return datasets[context.datasetIndex].stack;
} else {
return '';
}
} A working example can be found at https://codepen.io/jlozovei/details/NWJpYvy ✨ |
Feature Proposal
When I use stacked groups, I want the possibility to display stack label if correct option is selected.
Suggestions of options:
Feature Use Case
I have found a stack-overflow with exactly the same feature wanted :
https://stackoverflow.com/questions/48643408/chart-js-grouped-sub-labels
The text was updated successfully, but these errors were encountered: