sorry for the delay of replying your message.
I need to declare more infor here.
What the sort I want is to display
I apply the same option for both two stacked bar charts the only difference is the data.
Sort is defined in the qlik sense script.
Due to the data issue which in the first bar chart 2014 without Banana sales you will see the legend sort is
Apple,Custard Apple,Banana(This is not the correct sort)
But when Banana with 2014 Sales you will see the legend display correctly