Skip to content

Conversation

@johnw86
Copy link
Contributor

@johnw86 johnw86 commented Apr 22, 2016

Add logic for calculating bar width when ticks are less than the data labels

Issue: #2323

Add logic for calculating bar width when ticks are less than the data labels
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 71.905% when pulling 87966a1 on johnw86:master into 8e37b81 on nnnick:master.

@etimberg etimberg merged commit da02c6c into chartjs:master Apr 22, 2016
@etimberg
Copy link
Member

Merged. Thanks @johnw86

@mealy
Copy link

mealy commented Aug 11, 2016

One Note - this fix only helps the non-stacked cases.
To fix the same problem in stacked cases you have to also modify categoryWidth.

ie

    if (xScale.ticks.length !== me.chart.data.labels.length) {
       var perc = xScale.ticks.length / me.chart.data.labels.length;
       fullBarWidth = fullBarWidth * perc;
       categoryWidth = categoryWidth * perc;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants