diff --git a/doc/man/man3/notcurses_plot.3.md b/doc/man/man3/notcurses_plot.3.md index 609c5f322..0370f5a05 100644 --- a/doc/man/man3/notcurses_plot.3.md +++ b/doc/man/man3/notcurses_plot.3.md @@ -31,9 +31,9 @@ typedef struct ncplot_options { // dependent min and max. set both equal to 0 to // use domain autodiscovery. int64_t miny, maxy; - bool exponentialy; // is dependent exponential? - // independent variable is vertical, not horizontal - bool vertical_indep; + bool labelaxisd; // label dependent axis + bool exponentialy; // is dependent exponential? + bool vertical_indep; // vertical independent variable } ncplot_options; ``` diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index c099a4c27..054b4a0a3 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -2518,15 +2518,14 @@ typedef struct ncplot_options { // applied across the domain between these two. uint64_t maxchannel; uint64_t minchannel; - // number of "pixels" per row x column - ncgridgeom_e gridtype; + ncgridgeom_e gridtype; // number of "pixels" per row x column // independent variable can either be a contiguous range, or a finite set // of keys. for a time range, say the previous hour sampled with second // resolution, the independent variable would be the range [0..3600): 3600. // if rangex is 0, it is dynamically set to the number of columns. uint64_t rangex; - // y axis min and max. for autodiscovery, these must be equal - int64_t miny, maxy; + int64_t miny, maxy; // y axis min and max. for autodiscovery, set them equal. + bool labelaxisd; // generate labels for the dependent axis bool exponentialy; // is y-axis exponential? (not yet implemented) // independent variable is vertical rather than horizontal bool vertical_indep; diff --git a/src/input/keyplot.cpp b/src/input/keyplot.cpp index 9952de256..dd7ca51e8 100644 --- a/src/input/keyplot.cpp +++ b/src/input/keyplot.cpp @@ -34,6 +34,7 @@ int main(void){ planes.emplace_back(6, plotlen, 23, 1, nullptr); planes.emplace_back(6, plotlen, 31, 1, nullptr); struct ncplot_options popts{}; + popts.labelaxisd = true; std::array plots; for(auto i = 0u ; i < plots.size() ; ++i){ popts.maxchannel = 0; diff --git a/src/lib/internal.h b/src/lib/internal.h index 8347cda2a..78da0cd7e 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -167,6 +167,7 @@ typedef struct ncplot { unsigned slotstart; // slot index corresponding to slotx uint64_t slotx; // x value corresponding to slots[slotstart] unsigned slotcount; + bool labelaxisd; // label dependent axis bool exponentialy; bool detectdomain; } ncplot; diff --git a/src/lib/plot.c b/src/lib/plot.c index 9a8818f3b..9d5adef2f 100644 --- a/src/lib/plot.c +++ b/src/lib/plot.c @@ -48,6 +48,7 @@ ncplot* ncplot_create(ncplane* n, const ncplot_options* opts){ ret->maxy = opts->maxy; ret->vertical_indep = opts->vertical_indep; ret->gridtype = opts->gridtype; + ret->labelaxisd = opts->labelaxisd; ret->exponentialy = opts->exponentialy; ret->detectdomain = opts->miny == opts->maxy; ret->windowbase = 0;