Hi,<br><br>This is a solution, rather than a problem.<br><br>I had need for a pie chart with a clickable imagemap in a webpage where I was also rendering maps with mapserver.&nbsp; I thought about looking for a tool to do this for me, then decided to write a quick script to make a small table in my postgis database that would have the necessary information to draw the pie chart with mapserver.&nbsp; This code will generate a pie-ish chart within a bounding box of (-1 -1 1 1).&nbsp; It is pie-ish because the sectors are actually triangles, not true circle sectors.&nbsp; That could be modified, I had over 100 segments, and that approximated a circle well enough for my purposes.
<br><br>I am submitting the perl code in case others have use for it.&nbsp; Trivial abuse of mapserver, yes, but it was very handy for me -- perhaps it will be handy for someone else.<br><br>Below the dotted line is the perl code.
<br><br>Thanks,<br>Matt<br><br>--------------------------------------<br><br>#This perl code generates coordinate combinations using WKT to create<br>#a table whose geometry rendered by mapserver will create a pie-ish<br>
#chart.&nbsp; It&#39;s not exactly a pie chart, as the pie wedges are triangles,<br>#not true circle sectors, but it&#39;s close enough for a large number of<br>#slices.&nbsp; Code should be easily modifiable to make more circular<br>
#objects for low number of slices.<br><br>########################################################################<br># config<br>########################################################################<br>my $PI = 3.1415926535897932384626433832795
;<br><br>my $slices&nbsp; = 134;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # number of pie slices<br><br>my $ccw&nbsp;&nbsp;&nbsp;&nbsp; = -1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 1 is counter-clockwise, -1 is clockwise<br><br>my $phase&nbsp;&nbsp; = -$PI / 2.0;&nbsp; # phase shift of the starting point<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # -$PI / 
2.0 starts slice enumeration at the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 12 o&#39;clock position<br><br>########################################################################<br># generate wkt coords of slices<br>########################################################################
<br>for my $i (1 .. $slices) {<br>&nbsp; my $xy1<br>&nbsp;&nbsp;&nbsp; = sprintf(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;%5f %5f&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , cos (2 * $PI * ($i - 1) * $ccw / $slices - $phase)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , sin (2 * $PI * ($i - 1) * $ccw / $slices - $phase)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>&nbsp; my $xy2<br>&nbsp;&nbsp;&nbsp; = sprintf(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;%5f %5f&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , cos (2 * $PI * $i * $ccw / $slices - $phase)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , sin (2 * $PI * $i * $ccw / $slices - $phase)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br><br>&nbsp; print &quot;insert into temp values&quot;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,&quot;($i,GeometryFromText(&#39;POLYGON ((0 0, $xy1, $xy2, 0 0))&#39;,-1));&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , &quot;\n&quot;;<br>};<br><br clear="all"><br>