Skip to content

Scaled bar width fix#2326

Merged
etimberg merged 1 commit into
chartjs:masterfrom
johnw86:master
Apr 22, 2016
Merged

Scaled bar width fix#2326
etimberg merged 1 commit into
chartjs:masterfrom
johnw86:master

Conversation

@johnw86

@johnw86 johnw86 commented Apr 22, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
Member

Merged. Thanks @johnw86

@mealy

mealy commented Aug 11, 2016

Copy link
Copy Markdown

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