Rev 7692 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
475 | georgesk | 1 | !if $wims_read_parm!=slib_header |
13594 | bpr | 2 | !goto proc |
475 | georgesk | 3 | !endif |
4162 | bpr | 4 | |
4351 | bpr | 5 | slib_author=Georges, Khaznadar |
4162 | bpr | 6 | |
475 | georgesk | 7 | slib_example= ,,,,,,,,,sin(x)\ |
8 | 12,8,0,0,,,blue,red,[255,128,128],sin(x) |
||
7692 | bpr | 9 | |
475 | georgesk | 10 | !exit |
11 | |||
12 | :proc |
||
13 | |||
14 | !reset slib_xd, slib_yd, slib_bg, slib_lc, slib_dc, slib_xo, slib_yo, slib_xs, slib_ys, slib_f, slib_labx, slib_laby, slib_maxx, slib_maxy |
||
15 | |||
16 | slib_parm=!item 1 to 10 of $wims_read_parm |
||
17 | !distribute item $slib_parm into slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_bg, slib_lc, slib_dc, slib_f |
||
18 | |||
19 | !default slib_xd=8 |
||
20 | !default slib_yd=8 |
||
21 | !default slib_xo=1 |
||
22 | !default slib_yo=1 |
||
23 | !default slib_xs=1 |
||
24 | !default slib_ys=1 |
||
25 | |||
26 | slib_f = !declosing $slib_f |
||
27 | |||
28 | slib_labx=!word 2 to -1 of $slib_xs |
||
29 | slib_laby=!word 2 to -1 of $slib_ys |
||
30 | slib_xs=!word 1 of $slib_xs |
||
31 | slib_ys=!word 1 of $slib_ys |
||
32 | |||
33 | slib_maxx=!word 1 of $slib_labx |
||
34 | !if $slib_maxx = max |
||
35 | slib_labx = !word 2 to -1 of $slib_labx |
||
36 | !! we need to compute the X step slib_xs, given the values |
||
37 | !! of the total width slib_xd, abscissa of origin slib_xo |
||
38 | !! and knowing that slib_xs currently means a maximum value. |
||
39 | !! slib_xd-slib_xo must be be sufficient to display ticks greater |
||
40 | !! than the current value of slib_xs, the tick step being a multiple |
||
41 | !! of 1, 2 or 5. |
||
42 | slib_log=$[log10($slib_xs/($slib_xd-$slib_xo))] |
||
43 | slib_logint=$[floor($slib_log)] |
||
44 | slib_logmant=$[$slib_log-$slib_logint] |
||
45 | !if $slib_logmant > $[log10(5)] |
||
13594 | bpr | 46 | slib_xs=1e$[$slib_logint+1] |
475 | georgesk | 47 | !else |
48 | !if $slib_logmant > $[log10(2)] |
||
49 | slib_xs=5e$slib_logint |
||
50 | !else |
||
51 | slib_xs=2e$slib_logint |
||
52 | !endif |
||
53 | !endif |
||
54 | !else |
||
55 | slib_maxx=$empty |
||
56 | !endif |
||
57 | |||
58 | slib_maxy=!word 1 of $slib_laby |
||
59 | !if $slib_maxy = max |
||
60 | slib_laby = !word 2 to -1 of $slib_laby |
||
61 | !! we need to compute the Y step slib_ys, given the values |
||
62 | !! of the total height slib_yd, ordinate of origin slib_yo |
||
63 | !! and knowing that slib_ys currently means a maximum value. |
||
64 | !! slib_yd-slib_yo must be be sufficient to display ticks greater |
||
65 | !! than the current value of slib_ys, the tick step being a multiple |
||
66 | !! of 1, 2 or 5. |
||
67 | slib_log=$[log10($slib_ys/($slib_yd-$slib_yo))] |
||
68 | slib_logint=$[floor($slib_log)] |
||
69 | slib_logmant=$[$slib_log-$slib_logint] |
||
70 | !if $slib_logmant > $[log10(5)] |
||
13594 | bpr | 71 | slib_ys=1e$[$slib_logint+1] |
475 | georgesk | 72 | !else |
73 | !if $slib_logmant > $[log10(2)] |
||
74 | slib_ys=5e$slib_logint |
||
75 | !else |
||
76 | slib_ys=2e$slib_logint |
||
77 | !endif |
||
78 | !endif |
||
79 | !else |
||
80 | slib_maxy=$empty |
||
81 | !endif |
||
82 | |||
83 | slib_dc=!declosing $slib_dc |
||
84 | |||
85 | slib_bg=!declosing $slib_bg |
||
86 | !default slib_bg=240,233,255 |
||
87 | |||
88 | slib_lc=!declosing $slib_lc |
||
89 | !default slib_lc=255,220,180 |
||
90 | |||
91 | slib_dc=!declosing $slib_dc |
||
92 | !default slib_dc=10,10,10 |
||
93 | |||
94 | !!!!!!!!!!!!!!!!! no grid !!!!!!!!!!!!!!!!!!!!!!!!! |
||
95 | |||
7692 | bpr | 96 | slib_dessin = |
475 | georgesk | 97 | |
98 | !! the function : blue thin curve |
||
99 | slib_n = !itemcnt $slib_f |
||
100 | !if $slib_n = 1 |
||
101 | slib_f = !replace internal x by ($slib_xs/10*(x-10*$slib_xo)) in $slib_f |
||
102 | slib_f = 10*($slib_f)/$slib_ys+10*$slib_yo |
||
103 | !else |
||
104 | slib_x = !item 1 of $slib_f |
||
105 | slib_y = !item 2 of $slib_f |
||
106 | slib_x = 10*($slib_x/$slib_xs+$slib_xo) |
||
107 | slib_y = 10*($slib_y/$slib_ys+$slib_yo) |
||
108 | slib_f = $slib_x, $slib_y |
||
109 | !endif |
||
110 | |||
111 | slib_dessin=$slib_dessin\ |
||
112 | plot blue, $slib_f |
||
113 | |||
114 | slib_out= $slib_dessin |