chartjs / chartjs/Chart.js

Refactor Legend Implementation for V5

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

Description

The v3 legend implementation is largely carried over from v2 and needs a refactor to match the scriptable options introduced in v3 while at the same time resolving long standing pain points in the code. This ticket is to track that refactor, but since this will be a breaking change it will not be possible to introduce this until v4.

## State Changes

* The legend items & hitboxes state should be combined into a single object

## Option Changes

* `generateLabels` should not be responsible for determining the item styles. Should consider renaming to `generate`
* A legend context should be created for scriptable options
* Disabled styling should be a property of the scriptable context

## Code Changes

* All of the RTL handling should be moved from the draw method to the fit method
* The drawing should be a simple loop over the items to draw based on pre-computed properties

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.