I am wondering how to sort ascending and descending order when there are two x-axis in a bar chart

In the above figure, when it is a stacked bar chart, how can I change each stacked chart to ascending and descending order?

I have the code in the picture above in my Code Pen.

Code Pen URL: https://codepen.io/datajang/pen/bGYMxJL

Even if I apply to the layout
transforms: [{
type: ‘sort’,
target: ‘y’,
order: ‘descending’
}]

ascending and descending order does not work.

help me plz T.T

Sorry for the late answer, but i was searching for the same thing and i ended up here.

AFAIK there is no way to do this, but all you have to do is change the order of your data.

your first plot data is "x": ["female", "male"], "y": [85.9507, 201.7915] so the bar with 85.95 is going to be the first one to render, simple as that.