mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
ncplot: fold minx, maxx into rangex
This commit is contained in:
parent
09d8912d4e
commit
b3e874a179
@ -2529,19 +2529,28 @@ typedef struct ncplot_options {
|
|||||||
ncgridgeom_e gridtype;
|
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..3960).
|
// resolution, the independent variable would be the range [0..3600): 3600.
|
||||||
int64_t minx, maxx;
|
uint64_t rangex;
|
||||||
// y axis min and max. set the two equal (to any stand-in value; 0 is
|
// y axis min and max. set the two equal (to any stand-in value; 0 is
|
||||||
// recommended) for autodiscovery of range.
|
// recommended) for autodiscovery of range.
|
||||||
int64_t miny, maxy;
|
int64_t miny, maxy;
|
||||||
bool exponentialy; // is y-axis exponential?
|
bool exponentialy; // is y-axis exponential?
|
||||||
} ncplot_options;
|
} ncplot_options;
|
||||||
|
|
||||||
|
// Use the provided plane 'n' for plotting according to the options 'opts'.
|
||||||
|
// The plot will make free use of the entirety of the plane.
|
||||||
API struct ncplot* ncplot_create(struct ncplane* n, const ncplot_options* opts);
|
API struct ncplot* ncplot_create(struct ncplane* n, const ncplot_options* opts);
|
||||||
|
|
||||||
// Return a reference to the ncplot's underlying ncplane.
|
// Return a reference to the ncplot's underlying ncplane.
|
||||||
API struct ncplane* ncplot_plane(struct ncplot* n);
|
API struct ncplane* ncplot_plane(struct ncplot* n);
|
||||||
|
|
||||||
|
// Add to or set the value corresponding to this x. If x is beyond the current
|
||||||
|
// x window, the x window is advanced to include x, and values passing beyond
|
||||||
|
// the window are lost. The first call will place the initial window. The plot
|
||||||
|
// will be redrawn, but notcurses_render() is not called.
|
||||||
|
API int ncplot_add_sample(struct ncplot* n, uint64_t x, int64_t y);
|
||||||
|
API int ncplot_set_sample(struct ncplot* n, uint64_t x, int64_t y);
|
||||||
|
|
||||||
API void ncplot_destroy(struct ncplot* n);
|
API void ncplot_destroy(struct ncplot* n);
|
||||||
|
|
||||||
#undef API
|
#undef API
|
||||||
|
@ -9,6 +9,10 @@ int main(void){
|
|||||||
if(!nc.mouse_enable()){
|
if(!nc.mouse_enable()){
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
std::unique_ptr<ncpp::Plane> n(nc.get_stdplane ());
|
||||||
|
struct ncplot_options popts{};
|
||||||
|
struct ncplot* plot = ncplot_create(*n, &popts);
|
||||||
// FIXME
|
// FIXME
|
||||||
|
ncplot_destroy(plot);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user