Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend sort function #9505

Closed
2 tasks
zensabbah opened this issue Aug 1, 2021 · 5 comments · Fixed by #9524
Closed
2 tasks

Legend sort function #9505

zensabbah opened this issue Aug 1, 2021 · 5 comments · Fixed by #9524

Comments

@zensabbah
Copy link

Documentation Is:

  • [X ] Missing or needed
  • Confusing
  • Not Sure?

Please Explain in Detail...

Not knowing the return value of sort function.

Your Proposal for Changes

Add an example of how it works the sorting of legend with some examples

Example

https://www.chartjs.org/docs/latest/configuration/legend.html#legend-title-configuration

@LeeLenaleee
Copy link
Collaborator

It is working in the same way normal sorting with .sort() in js is also working.

Example: https://jsfiddle.net/Leelenaleee/az12rwho/5/

@zensabbah
Copy link
Author

Hi @LeeLenaleee , thanks a lot for your example!
What about if I have more than three datasets?
The sort function accept only two datasets....

@LeeLenaleee
Copy link
Collaborator

That is just how the sort function works, if you want to know more about it click on the sort link in my first comment, there you can read more about it in the official dpcumentation

@runegame
Copy link

runegame commented Aug 4, 2021

We can add the example as part of the documentation. It is quite explanatory.

@zensabbah
Copy link
Author

That is just how the sort function works, if you want to know more about it click on the sort link in my first comment, there you can read more about it in the official dpcumentation

I don't understand why the chartjs function should work as the sort native javascript function cause the receiving parameters are different.
In my opinion, it's always easier and faster and helping give an example/solution than say "Yes it's possible! Just study the doc!"
If there was a better chartJs doc probably I could have studied it :)

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

Successfully merging a pull request may close this issue.

4 participants