[Scilab-users] how to place datatip on one point of polyline

Erhy erhard.glueck.austria at gmail.com
Tue Mar 28 12:56:28 CEST 2017


Samuel GOUGEON wrote
> Let's have the following vector of x or/and y values/nodes:
> A  B  C %nan D %nan  E  F
> 
> a) A datatip set in C is not displayed => bug
> b) But A datatip set in E is displayed: OK
> c) A datatip set in D is not displayed = a) case

Example
<http://mailinglists.scilab.org/file/n4036059/datatipbspV5.png> 
code:
// test of DataTips suggested by Samuel GOUGEON
// datatips in sequence:  A  B  C %nan D %nan  E  F 
function str=ShowTip_txt(h)
str = h.tag;
endfunction
function TipIx= ShowTips()
x1=linspace(0,1,13)';
y1=sinc(10*x1);
TipIx = round( length(y1) ./ 2 ) + 2; 
// A  B  C %nan D %nan  E  F 
y_red=ones(y1) .* %nan;
t_redRang = [(TipIx-4 : TipIx-2), TipIx, (TipIx+2 : TipIx+3)];
t_redPois = 1 : length(t_redRang);
y_red(t_redRang) = 0.05 .* t_redPois + 0.5 ;

y_blue=ones(y1) .* %nan ;
y_blue( TipIx-1 : TipIx+1 ) = -0.35;
clf();
hw = gcf();
t_redPois_Interp = %f;
figname1="DataTipInterpolation ";
if t_redPois_Interp then figname2="True" else figname2="False" end
figname3=" on red curve";
figname=figname1+figname2+figname3;
hw.figure_name = figname; //e.g."DataTipInterpolation True on red curve"
plot2d(x1,[y1,y_red,y_blue], style=[color("black"), color("red"),
color("blue")] );
e=gce();
p_blue=e.children(1);
p_blue.mark_style=5;// mark with diamond 
p_red=e.children(2);
p_red.mark_style=1;// mark with + 
p_red.thickness=2;
p_red.mark_foreground=color("red");
TipsABC_red = ascii("A");
for i = t_redPois
	t_reds(i)=datatipCreate( p_red, t_redRang(i));
	datatipSetInterp( t_reds(i), t_redPois_Interp);
	TipsABC_red = TipsABC_red + 1;
	t_reds(i).tag = char(ascii("A")-1+i);
	datatipSetDisplay(t_reds(i), "ShowTip_txt")
end
t_blue=datatipCreate(p_blue, TipIx);
t_blue.font_foreground=color("blue");
t_blue.font_size=3;
datatipSetOrientation(t_blue,"upper left")
t_blue.box_mode="off";
t_blue.tag = "on the red curve each point should show a tip!";
datatipSetDisplay(t_blue,"ShowTip_txt")
//pause
endfunction




--
View this message in context: http://mailinglists.scilab.org/how-to-place-datatip-on-one-point-of-polyline-tp4036034p4036059.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list