axis zoom: updated examples

This commit is contained in:
Stefan Frederik 2021-12-25 14:43:26 +01:00
parent 842bcb0b93
commit f5a737159d
6 changed files with 59 additions and 52 deletions

View File

@ -2318,7 +2318,6 @@ double round_to_n_digits(double x, int n)
return my_round(x / scale) * scale;
}
/*
double floor_to_n_digits(double x, int n)
{
double scale;
@ -2334,7 +2333,6 @@ double ceil_to_n_digits(double x, int n)
scale = pow(10.0, ceil(log10(fabs(x))) - n);
return ceil(x / scale) * scale;
}
*/
int place_text(int draw_text, double mx, double my)
{

View File

@ -415,7 +415,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(xctx->mousex_snap < W_X(wx1)) {
int i, j;
double v;
double min, max;
double min=0.0, max=0.0;
int first = 1;
char *saven, *nptr, *ntok, *node = NULL;;
my_strdup2(1426, &node, get_tok_value(xctx->rect[c][n].prop_ptr,"node",0));
@ -432,6 +432,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
}
}
if(max == min) max += 0.01;
min = floor_to_n_digits(min, 2);
max = ceil_to_n_digits(max, 2);
my_free(1427, &node);
my_snprintf(s, S(s), "%g", min);
my_strdup(1422, &xctx->rect[c][n].prop_ptr, subst_token(xctx->rect[c][n].prop_ptr, "y1", s));

View File

@ -1554,11 +1554,11 @@ int read_dataset(FILE *fd)
if(sim_type) {
done_header = 1;
read_binary_block(fd);
dbg(0, "read_dataset(): read binary block, nvars=%d npoints=%d\n", xctx->nvars, npoints);
dbg(1, "read_dataset(): read binary block, nvars=%d npoints=%d\n", xctx->nvars, npoints);
xctx->datasets++;
exit_status = 1;
} else {
dbg(0, "read_dataset(): skip binary block, nvars=%d npoints=%d\n", xctx->nvars, npoints);
dbg(1, "read_dataset(): skip binary block, nvars=%d npoints=%d\n", xctx->nvars, npoints);
fseek(fd, xctx->nvars * npoints * sizeof(double), SEEK_CUR); /* skip binary block */
}
done_points = 0;
@ -1601,7 +1601,7 @@ int read_dataset(FILE *fd)
variables = 1 ;
}
}
dbg(0, "read_dataset(): datasets=%d, last npoints=%d, nvars=%d\n",
dbg(1, "read_dataset(): datasets=%d, last npoints=%d, nvars=%d\n",
xctx->datasets, xctx->npoints[xctx->datasets-1], xctx->nvars);
return exit_status;
}

View File

@ -1187,6 +1187,8 @@ extern void my_free(int id, void *ptr);
extern size_t my_strcat(int id, char **, const char *);
extern double my_round(double a);
extern double round_to_n_digits(double x, int n);
extern double floor_to_n_digits(double x, int n);
extern double ceil_to_n_digits(double x, int n);
extern const char *subst_token(const char *s, const char *tok, const char *new_val);
extern void new_prop_string(int i, const char *old_prop,int fast, int dis_uniq_names);
extern void hash_name(char *token, int remove);

View File

@ -19,22 +19,26 @@ L 4 570 -170 570 -150 {}
L 4 570 -170 690 -170 {}
L 7 1090 -260 2520 -260 {}
B 2 260 -1080 720 -920 {flags=1
y1 = 0.00676696
y2 = 0.922682
y1 = 0
y2 = 0.93
divy = 5
x1=0
x2=5e-07
divx=10
x1=1.23616e-07
x2=4.51672e-07
divx=5
subdivx=4
unitx=n
node="v(cal) v(saout)"
color="4 5"
}
B 2 260 -1220 720 -1090 {flags=1
y1 = 0.648
y2 = 0.652
y1 = 0.647719
y2 = 0.652802
divy = 5
x1=0
x2=5e-07
x1=1.23616e-07
x2=4.51672e-07
unitx=n
divx=5
subdivx=4
node="v(plus) v(minus)"
color="4 5"}
T {CAL} 140 -180 0 1 0.4 0.4 {}

View File

