Expose API endpoint to order Legend's entries.

Close #1408.
Maybe "`sortEntriesBy`"?