ploot

plot images or real-time plain text from a .csv file
Log | Files | Refs | README

commit ab839e91e0a3687937992cb48558a15e1547d8ea
parent 5f03375e046ffabf4446085c1411841be57f8cd1
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed,  2 May 2018 07:56:04 +0200

do not always star time at 0

Diffstat:
Mffplot.c | 5++---
Mploot.c | 8+++++---
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ffplot.c b/ffplot.c @@ -220,7 +220,8 @@ find_scales(Vlist *v, int n, }; int i; - *vmin = *vmax = *tmin = *tmax = 0; + *vmin = *vmax = 0; + *tmin = *tmax = *v->t; for (; n-- > 0; v++) { for (i = 0; i < v->n; i++) { @@ -284,8 +285,6 @@ ffplot(Vlist *v, int n, char *name, char *units) find_scales(v, n, &vmin, &vmax, &vstep, &tmin, &tmax, &tstep); - fprintf(stderr, "%f %f %lld %lld\n", vmin, vmax, tmin, tmax); - can.x = 0; can.y = 0; ffdraw_fill(&can, &plot_bg); diff --git a/ploot.c b/ploot.c @@ -73,7 +73,7 @@ eatof(char *str) for (s = str; *s != '\0'; s++) if (!isdigit(*s) && *s != '-' && *s != '.') - fputs("invalid floatrformat", stderr), exit(0); + fputs("invalid float format\n", stderr), exit(0); return atof(str); } @@ -84,7 +84,7 @@ eatol(char *str) for (s = str; *s != '\0'; s++) if (!isdigit(*s) && *s != '-') - fputs("invalid number format", stderr), exit(0); + fputs("invalid number format\n", stderr), exit(0); return atol(str); } @@ -111,11 +111,13 @@ add_row(Vlist *v, int *bufsiz, int ncol, int nval, char *line) { time_t epoch; int n; - char *field; + char *field, *dot; if ((field = strsep(&line, ",")) == NULL) fprintf(stderr, "%d: missing epoch\n", nval), exit(0); + if ((dot = strchr(field, '.')) != NULL) + *dot = '\0'; epoch = eatol(field); for (n = 0; (field = strsep(&line, ",")) != NULL; n++, v++) { if (n > ncol)