Subversion Repositories wimsdev

Rev

Rev 7692 | Blame | Compare with Previous | Last modification | View Log | RSS feed

!if  $wims_read_parm!=slib_header
  !goto proc
!endif

slib_author=Georges, Khaznadar

slib_example= ,,,,,,,,,0,0,1.2,1.5,2.4,3.2\
12,8,0,0,1 max t (ms),1 max U (V),blue,red,[255,128,128],[,1,1,,Hello at 1,1],[red,5,2,large,Large red hello at 5,2]

!exit

:proc

!reset slib_xd, slib_yd, slib_bg, slib_lc, slib_dc, slib_strings, slib_xo, slib_yo, slib_xs, slib_ys, slib_labx, slib_laby, slib_maxx, slib_maxy

slib_parm=!item 1 to 9 of $wims_read_parm
!distribute item $slib_parm into slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_bg, slib_lc, slib_dc

slib_strings=!item 10 to -1 of $wims_read_parm

!default slib_xd=8
!default slib_yd=8
!default slib_xo=1
!default slib_yo=1
!default slib_xs=1
!default slib_ys=1

slib_labx=!word 2 to -1 of $slib_xs
slib_laby=!word 2 to -1 of $slib_ys
slib_xs=!word 1 of $slib_xs
slib_ys=!word 1 of $slib_ys

slib_maxx=!word 1 of $slib_labx
!if $slib_maxx = max
  slib_labx = !word 2 to -1 of $slib_labx
  !! we need to compute the X step slib_xs, given the values
  !! of the total width slib_xd, abscissa of origin slib_xo
  !! and knowing that slib_xs currently means a maximum value.
  !! slib_xd-slib_xo must be be sufficient to display ticks greater
  !! than the current value of slib_xs, the tick step being a multiple
  !! of 1, 2 or 5.
  slib_log=$[log10($slib_xs/($slib_xd-$slib_xo))]
  slib_logint=$[floor($slib_log)]
  slib_logmant=$[$slib_log-$slib_logint]
  !if $slib_logmant > $[log10(5)]
    slib_xs=1e$[$slib_logint+1]
  !else
    !if $slib_logmant > $[log10(2)]
      slib_xs=5e$slib_logint
    !else
      slib_xs=2e$slib_logint
    !endif
  !endif
!else
  slib_maxx=$empty
!endif

slib_maxy=!word 1 of $slib_laby
!if $slib_maxy = max
  slib_laby = !word 2 to -1 of $slib_laby
  !! we need to compute the Y step slib_ys, given the values
  !! of the total height slib_yd, ordinate of origin slib_yo
  !! and knowing that slib_ys currently means a maximum value.
  !! slib_yd-slib_yo must be be sufficient to display ticks greater
  !! than the current value of slib_ys, the tick step being a multiple
  !! of 1, 2 or 5.
  slib_log=$[log10($slib_ys/($slib_yd-$slib_yo))]
  slib_logint=$[floor($slib_log)]
  slib_logmant=$[$slib_log-$slib_logint]
  !if $slib_logmant > $[log10(5)]
    slib_ys=1e$[$slib_logint+1]
  !else
    !if $slib_logmant > $[log10(2)]
      slib_ys=5e$slib_logint
    !else
      slib_ys=2e$slib_logint
    !endif
  !endif
!else
  slib_maxy=$empty
!endif

slib_dc=!declosing $slib_dc

slib_bg=!declosing $slib_bg
!default slib_bg=240,233,255

slib_lc=!declosing $slib_lc
!default slib_lc=255,220,180

slib_dc=!declosing $slib_dc
!default slib_dc=10,10,10

!!!!!!!!!!!!!!!!! no grid !!!!!!!!!!!!!!!!!!!!!!!!!

slib_dessin =

slib_i=0
!for slib_s in $slib_strings
  slib_s = !declosing $slib_s
  slib_parm = !item 1 to 4 of $slib_s
  !reset slib_c, slib_size, slib_text
  !distribute item $slib_parm into slib_c,slib_x,slib_y,slib_size
  !default slib_c black
  !default slib_size medium
  slib_text = !item 5 to -1 of $slib_s
  slib_y = $[10*$slib_y/$slib_ys]
  slib_y = $[10*$slib_yo+$slib_y]
  slib_x=$[10*$slib_x/$slib_xs]
  slib_x=$[10*$slib_xo+$slib_x]
  slib_dessin= $slib_dessin \
  text $slib_c,$slib_x,$slib_y,$slib_size,$slib_text
!next slib_s

slib_out= $slib_dessin