1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) 2011 - INRIA - Serge Steer <serge.steer@inria.fr> 3// 4// Copyright (C) 2012 - 2016 - Scilab Enterprises 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 datatipSetTipStyle(tip_handle,style) 14 //datatip utility function 15 point_handle=tip_handle.children(1) 16 string_handle=tip_handle.children(2) 17 bg=addcolor([255 255 238]/255); 18 tip_refs=point_handle.user_data 19 [curve_handle,k]=tip_refs(1:2) 20 21 pt=point_handle.data(1,:) 22 23 //label 24 if style(3)==0 then //no label 25 string_handle.visible="off" 26 else 27 string_handle.visible="on" 28 end 29 if style(2)==1 then //boxed 30 string_handle.background=bg; 31 string_handle.box="on"; 32 string_handle.fill_mode="on"; 33 string_handle.font_foreground=curve_handle.foreground; 34 else 35 string_handle.box="off" 36 string_handle.foreground=color("gray"); 37 string_handle.fill_mode="off"; 38 string_handle.font_foreground=curve_handle.foreground; 39 end 40 string_handle.clip_state="off"; 41 if string_handle.user_data<>[] then //preserve orientation if any 42 orient=string_handle.user_data(1) 43 else 44 orient=0; 45 end 46 string_handle.user_data=[orient style(2)] 47 48 //marker 49 point_handle.mark_style=11; 50 point_handle.mark_size_unit="point"; 51 point_handle.mark_size=6; 52 select style(1) 53 case 1 then //square marker 54 point_handle.data= pt 55 point_handle.mark_mode="on"; 56 point_handle.mark_background=bg; 57 point_handle.mark_foreground=curve_handle.foreground; 58 point_handle.arrow_size_factor = 0; 59 case 2 then //directional arrow marker 60 61 //compute tangeant 62 tip_refs=point_handle.user_data 63 [curve_handle,k]=tip_refs(1:2) 64 if k<size(curve_handle.data,1) 65 dxy=(curve_handle.data(k+1,:)-pt)/100000; 66 else 67 dxy=(pt-curve_handle.data(k-1,:))/100000; 68 end 69 point_handle.data=[pt;pt+dxy] 70 //set properties 71 point_handle.mark_background=curve_handle.foreground; 72 point_handle.mark_foreground=curve_handle.foreground; 73 point_handle.mark_mode="off"; 74 point_handle.arrow_size_factor = 1.5; 75 point_handle.polyline_style = 4; 76 point_handle.foreground=curve_handle.foreground; 77 end 78 if style(3)<>0 then setStringPosition(tip_handle,pt),end 79endfunction 80