[plots] print current sample as summary #2152

This commit is contained in:
nick black 2021-09-11 23:28:50 -04:00
parent fb8b6bfcae
commit 88f40df4ae
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 6 additions and 5 deletions

View File

@ -540,7 +540,7 @@ ncchannels_set_bg_default(uint64_t* channels){
// An nccell corresponds to a single character cell on some plane, which can be
// occupied by a single grapheme cluster (some root spacing glyph, along with
// possible combining characters, which might span multiple columns). At any
// cell, we can have a theoretically arbitrarily long UTF-8 string, a foreground
// cell, we can have a theoretically arbitrarily long UTF-8 EGC, a foreground
// color, a background color, and an attribute set. Valid grapheme cluster
// contents include:
//

View File

@ -198,10 +198,12 @@ int redraw_pixelplot_##T(nc##X##plot* ncp){ \
} \
} \
if(ncp->plot.printsample){ \
int lastslot = ncp->plot.slotstart ? ncp->plot.slotstart - 1 : ncp->plot.slotcount - 1; \
ncplane_set_styles(ncp->plot.ncp, ncp->plot.legendstyle); \
ncplane_set_channels(ncp->plot.ncp, ncp->plot.maxchannels); \
ncplane_printf_aligned(ncp->plot.ncp, 0, NCALIGN_RIGHT, "%" PRIu64, (uint64_t)ncp->slots[lastslot]); \
/* FIXME is this correct for double? */ \
/* we use idx, and thus get an immediate count, changing as we load it.
* if you want a stable summary, print the previous slot */ \
ncplane_printf_aligned(ncp->plot.ncp, 0, NCALIGN_RIGHT, "%" PRIu64, (uint64_t)ncp->slots[idx]); \
} \
ncplane_home(ncp->plot.ncp); \
struct ncvisual* ncv = ncvisual_from_rgba(pixels, dimy * states, dimx * scale * 4, dimx * scale); \
@ -391,10 +393,9 @@ int redraw_plot_##T(nc##X##plot* ncp){ \
} \
} \
if(ncp->plot.printsample){ \
int lastslot = ncp->plot.slotstart ? ncp->plot.slotstart - 1 : ncp->plot.slotcount - 1; \
ncplane_set_styles(ncp->plot.ncp, ncp->plot.legendstyle); \
ncplane_set_channels(ncp->plot.ncp, ncp->plot.maxchannels); \
ncplane_printf_aligned(ncp->plot.ncp, 0, NCALIGN_RIGHT, "%" PRIu64, (uint64_t)ncp->slots[lastslot]); \
ncplane_printf_aligned(ncp->plot.ncp, 0, NCALIGN_RIGHT, "%" PRIu64, (uint64_t)ncp->slots[idx]); \
} \
ncplane_home(ncp->plot.ncp); \
return 0; \