You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1000 B

  1. --- a/src/rrd_graph.c
  2. +++ b/src/rrd_graph.c
  3. @@ -2049,7 +2049,7 @@ horizontal_log_grid(gdImagePtr gif, imag
  4. char graph_label[100];
  5. gdPoint polyPoints[4];
  6. int styleMinor[2],styleMajor[2];
  7. - double value, pixperstep, minstep;
  8. + double value, pixperstep, minstep, yval;
  9. /* find grid spaceing */
  10. pixpex= (double)im->ysize / (log10(im->maxval) - log10(im->minval));
  11. @@ -2118,7 +2118,14 @@ horizontal_log_grid(gdImagePtr gif, imag
  12. gdImageLine(gif, polyPoints[0].x,polyPoints[0].y,
  13. polyPoints[1].x,polyPoints[0].y,gdStyled);
  14. - sprintf(graph_label,"%3.0e",value * yloglab[majoridx][i]);
  15. + yval = value * yloglab[majoridx][i];
  16. + if (yval >= 100000) {
  17. + sprintf(graph_label,"%3.0e", yval);
  18. + } else {
  19. + if (yval == 1) /* prints as 1e+00 */
  20. + yval = 0;
  21. + sprintf(graph_label,"%5.0f", yval);
  22. + }
  23. gdImageString(gif, SmallFont,
  24. (polyPoints[0].x - (strlen(graph_label) *
  25. SmallFont->w)-7),