question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't remove space between bars in bar chart

See original GitHub issue

Hi,

If I create a bar chart with the scales option:

{
 scales: {
                xAxes: [{
                    barThickness : 45,
                    barPercentage: 1.0,
                    categoryPercentage: 1.0,
                }],   
 }
}

Here is the fiddle https://jsfiddle.net/07pzys9t/ .

barPercentage: 1.0 and categoryPercentage: 1.0 don’t remove the space between the bars in the chart, although, as I understood, they should, as it’s said here:

http://stackoverflow.com/questions/39879445/chart-js-bar-chart-how-to-remove-space-between-the-bars-in-v2-3#answer-40411121

Any advice on how to achieve this on ChartJS 2.5.0?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

14reactions
potatopeelingscommented, Feb 17, 2017

You need to remove the barThickness property from your configuration. See https://jsfiddle.net/07pzys9t/1/

The barPercentage and categoryPercentage (the default values are 0.9 and 0.8) are used to size the bar only if barThickness is not set.

4reactions
tonix-tuftcommented, Feb 18, 2017

Thanks great, thank you, but how can I then set the width of each bar also? I mean, I still want the bars to be 45 pixels width and be one after the other without any space between two bars.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove whitespace on chart between columns and ...
For the first char, you need to select the chart and resize the columns area, you might need to remove the chart title...
Read more >
How to get Excel Chart Columns with no gaps - AuditExcel
In order to do this you can right click on any one of the data series and choose Format Data Series. You will...
Read more >
remove the space between the bars in a bar chart? - MathWorks
You can set the bar width to any fraction between 0 and 1 that you want. 3 Comments. ShowHide 2 older comments.
Read more >
Remove spaces between bars in barchart - Stack Overflow
I was able to figure it a solution to this question. I add the part in bold, and that finally allowed me to...
Read more >
Remove Spaces between bars in bar chart - Qlik Community
Hi, I had created a bar chart which contains spaces between bars. I need to remove spaces and combine bars. I attached a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found