The pie chart classification and sorting problem is the same SQL problem. After order by ascending sorting, a pie chart is formed. Some sorting is successful and some sorting is unsuccessful, but the sorting in the list is successful, but the sorting in the pie chart fails.
Odd, works from a question rather than a query.
If you create a model from your query, then base the pie chart on the model, does it work?
You also need to say which version you're using. I'm testing of 50.15 but the latest is 50.17.