Skip to content

[BUG] Legend hides second column if has only one element #5491

@Don-Pat

Description

@Don-Pat

I am using Chart.js 2.7.2.

I have this chart where I have a variable number of line datasets I add or remove real time.
The legend is on the right, but there is this problem:
-Up until 14 datasets there is no problem: the legend shows only one column. (first snapshot)
-Here is the issue: If I have exactly 15 datasets, the last one goes on the second column and it becomes partially hidden and unclickable. (second snapshot)
-However, If I have more than 15 datasets, it works as intended: it shows two columns. (third snapshot)

14 datasets 15 datasets 16 datasets

This happens every time the "new column" has only one element (eg 29 or 43 datasets in my example) and the canvas is responsive to his container size.

I set up this jsfiddle showing the issue: http://jsfiddle.net/jkgsLg7e/6/
You can use the DATASETS variable to play with the number of datasets.

It looks like there is a bug in the way the chart decides to resize itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions