ncplot: add labelaxisd, use it in keyplot #438

This commit is contained in:
nick black 2020-04-04 09:48:03 -04:00 committed by Nick Black
parent baa233634b
commit 2a7ccffec6
5 changed files with 9 additions and 7 deletions

View File

@ -31,9 +31,9 @@ typedef struct ncplot_options {
// dependent min and max. set both equal to 0 to // dependent min and max. set both equal to 0 to
// use domain autodiscovery. // use domain autodiscovery.
int64_t miny, maxy; int64_t miny, maxy;
bool exponentialy; // is dependent exponential? bool labelaxisd; // label dependent axis
// independent variable is vertical, not horizontal bool exponentialy; // is dependent exponential?
bool vertical_indep; bool vertical_indep; // vertical independent variable
} ncplot_options; } ncplot_options;
``` ```

View File

@ -2518,15 +2518,14 @@ typedef struct ncplot_options {
// applied across the domain between these two. // applied across the domain between these two.
uint64_t maxchannel; uint64_t maxchannel;
uint64_t minchannel; uint64_t minchannel;
// number of "pixels" per row x column ncgridgeom_e gridtype; // number of "pixels" per row x column
ncgridgeom_e gridtype;
// independent variable can either be a contiguous range, or a finite set // 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 // of keys. for a time range, say the previous hour sampled with second
// resolution, the independent variable would be the range [0..3600): 3600. // resolution, the independent variable would be the range [0..3600): 3600.
// if rangex is 0, it is dynamically set to the number of columns. // if rangex is 0, it is dynamically set to the number of columns.
uint64_t rangex; uint64_t rangex;
// y axis min and max. for autodiscovery, these must be equal int64_t miny, maxy; // y axis min and max. for autodiscovery, set them equal.
int64_t miny, maxy; bool labelaxisd; // generate labels for the dependent axis
bool exponentialy; // is y-axis exponential? (not yet implemented) bool exponentialy; // is y-axis exponential? (not yet implemented)
// independent variable is vertical rather than horizontal // independent variable is vertical rather than horizontal
bool vertical_indep; bool vertical_indep;

View File

@ -34,6 +34,7 @@ int main(void){
planes.emplace_back(6, plotlen, 23, 1, nullptr); planes.emplace_back(6, plotlen, 23, 1, nullptr);
planes.emplace_back(6, plotlen, 31, 1, nullptr); planes.emplace_back(6, plotlen, 31, 1, nullptr);
struct ncplot_options popts{}; struct ncplot_options popts{};
popts.labelaxisd = true;
std::array<struct ncplot*, 5> plots; std::array<struct ncplot*, 5> plots;
for(auto i = 0u ; i < plots.size() ; ++i){ for(auto i = 0u ; i < plots.size() ; ++i){
popts.maxchannel = 0; popts.maxchannel = 0;

View File

@ -167,6 +167,7 @@ typedef struct ncplot {
unsigned slotstart; // slot index corresponding to slotx unsigned slotstart; // slot index corresponding to slotx
uint64_t slotx; // x value corresponding to slots[slotstart] uint64_t slotx; // x value corresponding to slots[slotstart]
unsigned slotcount; unsigned slotcount;
bool labelaxisd; // label dependent axis
bool exponentialy; bool exponentialy;
bool detectdomain; bool detectdomain;
} ncplot; } ncplot;

View File

@ -48,6 +48,7 @@ ncplot* ncplot_create(ncplane* n, const ncplot_options* opts){
ret->maxy = opts->maxy; ret->maxy = opts->maxy;
ret->vertical_indep = opts->vertical_indep; ret->vertical_indep = opts->vertical_indep;
ret->gridtype = opts->gridtype; ret->gridtype = opts->gridtype;
ret->labelaxisd = opts->labelaxisd;
ret->exponentialy = opts->exponentialy; ret->exponentialy = opts->exponentialy;
ret->detectdomain = opts->miny == opts->maxy; ret->detectdomain = opts->miny == opts->maxy;
ret->windowbase = 0; ret->windowbase = 0;