1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 1985 - 2010 - INRIA - Serge Steer
3// Copyright (C) 2012 - 2016 - Scilab Enterprises
4// Copyright (C) 2018 - Samuel GOUGEON
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function str = formatBodePhaseTip(datatipHandle)
14    // This function is called by the datatip mechanism to format
15    // the tip string for the bode phase curves
16
17    unit = gettext("Hz")
18    a = datatipHandle.parent.parent;
19    while a.type~="Axes", a = a.parent, end
20    unit2 = gettext("rad/s")
21    if grep(a.x_label.text, unit2)~=[] then
22        unit = unit2
23    end
24
25    pt = datatipHandle.data(1:2)
26    str = msprintf("%.4g "+unit+"\n%.4g"+" °", pt(1), pt(2));
27endfunction
28