ncplot: fix top row calculations #642

This commit is contained in:
nick black 2020-05-28 23:23:05 -04:00
parent ebcba82d4b
commit cce55f1d4e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -138,9 +138,13 @@ class ncppplot {
for(int y = 0 ; y < dimy ; ++y){
char buf[PREFIXSTRLEN + 1];
if(exponentiali){
ncmetric(pow(interval, y * states + (states - 1)) * 100, 100, buf, 0, 1000, '\0');
if(y == dimy - 1){ // we cheat on the top row to exactly match maxy
ncmetric(maxy * 100, 100, buf, 0, 1000, '\0');
}else{
ncmetric(interval * states * (y + 1) * 100, 100, buf, 0, 1000, '\0');
ncmetric(pow(interval, (y + 1) * states) * 100, 100, buf, 0, 1000, '\0');
}
}else{
ncmetric((maxy - interval * states * (dimy - y - 1)) * 100, 100, buf, 0, 1000, '\0');
}
ncplane_printf_yx(ncp, dimy - y - 1, 0, "%*s", PREFIXCOLUMNS, buf);
}