chartjs / chartjs/Chart.js

Dynamic spacing needed

Open
#11,109 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

Need dynamic spacing between bars in Bar Chart

### Current behavior

Even if there are two bars it takes the full width of the graph

data=[
{
"label": "A",
"data": [
1,
null,
null,
null,
null,
null,
null
],
"backgroundColor": "#A0DCFF"
},
{
"label": "B",
"data": [
19,
null,
13,
3,
null,
26,
7
],
"backgroundColor": "#00ABAB"
},
{
"label": "C",
"data": [
null,
null,
null,
null,
null,
null,
null
],
"backgroundColor": "#4E57A6"
},
{
"label": "D",
"data": [
null,
null,
null,
null,
null,
null,
null
],
"backgroundColor": "#4E57A6"
},
{
"label": "E",
"data": [
15,
2,
9,
5,
1,
16,
11
],
"backgroundColor": "#00A3E0"
},
{
"label": "F",
"data": [
9,
3,
4,
6,
null,
4,
2
],
"backgroundColor": "#E3E48D"
},
{
"label": "G",
"data": [
null,
null,
null,
null,
null,
null,
null
],
"backgroundColor": "#E3E48D"
},
{
"label": "H",
"data": [
2,
null,
null,
1,
null,
1,
null
],
"backgroundColor": "#8199EE"
},
{
"label": "I",
"data": [
2,
null,
null,
null,
null,
3,
null
],
"backgroundColor": "#8199EE"
},
{
"label": "J",
"data": [
null,
null,
null,
null,
null,
null,
null
],
"backgroundColor": "#117D7D"
},
{
"label": "K",
"data": [
1,
null,
1,
null,
null,
1,
null
],
"backgroundColor": "#117D7D"
},
{
"label": "L",
"data": [
null,
null,
null,
null,
null,
1,
null
],
"backgroundColor": "#9DD4CF"
}
]
Screenshot 2023-02-02 at 4 53 47 PM

### Reproducible sample

https://codepen.io/abhinavmishra-03/pen/xxJmwqZ

### Optional extra steps/info to reproduce

_No response_

### Possible solution

Need dynamic spacing between the bars in the barchart

### Context

_No response_

### chart.js version

3.9.1

### Browser name and version

_No response_

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.