chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.36k stars 11.89k forks source link

Overlapping Y-axis labels #5156

Closed boriskogan81 closed 4 years ago

boriskogan81 commented 6 years ago

I have this Y-axis object:

{
    id: 'events',
    type: 'category',
    labels: this.state.eventLabelArray),
    scaleLabel: {
        display: true,
        labelString: 'Phenology'
    },
    ticks: {
        autoSkip: true
    }
}

Despite autoSkip being declared as "true," it's not working-each label is rendered, none are skipped:

image

If I de-duplicate the labels, the data is no longer mapped in the tooltip:

{
    id: 'events',
    type: 'category',
    labels: Array.from([...new Set(this.state.eventLabelArray)]),
    scaleLabel: {
        display: true,
        labelString: 'Phenology'
    },
    ticks: {
        autoSkip: true
    }
}

image

etimberg commented 6 years ago

I believe the issue here is that the label auto skipper is not implemented for vertical axes. I think another ticket already covers this but I can't find it

ximex commented 5 years ago

i also got this issue if i set a custom min/max value in the ticks object and the min/max value is only a little bit above/under the auto labeled values

benmccann commented 5 years ago

I'm pretty sure the auto skipper is implemented for vertical axes: https://github.com/chartjs/Chart.js/blob/32aeeac82cdc371b6eb15e0b3442d307e2f36df7/src/core/core.scale.js#L629. But it sounds like maybe there's a bug where it's not working correctly

kurkle commented 5 years ago

auto skipper is enabled for vertical in master only (PR #5922), so probably fixed.

ximex commented 5 years ago

is there a date for the next release?

benmccann commented 5 years ago

TBD. I think we'd like to get a number of pending PRs merged first

kurkle commented 4 years ago

Was this resolved?

etimberg commented 4 years ago

Going to call this resolved since 2.9 shipped with these changes