fix graph_fullxzoom in case of non monotonical sweep x axis variable

This commit is contained in:
stefan schippers 2023-10-18 16:10:08 +02:00
parent 0178e1c287
commit 1b7a035220
3 changed files with 12 additions and 3 deletions

View File

@ -535,6 +535,9 @@ verilog_format="xnor #(@risedel , @falldel ) @name ( @@Z , @@A , @@B );"
<ul>
<li><kbd>@symname</kbd></li>
<p> This expands to the name of the symbol</p>
<li><kbd>@symref</kbd></li>
<p> This expands to the symbol reference exactly as specified in the instance (the <kbd>Symbol</kbd> textbox
if you edit the symbol attributes with <kbd>q</kbd> key).</p>
<li><kbd>@symname_ext</kbd></li>
<p> This expands to the name of the symbol, keeping the extension (usually .sym)</p>
<li><kbd>@path</kbd></li>

View File

@ -48,6 +48,7 @@ static int waves_selected(int event, KeySym key, int state, int button)
xRect *r;
r = &xctx->rect[GRIDLAYER][i];
if(!(r->flags & 1) ) continue;
if(!strboolcmp(get_tok_value(xctx->rect[GRIDLAYER][i].prop_ptr, "lock", 0), "true")) continue;
if( (xctx->ui_state & GRAPHPAN) ||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1, r->y1, r->x2 - 40, r->y1 + 20) ||
POINTINSIDE(xctx->mousex, xctx->mousey, r->x1 + 20, r->y1, r->x2 - 30, r->y2 - 10) ) {

View File

@ -2018,9 +2018,10 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
int dset = dataset == -1 ? 0 : dataset;
char *custom_rawfile = NULL; /* "rawfile" attr. set in graph: load and switch to specified raw */
char *sim_type = NULL;
int save_datasets = -1, save_npoints = -1;
int k, save_datasets = -1, save_npoints = -1;
Raw *raw = NULL;
dbg(1, "graph_fullxzoom(): sweep idx=%d\n", idx);
if(idx < 0 ) idx = 0;
my_strdup2(_ALLOC_ID_, &custom_rawfile, get_tok_value(r->prop_ptr,"rawfile",0));
@ -2046,8 +2047,12 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
raw->npoints[0] = raw->allpoints;
}
xx1 = get_raw_value(dset, idx, 0);
xx2 = get_raw_value(dset, idx, xctx->raw->npoints[dset] -1);
xx1 = xx2 = get_raw_value(dset, idx, 0);
for(k = 0; k < xctx->raw->npoints[dset]; k++) {
double v = get_raw_value(dset, idx, k);
if(v < xx1) xx1 = v;
if(v > xx2) xx2 = v;
}
if(gr->logx) {
xx1 = mylog10(xx1);
xx2 = mylog10(xx2);