Generalizing the Single-Crossing Property on Lines and Trees to Intermediate Preferences on Median Graphs