chartjs / chartjs/Chart.js

Support Legend Text Styling (To Visualize Hover)

Open
#11,571 3 comments 6 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

### Feature Proposal

## Proposal

I propose to to add a new `fontStyle` property (or something similar) to the [LegendItem interface](https://www.chartjs.org/docs/latest/api/interfaces/LegendItem.html).

This should allow at least the following values:
- 'normal' (DEFAULT)
- 'bold'
- 'underlined'

## Use Case

We use an on click handler to hide datasets using the legend. This is currently a 'hidden feature' as there is no visual clue to the user that the legend is an interactive user element. You have to know it or read the documentation.

To increase accessibility, we would like to change the text style of the currently hovered element to 'bold' or 'underlined'.

## Side Note

This could be a general pattern to implement for other labels in ChartJS.

### Possible Implementation

_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.