@ -31,8 +31,8 @@ B 2 1860 -1180 3010 -1100 {flags=1
y1 = 0
y2 = 1
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="
v(ldbl[0]) v(ldbl[16]) v(ldbl[32])
v(ldbl[1]) v(ldbl[17]) v(ldbl[33])
@ -43,8 +43,8 @@ B 2 1860 -1090 3010 -1010 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="
v(ldl1x[0]) v(ldl1x[1]) v(ldl1x[2]) v(ldl1x[3])
"
@ -53,16 +53,16 @@ B 2 1860 -1000 3010 -920 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lda[3])"
color=12 unitx=n subdivy=2}
B 2 1860 -1490 3010 -1280 {flags=1
y1 = 0
y2 = 2
divy = 4
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldcp) v(ldyms[4]) v(ldyms[5]) v(ldyms[6]) v(ldyms[7])"
color=6\\ 12\\ 13\\ 14\\ 15 unitx=n}
B 2 1860 -910 3010 -830 {flags=1
@ -70,32 +70,32 @@ y1 = 0
y2 = 1.5
subdivy=2
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldl1x[0])"
color=4 unitx=n}
B 2 1860 -730 3010 -650 {flags=1
y1 = -0.1
y2 = 1.5
y1 = 0
y2 = 1.6
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldprech)"
color=4 unitx=n subdivy=2}
B 2 1860 -640 3010 -560 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lden) v(ldcp)"
color=12\\ 18 unitx=n subdivy=2}
B 2 1860 -550 3010 -470 {flags=1
y1 = 0
y2 = 1.5
y2 = 1.6
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="
v(ldwl[0]) v(ldwl[1]) v(ldwl[2]) v(ldwl[3])
v(ldwl[4]) v(ldwl[5]) v(ldwl[6]) v(ldwl[8])
@ -105,56 +105,57 @@ B 2 1860 -460 3010 -380 {flags=1
y1 = 0
y2 = 1
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldymsref)"
color=3 unitx=n subdivy=4}
B 2 1860 -370 3010 -290 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldoe)"
color=4 unitx=n subdivy=2}
B 2 1860 -280 3010 -200 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lden)"
color=4 unitx=n subdivy=2}
B 2 1860 -190 3010 -110 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lden) v(ldprech)"
color=12\\ 16 unitx=n subdivy=2}
B 2 1860 -100 3010 -20 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lden) v(ldcp)"
color=12\\ 5 unitx=n subdivy=2}
B 2 1860 -820 3010 -740 {flags=1
y1 = 0
y2 = 1.5
y2 = 1.6
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
subdivy=2
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(ldl1x[1])"
color=4 unitx=n subdivy=2}
color=4 unitx=n}
B 2 1860 -1270 3010 -1190 {flags=1
y1 = 0
y2 = 1.5
divy = 1
x1=1.26503e-07
x2=1.66157e-07 divx=10
x1=1.18117e-07
x2=2.27926e-07 divx=10
node="v(lden) v(ldprech)"
color=4\\ 6 unitx=n}
B 7 950 -250 980 -80 {}
@ -168,7 +169,7 @@ T {was: vss} 880 -980 0 0 0.4 0.4 {}
T {16KB ROM Macrocell
16 bit Data I/O x 8KWords} 210 -1120 0 0 0.7 0.7 {}
T {Select one or more graphs (and no other objects)
and use arrow keys to zoom / pan waveforms} 1460 -1100 0 0 0.3 0.3 {}
and use arrow keys to zoom / pan waveforms} 1370 -1110 0 0 0.3 0.3 {}
N 150 -580 150 -560 {lab=vss}
N 150 -420 150 -400 {lab=vss}
N 10 -270 10 -250 {lab=vss}
@ -359,7 +360,7 @@ C {lab_pin.sym} 1670 -740 0 0 {name=l2 lab=LDWL[16:0]}
C {spice_probe.sym} 1670 -740 0 0 {name=p46 analysis=tran}
C {lab_pin.sym} 1670 -790 0 0 {name=l4 lab=LDBL[0,16,32,1,17,33,2,18,34]}
C {spice_probe.sym} 1670 -790 0 0 {name=p91 analysis=tran}
C {launcher.sym} 1475 -1135 0 0 {name=h1
C {launcher.sym} 1385 -1145 0 0 {name=h1
descr="Select arrow and
Ctrl-Left-Click to load/unload waveforms"
tclcommand="