[GRASS-SVN] r29831 - grass/trunk/display/d.histogram
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 25 08:15:47 EST 2008
Author: neteler
Date: 2008-01-25 08:15:47 -0500 (Fri, 25 Jan 2008)
New Revision: 29831
Modified:
grass/trunk/display/d.histogram/bar.c
Log:
get FP output for x-axis in case of 0..1.0 range
Modified: grass/trunk/display/d.histogram/bar.c
===================================================================
--- grass/trunk/display/d.histogram/bar.c 2008-01-25 13:06:57 UTC (rev 29830)
+++ grass/trunk/display/d.histogram/bar.c 2008-01-25 13:15:47 UTC (rev 29831)
@@ -112,7 +112,6 @@
if(G_is_d_null_value(&range_dmin) || G_is_d_null_value(&range_dmax))
G_fatal_error("Floating point data range is empty");
- G_debug(3,"range: %f",range_dmax - range_dmin);
if ( (range_dmax - range_dmin) < 1.0) tics[i].every = 5;
if ( (range_dmax - range_dmin) < 110) tics[i].every = 20; /* dirrty hack */
while((range_dmax - range_dmin)/tics[i].every > max_tics)
@@ -125,7 +124,6 @@
}
tic_every = tics[i].every;
tic_unit = tics[i].unit;
- G_debug(3,"max_tics: %d, tic_every: %d, tic_unit: %d", max_tics, tic_every, tic_unit);
strcpy(tic_name,tics[i].name);
}
else
@@ -318,9 +316,12 @@
R_cont_rel( (int)0 , (int)(BIG_TIC*(b-t)) );
if(nodata && i==dist_stats->mincat)
sprintf(txt, "null");
- else if(is_fp)
- sprintf(txt,"%d",(int) (dmin/(double) tic_unit));
- else
+ else if(is_fp) {
+ if ( (range_dmax - range_dmin) < 1.0)
+ sprintf(txt,"%.2f", dmin/(double) tic_unit);
+ else
+ sprintf(txt,"%d",(int) (dmin/(double) tic_unit));
+ } else
sprintf(txt,"%d",(int) (i/tic_unit));
text_height = (b-t)*TEXT_HEIGHT;
text_width = (r-l)*TEXT_WIDTH;
More information about the grass-commit
mailing list