label dependent axis when requested #438

This commit is contained in:
nick black 2020-04-04 12:20:46 -04:00 committed by Nick Black
parent dfd54f540a
commit 3e202d6fa6

View File

@ -146,6 +146,13 @@ redraw_plot(ncplot* n){
double interval = (n->maxy - n->miny + 1) / ((double)dimy * states); // FIXME
int idx = n->slotstart;
const int startx = n->labelaxisd ? PREFIXSTRLEN : 0;
if(n->labelaxisd){
for(int y = 0 ; y < dimy ; ++y){
char buf[PREFIXSTRLEN + 1];
ncmetric(interval * states * y, 1, buf, 0, 1000, '\0');
ncplane_putstr_yx(ncplot_plane(n), dimy - y - 1, PREFIXSTRLEN - strlen(buf), buf);
}
}
for(uint64_t x = startx ; x < n->slotcount + startx ; ++x){
if(x >= (unsigned)dimx){
break;