do not always star time at 0 - ploot - simple plotting tools
(HTM) git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit ab839e91e0a3687937992cb48558a15e1547d8ea
(DIR) parent 5f03375e046ffabf4446085c1411841be57f8cd1
(HTM) Author: Josuah Demangeon <mail@josuah.net>
Date: Wed, 2 May 2018 07:56:04 +0200
do not always star time at 0
Diffstat:
M ffplot.c | 5 ++---
M ploot.c | 8 +++++---
2 files changed, 7 insertions(+), 6 deletions(-)
---
(DIR) 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);
(DIR) 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)