Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - 日本語 -
Справка Scilab >> Графики > Datatips > datatipSetDisplay

datatipSetDisplay

Set the function used to compute the datatip string.

Syntax

datatipSetDisplay(handle,"fun")
datatipSetDisplay(handle, fun)

Arguments

handle

A handle on a datatip or its parent.

"fun"

A variable that contains a function (type==11 or type==13) or the name of this function. This function syntax must be str=fun(h) where h is the handle of the datatip.

This function must return a string or a vector of strings in str.

Description

Set the function used to format the text to be displayed at the datatip point. If the handle of the parent of the datatip is given as first argument, then all the datatips which don't have a display function will have same one.

Examples

x=linspace(-1,1,1000);
clf()
plot(x,sinc(20*x),x,1-x.^2);
e=gce();e=e.children;
d21=datatipCreate(e(2),600);
d1=datatipCreate(e(1),700);

function str=mydisplay(h)
    pt = h.data;
    str=msprintf('sinc(%-0.2g)=%-0.2g', 20*pt(1),pt(2))
endfunction
datatipSetDisplay(d21,"mydisplay")
The display function can also be used to place tip text in different locations:
function str=infodisplay(h)
    pt = h.data;
    xinfo(msprintf('x=%0.2g,\t 1-x^2=%0.2g', pt(1),pt(2)))
    str=''
endfunction
datatipSetDisplay(d1,"infodisplay") //tip text displayed in the info bar

See also

  • datatips — Tool for placing and editing tips along the plotted curves.
  • datatipSetOrientation — Set the position of the text box associated with the given tip.
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:13:26 CET 2017