If you want to change the order of all classes try the left to right direction, but note that it changes the ranking order from left to right, the default is top to bottom direction.
Using top to bottom direction you must increase the line lenght to increase a Graphviz rank and put the class bellow the other one:
@startuml
class a
class b
a -d-> b
@enduml