There are 2 ways to do it.
1. From Script.
You can create a sorting in script using the same if statements you used for creating the bucket, or you can use inline load to assign the sort.
2. On Sort tab in chart.
You can choose "Sort by Expression" option and write your own sorting using if statements.