'Vega-Lite: More Complex Sort Functions
https://vega.github.io/vega-lite/docs/sort.html
Is there a way to pass in a more complex sort to a vega lite chart? For example could I pass something like a javascript function in to work as a comparator?
Solution 1:[1]
As far as I know, it's not possible to directly pass in a custom sort function directly.
However, you could calculate a custom field using the calculate transformation to create a new field with the expression language (which is a subset of Javascript) , then use that field to perform your sort.
If you have a custom javascript function that you'd like to call from inside the expression language, you can register it using the Vega extension API, and then use it in your calculate transform.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cameron Yick |
