Skip to content

fix: allow colors as array#10075

Merged
kurkle merged 4 commits into
chartjs:masterfrom
LovelyAndy:patch-1
Feb 5, 2022
Merged

fix: allow colors as array#10075
kurkle merged 4 commits into
chartjs:masterfrom
LovelyAndy:patch-1

Conversation

@LovelyAndy
Copy link
Copy Markdown
Contributor

There are some charts where I need to use different label colors per label.
Using a string[] for the label color seems to work, but TS won't allow it.
This PR fixes the types to allow that.

@etimberg
Copy link
Copy Markdown
Member

Where specifically are you passing the colors as an array? I don't think all spots that accept colours accept arrays of colours, so I'm not sure this change is the correct one to make.

@etimberg etimberg added the type: types Typescript type changes label Jan 15, 2022
@LeeLenaleee
Copy link
Copy Markdown
Collaborator

LeeLenaleee commented Jan 15, 2022

This will break some parts since in the typing some things are defined as an array of collors like here: https://github.com/chartjs/Chart.js/blob/master/types/index.esm.d.ts#L2822

Which will make a double array valid which isn't supported

@LovelyAndy
Copy link
Copy Markdown
Contributor Author

@LeeLenaleee Thank you very much. Updated the PR to make the change under TickOptions!

Copy link
Copy Markdown
Collaborator

@LeeLenaleee LeeLenaleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread types/index.esm.d.ts Outdated
@kurkle kurkle added this to the Version 3.7.1 milestone Jan 16, 2022
Co-authored-by: Jacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>
@LovelyAndy
Copy link
Copy Markdown
Contributor Author

@kurkle Thanks! Updated as per your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: types Typescript type changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants