Subversion Repositories wimsdev

Rev

Rev 3307 | 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_title=Droite graduée
slib_parms=7\
600,largeur de l'image\
-5,abscisse minimale\
5,abscisse maximale\
1,finesse de la graduation des abscisses 1 0.1 ou 0.01\
black,couleur des axes\
grey,couleur de la graduation\
40,marge

slib_author=Fabrice Guerimand 
slib_out=Les données pour insdraw.
!exit


:proc
slib_input=$wims_read_parm

!distribute items $slib_input into xsize,xmin,xmax,xgd,colora,colorg,marge
slib_out=$slib_input

!bound xsize between 200 and 1500 default 600
!bound marge between 20 and 100 default 40
!bound xmin between -50 and 50 default -5
!bound xmax between -50 and 50 default 5
!if $xmin>$xmax
 tmp=$xmin
 xmin=$xmax
 xmax=$tmp
!endif
!bound xgd within 1,0.1,0.01 default 1
!default colora=black
!default colorg=grey

ex=$[($xsize-2*$marge)/($xmax-$xmin)]
minx=$[$xmin-$marge/$ex]
maxx=$[$xmax+$marge/$ex]
delet=$[4/$ex]

slib_out=range $minx,$maxx,-3,3\
linewidth 2\
arrow $minx,0,$maxx,0,$marge/2,$colora\
linewidth 3\
parallel $xmin,-1,$xmin,1,1,0,$[$xmax-$xmin+1],$colorg
!for k=$xmin to $xmax
 tmp=text $colora,$k-$delet,-1.5,medium,$k
 slib_out=!append line $tmp to $slib_out
!next k
!if $xgd<=0.1
 tmp=linewidth 2\
parallel $xmin,-0.6,$xmin,0.6,0.1,0,$[($xmax-$xmin)*10],$colorg
 slib_out=!append line $tmp to $slib_out
!endif
!if $xgd<=0.01
 tmp=linewidth 1\
parallel $xmin,-0.2,$xmin,0.2,0.01,0,$[($xmax-$xmin)*100],$colorg
 slib_out=!append line $tmp to $slib_out
!endif