Opened 17 years ago

Closed 17 years ago

#2159 closed enhancement (fixed)

dynamic charting does not support AGG renderer

Reported by: tbonfort Owned by: sdlime
Priority: normal Milestone: 5.0 release
Component: MapServer C Library Version:
Severity: normal Keywords:
Cc: dmorissette, assefa

Description

included patch adds support for AGG rendering of pie and bar charts.

  • the AGG renderer supports OUTLINECOLOR and WIDTH for outlining specific bars or pie slices if specified in the mapfile
  • if specified, the first value of OFFSET in pie charts is used by the AGG renderer to offset the pie slice by the corresponding number of pixels (this could be done for gd also, but without subpixel rendering this would probably produce lousy results)

this patch also refactors a few functions (moves msDrawChartLayer to mapchart.c), fixes some issues in bar graphs (namely when there are only negative values, or if the specified bounds clip the input data), and validates more thoroughly the input data from the mapfile and the shape attributes

Attachments (3)

aggcharts.diff (34.2 KB ) - added by tbonfort 17 years ago.
testcharts.tgz (2.5 KB ) - added by tbonfort 17 years ago.
test data for chart rendering
chartgd.diff (8.2 KB ) - added by tbonfort 17 years ago.
gd rendering of outlines and offsets - uses chart_size parameter as diameter instead of radius

Download all attachments as: .zip

Change History (14)

by tbonfort, 17 years ago

Attachment: aggcharts.diff added

by tbonfort, 17 years ago

Attachment: testcharts.tgz added

test data for chart rendering

comment:1 by dmorissette, 17 years ago

Resolution: fixed
Status: newclosed

Thanks Thomas. I have committed your patch in SVN r6345 but could not fully test since I am not setup to test with AGG yet.

About the rendering options supported only with AGG, I think they should be available with GD as well for consistency, even if they don't look as good. I'll still mark the bug fixed and you can submit a new patch if you decide to add them to the GD code.

comment:2 by dmorissette, 17 years ago

Milestone: 5.0 release

comment:3 by dmorissette, 17 years ago

Cc: assefa added

Thomas, values.h is not available on Windows and the latest mapchart.c didn't build there. Assefa proposed the following change to mapchart.c. Can you please confirm that it's okay?

#include "map.h" #if defined(_WIN32) && !defined(CYGWIN) #include <float.h> #else #include <values.h> #endif

  • float *values,shapeMaxVal=MINFLOAT,shapeMinVal=MAXFLOAT,pixperval;

+ float *values,shapeMaxVal=FLT_MIN,shapeMinVal=FLT_MAX,pixperval;

comment:4 by dmorissette, 17 years ago

OOpps... Trac screwed up the formatting of the C code in the last comment. Here is is again:

#include "map.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <float.h>
#else
#include <values.h>
#endif

-    float *values,shapeMaxVal=MINFLOAT,shapeMinVal=MAXFLOAT,pixperval;
+    float *values,shapeMaxVal=FLT_MIN,shapeMinVal=FLT_MAX,pixperval;

comment:5 by tbonfort, 17 years ago

I've changed this and umberto commited it this morning ... in fact there wasn't really a need for MAX_FLOAT etc...

comment:6 by dmorissette, 17 years ago

Sorry for the noise, I read the exchange between you and Umbertoo too late.

comment:7 by dmorissette, 17 years ago

Resolution: fixed
Status: closedreopened

Thomas, I tried your chartgd.diff patch, but it doubles the size of pie charts with GD output. Bar charts are the right size. Can you please check that?

comment:8 by tbonfort, 17 years ago

dan, yes this was the desired functionality ;)
both agg and gd draw the same size charts, and chart_size specifies the 'radius' of the pie not its diameter (this is what changed in the last patch) as there isn't any documentation on this (yet), we can settle for any version, but you're right that specifying the diameter seems a more consistent solution I'll be sending a new patch soon

by tbonfort, 17 years ago

Attachment: chartgd.diff added

gd rendering of outlines and offsets - uses chart_size parameter as diameter instead of radius

comment:9 by tbonfort, 17 years ago

uploaded new version of the patch which treats 'cart_size' as the pie's diameter instead of its radius

comment:10 by dmorissette, 17 years ago

I think I prefer the original behavior where chart_size specified the overall size (diameter) of the pie since this is more consistent with the meaning of chart_size on bar charts.

comment:11 by dmorissette, 17 years ago

Resolution: fixed
Status: reopenedclosed

Thanks Thomas. I have committed your latest patch (add rendering of outlines and offsets) in r6365.

Closing ticket.

Note: See TracTickets for help on using tickets.