diff options
author | Chris Mason <chris.mason@fusionio.com> | 2012-08-27 12:53:51 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-08-27 12:53:51 -0400 |
commit | e539bf58f0e097b38dad2f648c535397ebc237ae (patch) | |
tree | 3c5596e29c2ed8cf302ff8266ae6ca7ad1d803ec | |
parent | 914d96e0265c44a9b80dfdfef9cd094072336278 (diff) | |
download | iowatcher-e539bf58f0e097b38dad2f648c535397ebc237ae.tar.gz |
Fix the line graphs for values near the edges of the graph
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r-- | plot.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -694,7 +694,7 @@ int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, int printed_header = 0; int printed_lines = 0; - if (0 && thresh1 && thresh2) + if (thresh1 && thresh2) rolling = 0; else if (rolling_avg_secs) rolling = rolling_avg_secs; @@ -703,7 +703,16 @@ int svg_line_graph(struct plot *plot, struct graph_line_data *gld, char *color, for (i = 0; i < gld->stop_seconds; i++) { avg = rolling_avg(gld->data, i, rolling); - val = avg / yscale; + if (yscale == 0) + val = 0; + else + val = avg / yscale; + + if (val > graph_height) + val = graph_height; + if (val < 0) + val = 0; + x = (double)i / xscale; if (!thresh1 && !thresh2) { |