[GRASS-SVN] r64861 - grass/branches/releasebranch_7_0/display/d.vect.chart
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Mar 15 06:01:07 PDT 2015
Author: mmetz
Date: 2015-03-15 06:01:07 -0700 (Sun, 15 Mar 2015)
New Revision: 64861
Modified:
grass/branches/releasebranch_7_0/display/d.vect.chart/main.c
grass/branches/releasebranch_7_0/display/d.vect.chart/pie.c
Log:
d.vect.chart: bug fixes
Modified: grass/branches/releasebranch_7_0/display/d.vect.chart/main.c
===================================================================
--- grass/branches/releasebranch_7_0/display/d.vect.chart/main.c 2015-03-15 09:13:02 UTC (rev 64860)
+++ grass/branches/releasebranch_7_0/display/d.vect.chart/main.c 2015-03-15 13:01:07 UTC (rev 64861)
@@ -189,7 +189,7 @@
colors = (COLOR *) G_malloc(ncols * sizeof(COLOR));
/* Fill max_reference values */
- max_reference = (double *)G_malloc(ncols * sizeof(double));
+ max_reference = NULL;
/* default colors */
j = 0;
@@ -247,6 +247,7 @@
/* should we plot the maximum reference on bar plots? */
if (max_reference_opt->answer != NULL) {
+ max_reference = (double *)G_malloc(ncols * sizeof(double));
/* loop through the given values */
for (i = 0; i < ncols; i++) {
Modified: grass/branches/releasebranch_7_0/display/d.vect.chart/pie.c
===================================================================
--- grass/branches/releasebranch_7_0/display/d.vect.chart/pie.c 2015-03-15 09:13:02 UTC (rev 64860)
+++ grass/branches/releasebranch_7_0/display/d.vect.chart/pie.c 2015-03-15 13:01:07 UTC (rev 64861)
@@ -32,14 +32,16 @@
sum = 0;
ang = 0;
for (i = 0; i < ncols; i++) {
+ if (val[i] == 0)
+ continue;
+
sum += val[i];
- if (tot_sum > 0.0)
- end_ang = 2 * PI * sum / tot_sum;
- else
- end_ang = 0;
+
+ end_ang = 2 * PI * sum / tot_sum;
+
Vect_reset_line(Points);
- if (val[0] != tot_sum) /* all in one slice, don't draw line to center */
+ if (val[i] != tot_sum) /* all in one slice, don't draw line to center */
Vect_append_point(Points, cx, cy, 0);
n = (int)ceil((end_ang - ang) / step);
@@ -52,7 +54,7 @@
}
ang = end_ang;
- if (val[0] != tot_sum)
+ if (val[i] != tot_sum) /* all in one slice, don't draw line to center */
Vect_append_point(Points, cx, cy, 0);
if (!colors[i].none) {
More information about the grass-commit
mailing list