Skip to content

scale.ticks.autoSkip unnecessarily skips ticks in certain cases #8611

@Auburn

Description

@Auburn

Expected Behavior

scale.ticks.autoSkip = true should only skip ticks when reaching visual space constraints

Current Behavior

Ticks get hidden even if rotation of the labels would allow them to fit. Hidden labels will reappear if the chart is shrunk enough to force the labels to rotate.

Possible Solution

Tick labels should always attempt label rotation in order to fit before allowing them to be skipped

Steps to Reproduce

https://jsfiddle.net/r2zfgyw5/
Preview width >= 1194px : All ticks (labels) on the X axis are shown (not rotated)
< 1194px : Every other tick is hidden (not rotated)
< 1083px : All ticks are shown (rotated)
< 361px : Every other tick is hidden (rotated)

ChartjsScale

Every other tick is hidden (not rotated)

This state should not exist, it causes ticks to disappear then reappear while scaling down the size of the chart. The px range where this state occurs seems to be linked to label length, longer labels cause this state to have a larger px range

Context

I have a chart with long labels so I would like to use scale.ticks.autoSkip = true but I don't want information to be hidden unnecessarily

Environment

Chart.js V3 Beta13 (issue not present in v2.9.4)
Chrome Version 88.0.4324.190

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions