Experimental Pie Chart

Pie Charts - I thought it couldn’t be done.

Awhile back I was contacted privately about the possibility of creating charts in Panorama X. The interest was mainly in creating pie charts since bar charts were relatively easy with simple Panorama graphic objects. I replied at the time that I didn’t think Panorama X had any graphics objects that could be used to create a pie chart. We agreed it was probably not doable in the current graphics environment. After letting this problem bounce around in my head for some weeks it finally dawned upon me that I could use the simplest of all the Panorama X graphics objects to simulate a pie chart - the Line.

I had previously done some work with rotating a line around an axis with the Analog Meter project (available on the Panorama Database Exchange) so most of the necessary math was already worked out. My idea was to create 360 lines rotated around a common axis at 1º intervals. I worked out a procedure to automatically create and position each line in turn because it would be virtually impossible to do it manually. When I ran the procedure it looked so cool as it took shape on the form that I decided I wanted to create it on the fly when making a new pie chart or even when refreshing an existing chart. The resulting Pie Chart file can be downloaded from the Panorama Database Exchange.

The experimental rendition I ended up with supports up to 5 data values with individual colors. As it sits, the colors are not changeable unless you alter the values in the procedure and change the formulas for the ImageDisplayObjects (guess I’m getting lazy). There is an option to turn off the animation when refreshing which speeds things up somewhat by blanking the chart until it is finished rebuilding. There is also another option to choose the line width of the individual segment lines. You can choose a 1, 2 or 3 pixel width. Using a 1 pixel width will create some very interesting moire patterns and some three dimensionality while the 2 pixel width only has a slight lightening out at the very edge. The 3 pixel width is totally solid but the center axis is somewhat misaligned

Pie Chart

Note that Pie Chart is just experimental and offers a jumping off point if you want to adapt it for your own use. The Refresh procedure will create the 250 pixel diameter pie chart around an axis sitting 350 pixels from the left edge of the form and 316 pixels from the top. Finally, if no values are entered and it is refreshed the pie chart will be colored completely with the color listed for the 5th value.

I’m sure Jim will have his own native charting available at some point so I have no intention of going any further with future refinements. It was just an enjoyable personal challenge on my part and something I felt worth sharing. Again, you can find Pie Chart on the Panorama Database Exchange under the Help menu.

Gary Yonaites

GYsmalllogo

Very creative. Very cool.