Rev 4230 | Rev 4908 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
!if $wims_read_parm!=slib_header
!goto proc
!endif
slib_author=Adeline, Grelot ; Bernadette, Perrin-Riou; Sophie, Lemaire
slib_example= [10,5,2,3,10,13],[3,4,6,7,12,14,16],xtics [A1,A3,A6,8,10,12,14],ytics 10, color salmon,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics [a,b,c,d,e,f],ytics 10, color salmon,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics,ytics 15, color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics [a,b,c,d,e,f],ytics 15, color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics 5,ytics 15,color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics,ytics 15, baton,color green,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics [a,b,c,d,e,f,g],ytics 15, baton,color green,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics 5,ytics 15,baton,color green,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics,ytics 15, step,color red,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics [a,b,c,d,e,f],ytics 15,step, color red,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,22],xtics 5,ytics 15,step,color red,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics,ytics 15, stem,color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics [a,b,c,d,e,f],ytics 15, stem,color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14],xtics 5,ytics 15,stem,color blue,html\
[1,5,2,3,10,13],[3,4,6,7,12,14,14.1],xtics,ytics,stair,color blue,html
!exit
:proc
slib_parm=
slib_out=
!reset slib_optx, slib_opty, slib_couleur,slib_baton,slib_pdata, slib_grad,slib_listx,slib_listxx, slib_param, slib_parm slib_option
slib_data=!item 1 to 2 of $wims_read_parm
slib_parm= !item 3 to -1 of $wims_read_parm
!readproc slib/stat/dataproc $slib_data
slib_u= $slib_x
slib_w= $slib_y
slib_u=!declosing $slib_u
slib_cntu=!itemcnt $slib_u
slib_w=!declosing $slib_w
!if $slib_w=$empty
slib_w=!values x for x=1 to $slib_cntu
!endif
slib_cnt=!itemcnt $slib_w
!if $slib_cnt = 2
slib_begin=!item 1 of $slib_w
slib_pas=!item 2 of $slib_w
slib_w=!values $slib_begin+x*$slib_pas for x = 0 to $[$slib_cntu+1]
slib_cnt=!itemcnt $slib_w
!endif
slib_w=!sort numeric item $slib_w
slib_x1=!item 1 of $slib_w
slib_x2=!item -1 of $slib_w
slib_ocnt=!itemcnt $slib_parm
!for slib_i=1 to $slib_ocnt
slib_param=!item $slib_i of $slib_parm
slib_param=!words2items $slib_param
!if xtics isitemof $slib_param
slib_optx=1
slib_param=!replace xtics by $ in $slib_param
slib_param=!nonempty item $slib_param
slib_param=!nospace $slib_param
slib_param=!declosing $slib_param
slib_cnt_ticx=!nonempty item $slib_param
slib_c=!itemcnt $slib_cnt_ticx
!if $slib_c=1
slib_arrondi=$[ceil(($slib_x2-$slib_x1)/$slib_cnt_ticx)]
slib_cnt_arr=0
!if $slib_arrondi<1
!for slib_h=1 to 10
!if $[floor($slib_arrondi)] <>0
!break
!else
!advance slib_cnt_arr
slib_arrondi=$[$slib_arrondi*10]
!endif
!next slib_h
slib_arrondi=$[$slib_arrondi/10^($slib_cnt_arr)]
!else
!for slib_h=1 to 10
!if $[floor($slib_arrondi)] = 0
!break
!else
!advance slib_cnt_arr
slib_arrondi=$[$slib_arrondi/10]
!endif
!next slib_h
slib_arrondi=$[$slib_arrondi*10^($slib_cnt_arr)]
!endif
slib_listx=!values $[$slib_arrondi*floor($slib_x1/$slib_arrondi)]\
+x*$slib_arrondi for x=0 to $[$slib_cnt_ticx+1]
slib_listxx=$slib_listx
!else
slib_listx= $slib_param
slib_listxx=$slib_w
!endif slib_c
!endif xtics
!if ytics isitemof $slib_param
slib_opty=1
slib_param=!replace ytics by $ in $slib_param
slib_param=!nonempty item $slib_param
slib_param=!words2items $slib_param
slib_param=!declosing $slib_param
slib_param=!nonempty item $slib_param
slib_pcnt=!itemcnt $slib_param
!if $slib_pcnt=1
slib_ra=$slib_param
!endif
!endif ytics
!if color isitemof $slib_param
slib_param=!replace color by $ in $slib_param
slib_param=!nonempty item $slib_param
couleur=$slib_param
!endif
!if $slib_param iswordof baton stem step stair
slib_baton=$slib_param
!endif
!if $slib_param iswordof html url
slib_option=$slib_param
!endif
!next slib_i
!default slib_optx=0
!default slib_opty=0
!default couleur=red
!default slib_listx=$slib_w
!if $slib_cnt <= $slib_cntu and $slib_baton notwordof baton stem
slib_w = !append item $[$(slib_w[$slib_cnt])+1] to $slib_w
!increase $slib_cnt
!endif
!default slib_ra=5
slib_listx=!declosing $slib_listx
slib_y1=0
slib_y2=0
slib_uu=
!if $slib_baton iswordof baton stem
slib_ww=
!if $slib_baton iswordof stem
slib_r=0
!else
slib_r=$[($slib_x2-$slib_x1)/(($slib_cntu)*4)]
!endif
!for slib_i = 1 to $slib_cntu
slib_j=!item $slib_i of $slib_w
slib_ww=!append item $[$slib_j+1-$slib_r],$[$slib_j+1+$slib_r] to $slib_ww
slib_j=!item $slib_i of $slib_u
slib_uu=!append item $slib_j,0 to $slib_uu
!next slib_i
slib_uu=!append item 0 to $slib_uu
slib_w1=$slib_ww
slib_ww=$slib_w
slib_w=$slib_w1
slib_x1=!item 1 of $slib_w
slib_x2=!item -1 of $slib_w
slib_y2=!sort numeric item $slib_u
slib_y2=!item -1 of $slib_y2
slib_cnt=!itemcnt $slib_w
slib_cnt=$[$slib_cnt+1]
!else
!if $slib_baton iswordof step stair
slib_uu=$slib_u
slib_x1=!item 1 of $slib_w
slib_x2=!item -1 of $slib_w
slib_y2=!sort numeric item $slib_u
slib_y2=!item -1 of $slib_y2
slib_cnt=!itemcnt $slib_w
slib_cnt=$[$slib_cnt]
!else
slib_uu=
!for slib_i=1 to $[$slib_cntu]
slib_it=!item $slib_i of $slib_u
slib_inf=!item $slib_i of $slib_w
slib_sup=!item $[$slib_i+1] of $slib_w
slib_it=$[$slib_it/($slib_sup-$slib_inf)]
slib_y2=$[max($slib_y2,$slib_it)]
slib_uu=!append item $slib_it to $slib_uu
!next slib_i
!endif
slib_ww=$slib_w
!endif
slib_y2=$[$slib_y2*1.1]
slib_pas=$[ceil($slib_y2/$slib_ra)]
slib_ord=0
slib_d=$[($slib_x2-$slib_x1)/5]
slib_minx=$[$slib_x1*1.01]
!if $slib_opty !=0
!for slib_i=1 to $slib_ra
slib_ord=$[$slib_pas+$slib_ord]
!if $slib_ord <$[$slib_y2+$slib_pas]
slib_grad=!append line text black,$[$slib_minx-$slib_d],$slib_ord,small,$slib_ord to $slib_grad
slib_grad=!append line segment $[$slib_minx-$slib_d/5],$slib_ord,$[$slib_minx+$slib_d/5],$slib_ord,grey\
vline $slib_minx,0,grey to $slib_grad
!endif
!next slib_i
!endif
!if $slib_optx!=0
!if $slib_listxx=$empty
slib_listxx=$slib_ww
!endif
slib_cnt_ticx = !itemcnt $slib_listxx
!for slib_i=1 to $[$slib_cnt_ticx]
slib_wi=!item $slib_i of $slib_listx
slib_wj=!item $slib_i of $slib_listxx
!if $slib_baton iswordof baton stem
slib_wj=$[$slib_wj+1]
!endif
slib_grad=!append line text black,$slib_wj,$[$slib_y1-($slib_y2-$slib_y1)/10],small,$slib_wi to $slib_grad
slib_grad=!append line line $slib_wj,$[$slib_y1-($slib_y2-$slib_y1)/30],$slib_wj,$[$slib_y1+($slib_y2-$slib_y1)/30], grey to $slib_grad
!next slib_i
!endif
slib_pdata=xrange $[$slib_minx-$slib_d],$[$slib_x2+$slib_d]\
yrange $[min(1,$slib_y1-($slib_y2-$slib_y1)/5)],$[$slib_y2]\
$slib_grad
!if stair notwordof $slib_baton
slib_pdata=$slib_pdata\
lines $couleur
!else
slib_points= linewidth 4\
points $couleur
!endif
!if stair notwordof $slib_baton and step notwordof $slib_baton
!for slib_i=1 to $[$slib_cnt]
slib_inf=!item $slib_i of $slib_w
slib_sup=!item $[$slib_i+1] of $slib_w
slib_f=!item $slib_i of $slib_uu
slib_pdata=!append item $slib_inf,0,$slib_inf,$slib_f,$slib_sup,$slib_f,$slib_sup,0 to $slib_pdata
!next slib_i
!endif
!if step iswordof $slib_baton
!for slib_i=1 to $[$slib_cnt]
slib_inf=!item $[$slib_i] of $slib_w
slib_sup=!item $[$slib_i+1] of $slib_w
slib_f=!item $slib_i of $slib_uu
slib_pdata=!append item $slib_inf,$slib_f,$slib_sup,$slib_f to $slib_pdata
!next slib_i
!endif
!if stair iswordof $slib_baton
!for slib_i=1 to $[$slib_cnt]
slib_inf=!item $[$slib_i] of $slib_w
slib_sup=!item $[$slib_i+1] of $slib_w
slib_f=!item $slib_i of $slib_uu
slib_pdata=!append line line $slib_inf,$slib_f,$slib_sup,$slib_f,$couleur to $slib_pdata
!if $slib_i < $[$slib_cnt]
slib_points=!append item $slib_inf,$slib_f to $slib_points
!endif
!next slib_i
!endif
slib_out=$slib_pdata\
$slib_points\
linewidth 1\
hline 0,0,grey
!if url iswordof $slib_option or html iswordof $slib_option
insdraw_size=500,200
!insdraw $slib_out
slib_out=$ins_url
!if html iswordof $slib_option
slib_out=<img src="$ins_url" alt="">
!endif
slib_out=$slib_out,$insdraw_size
!endif