Graph label direction changes depending on the position of the cursor