Use below to move Recharts legend to top of the graph. In fact you can position the legends any where (top, right, bottom , left, left top, left middle etc) you like. I have added few code samples for that corresponding images. Please go through it.
<Legend layout="horizontal" verticalAlign="top" align="center" />
I am using a Pie chart, so the above code will show legend on top of the chart and it looks like this.

Lets try few other styles
<Legend verticalAlign="middle" align="center" />

<Legend verticalAlign="bottom" align="center" />

<Legend layout="vertical" verticalAlign="middle" align="right" />

<Legend layout="vertical" verticalAlign="top" align="right" />

The overall code looks like this.
