Skip to content

Commit

Permalink
Bar: ignore not-grouped bars from group bar count (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Jun 19, 2021
1 parent fb863f3 commit ba5ebce
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/controller.bar.js
Expand Up @@ -324,6 +324,10 @@ export default class BarController extends DatasetController {
for (i = 0; i < ilen; ++i) {
item = metasets[i];

if (!item.controller.options.grouped) {
continue;
}

if (typeof dataIndex !== 'undefined') {
const val = item.controller.getParsed(dataIndex)[
item.controller._cachedMeta.vScale.axis
Expand Down
35 changes: 35 additions & 0 deletions test/fixtures/controller.bar/not-grouped/mixed.js
@@ -0,0 +1,35 @@
module.exports = {
description: 'https://github.com/chartjs/Chart.js/issues/9281',
config: {
type: 'bar',
data: {
labels: [0, 1, 2],
datasets: [
{
label: 'data 1',
data: [1, 2, 2],
backgroundColor: 'rgb(255,0,0,0.7)',
grouped: true
},
{
label: 'data 2',
data: [4, 4, 1],
backgroundColor: 'rgb(0,255,0,0.7)',
grouped: true
},
{
label: 'data 3',
data: [2, 1, 3],
backgroundColor: 'rgb(0,0,255,0.7)',
grouped: false
}
]
},
options: {
scales: {
x: {display: false},
y: {display: false}
}
}
},
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ba5ebce

Please sign in to comment.