[GRASS-SVN] r29832 -
grass/branches/releasebranch_6_3/display/d.histogram
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 25 09:12:20 EST 2008
Author: neteler
Date: 2008-01-25 09:12:20 -0500 (Fri, 25 Jan 2008)
New Revision: 29832
Modified:
grass/branches/releasebranch_6_3/display/d.histogram/bar.c
Log:
x-axis ticks labeling improved (backport from HEAD)
Modified: grass/branches/releasebranch_6_3/display/d.histogram/bar.c
===================================================================
--- grass/branches/releasebranch_6_3/display/d.histogram/bar.c 2008-01-25 13:15:47 UTC (rev 29831)
+++ grass/branches/releasebranch_6_3/display/d.histogram/bar.c 2008-01-25 14:12:20 UTC (rev 29832)
@@ -112,7 +112,9 @@
if(G_is_d_null_value(&range_dmin) || G_is_d_null_value(&range_dmax))
G_fatal_error("Floating point data range is empty");
- while((range_dmax - range_dmin)/tics[i].every > max_tics)
+ 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)
i++;
}
else
@@ -314,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