|
|
@ -14,16 +14,24 @@ class ncppplot {
|
|
|
|
// these were all originally plain C, sorry for the non-idiomatic usage FIXME
|
|
|
|
// these were all originally plain C, sorry for the non-idiomatic usage FIXME
|
|
|
|
// ought admit nullptr opts FIXME
|
|
|
|
// ought admit nullptr opts FIXME
|
|
|
|
static bool create(ncppplot<T>* ncpp, ncplane* n, const ncplot_options* opts, T miny, T maxy) {
|
|
|
|
static bool create(ncppplot<T>* ncpp, ncplane* n, const ncplot_options* opts, T miny, T maxy) {
|
|
|
|
// if miny == maxy, they both must be equal to 0
|
|
|
|
struct notcurses* nc = n->nc;
|
|
|
|
|
|
|
|
// if miny == maxy (enabling domain detection), they both must be equal to 0
|
|
|
|
if(miny == maxy && miny){
|
|
|
|
if(miny == maxy && miny){
|
|
|
|
|
|
|
|
logerror(nc, "Supplied non-zero domain detection param %d\n", miny);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(opts->rangex < 0){
|
|
|
|
if(opts->rangex < 0){
|
|
|
|
|
|
|
|
logerror(nc, "Supplied negative independent range %d\n", opts->rangex);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(maxy < miny){
|
|
|
|
if(maxy < miny){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DETECTMAXONLY can't be used without domain detection
|
|
|
|
|
|
|
|
if(opts->flags & NCPLOT_OPTION_DETECTMAXONLY && (miny != maxy)){
|
|
|
|
|
|
|
|
logerror(nc, "Supplied DETECTMAXONLY without domain detection");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
ncblitter_e blitter = opts ? opts->gridtype : NCBLIT_DEFAULT;
|
|
|
|
ncblitter_e blitter = opts ? opts->gridtype : NCBLIT_DEFAULT;
|
|
|
|
if(blitter == NCBLIT_DEFAULT){
|
|
|
|
if(blitter == NCBLIT_DEFAULT){
|
|
|
|
if(notcurses_canutf8(ncplane_notcurses(n))){
|
|
|
|
if(notcurses_canutf8(ncplane_notcurses(n))){
|
|
|
@ -272,9 +280,11 @@ class ncppplot {
|
|
|
|
if(val > maxy){
|
|
|
|
if(val > maxy){
|
|
|
|
maxy = val;
|
|
|
|
maxy = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!detectonlymax){
|
|
|
|
if(val < miny){
|
|
|
|
if(val < miny){
|
|
|
|
miny = val;
|
|
|
|
miny = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(val > maxy || val < miny){
|
|
|
|
if(val > maxy || val < miny){
|
|
|
@ -357,6 +367,7 @@ class ncppplot {
|
|
|
|
bool labelaxisd; // label dependent axis (consumes PREFIXCOLUMNS columns)
|
|
|
|
bool labelaxisd; // label dependent axis (consumes PREFIXCOLUMNS columns)
|
|
|
|
bool exponentiali; // exponential independent axis
|
|
|
|
bool exponentiali; // exponential independent axis
|
|
|
|
bool detectdomain; // is domain detection in effect (stretch the domain)?
|
|
|
|
bool detectdomain; // is domain detection in effect (stretch the domain)?
|
|
|
|
|
|
|
|
bool detectonlymax; // domain detection applies only to max, not min
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|