Search code examples
visualizationvega-litevegavega-lite-apivega-embed

How do I display data in same sequence as my data in vegalite horizontal chart


I am trying to create a horizontal bar chart in vegalite. My issue is that the data sequence is not the same as data given. I want a sequence from bottom to top, meaning the first data I provided at bottom and others following upwards in the display.

chart with results in wrong order

I want first then over it Second then over it third, i.e. follow my data sequence. Editor link


Solution

  • Change the "S" in second to lower case and it will sort correctly for you. It is sorting alphabetically so if you want a different sort order, you will need to provide an additional sort field.

    enter image description here