chartjs / chartjs/Chart.js

Cutting off / Adding ellipsis for long labels

Open
#10,466 9 comments 5 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

As example, I have bar chart with some long labels on horizontal line. The main problem is that the chart and other labels can be hidden by this reason.

I tried to find the attribute that would helped me to dynamically calculate cutting off or adding ellipsis for these labels, but I can't.

### Current behavior

First long label contains all canvas space. I can't see the chart and other labels for this reason.

### Reproducible sample

https://codepen.io/corocoto/pen/abYdJBG

### Optional extra steps/info to reproduce

_No response_

### Possible solution

I propose to add attribute for these labels, that allows to dynamically calculate cutting off or adding ellipsis.

### Context

My project has the separate page for widgets. I can add it by drag-and-drop approach, and easily changing it size on edit mode.

If one of the widgets will be small, but labels'll large - the problem can be reproduce.

### chart.js version

latest

### Browser name and version

_No response_

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.