VegaLite.jl; sorting problematic

I looked on the site to translate some things to see hoe and if it worked: https://vega.github.io/vega-lite/docs/sort.html#sorting-discrete-fields

If I want to use for some channel (y) the x channel, then taking their example doesn’t work and gives no result, unless I use

# ...
y = {
  # ...
  sort = {
    encoding = :x
  }
# etc.

In this case the x values are used in ascending order, which may be fine, but if you want to use them in descending order, knowing that without the encoding keyword nothing works (or a blank screen is shown), you might try in that above example instead of :x "-x". For some reason this doesn’t work either giving a blank screen.

How to solve it?

I wonder whether that is a vega-lite 4.0.0 feature? vega-lite 4.0.0 is in beta and not released, but unfortunately the official vega-lite documentation always reflects the latest work-in-progress version, not the latest released version. This is really kind of frustrating, that there are often things in the documentation that will only be available in the next version… Not sure whether that explains this particular example, but I have a vague memory that sorting got some new features for 4.0.0.

If that is so, then we just have to wait until they release 4.0.0, and then I’ll make an update for VegaLite.jl that reflects that version.

1 Like

Thanks. Very clear.

They actually released vega-lite 4.0.0 yesterday, and I think I should have support for vega-lite 4.0.0 on VegaLite#master within the hour :slight_smile:

5 Likes

Great. I will have to check that out.