if sweep variables are defined on X axis (instead of default index 0) use first sweep X-axis var in live cursor backannotation

This commit is contained in:
Stefan Frederik 2022-09-19 12:19:39 +02:00
parent 6f102ff05a
commit 73e8b440c8
2 changed files with 5 additions and 3 deletions

View File

@ -179,8 +179,10 @@ static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
if(xctx->graph_values) {
int dset, first, last, dataset = gr->dataset, i, p, ofs;
double start, end;
int sweepvar_wrap = 0, sweep_idx=0; /* allow different sweep vars? */
int sweepvar_wrap = 0, sweep_idx;
double xx, cursor2; /* xx is the p-th sweep variable value, cursor2 is cursor 'b' x position */
sweep_idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", 1));
if(sweep_idx < 0) sweep_idx = 0;
cursor2 = xctx->graph_cursor2_x;
start = (gr->gx1 <= gr->gx2) ? gr->gx1 : gr->gx2;
end = (gr->gx1 <= gr->gx2) ? gr->gx2 : gr->gx1;

View File

@ -33,7 +33,7 @@ zz
zzz"
color="4 6 8"
sweep="v(a)"
dataset=0}
dataset=-1}
B 2 10 -930 570 -700 {flags=graph
y1 = -0.0578112
y2 = 3.04806
@ -45,7 +45,7 @@ node="z
a"
color="4 6"
sweep="v(a) v(z)"
dataset=0}
dataset=-1}
P 4 5 560 -700 560 -510 1350 -510 1350 -700 560 -700 {dash=3}
P 4 5 820 -920 820 -730 1350 -730 1350 -920 820 -920 {dash=3}
T {These 2 instances are equivalent} 260 -310 0 0 0.4 0.4 {}