The court or judge may, in his discretion, order a reference to the referee agreed upon by the parties, or appointed by him, to report the evidence or the facts. The appointment of the referee may be made in the first order or at any time. (C.C.P., s. 272; Code, s. 498; Rev., s. 683; C.S., s. 726.)