19 Replies Latest reply: Mar 10, 2015 4:29 PM by krazykatykay RSS

    how to make an odd shaped pie chart

    daymonic

      Hi there,

       

      I was wondering how difficult it would be to translate stats into an odd shaped object, to be divideed up into a pie. Oviously I could make a normal pie. overlay it and split the object up according to the angles, but this would result in un even area mass (ideally the area of each slace should equate to the percentage of each figue).

       

      Hope this makes sense (my brains feeling slightly mushy thanks for excessive analysis of recycling statistics!

       

      Kind regards D.E

        • 1. Re: how to make an odd shaped pie chart
          Steve Fairbairn Community Member

          If your object is odd-shaped I have the feeling that it won't make a very good pie chart. It will be difficult to compare visually the relative areas og the slices.

          Apart from that I don't think there's any way to divide an irregular shape automatically into slices of a predetermined area. You would presumably need to start off by finding the shape's centre of gravity but that will only get you so far. (There are threads about that. Here's a nice long one: http://forums.adobe.com/message/4279794#4279794)

          • 2. Re: how to make an odd shaped pie chart
            JETalmage Community Member

            What kind of "odd shape" do you have in mind?

            If you're talking about having AI's pie graph functionality automatically substitute any arbitrary shape for the circular pie, then no, there is no feature for such a thing.

             

            If you're talking about manually substituting the arbitrary shape(s), and the stumbling block is just knowing the area of the arbitrary shape:

            Illustrator's Javascript model does include an area property of the PathItem object, which returns the area of a path in square points. So you could:

             

            1. Use the Pie Chart Graph tool to create a plain vanilla pie chart.

            2. Ungroup the chart completely (several nestings deep) until you have individual paths.

            3. Select a wedge, run the script (a simple script is below), note the area.

            4. Draw the corresponding arbitrary shape, run the script, note the area.

            5. Divide the areas to arrive at a scale factor.

            6. Scale the arbitrary shape accordingly.

             

            //script start 

            var docRef=app.activeDocument;

            var pathRef=docRef.selection[0];

            var pathRefArea=pathRef.area;

            alert(pathRefArea);

            //script end

             

            A little elaboaration of the script could automatically scale the arbitrary shape to the same area as that of the pie chart slice, but doing the simple math should not be arduous for occasional need.

             

            So, for example, suppose you wanted to conceptually compare the counts of three separate recycled items by depicting proportional heaps of each item: aluminum cans, plastic bottles, glass bottles. You could:

             

            1. Store a graphic of a single can, a single plastic bottle, and a single glass bottle as Symbols.

            2. Use the Symbolism tools (Sprayer, Sizer, Scruncher, Spinner, etc.) to draw the three heaps.

            3. Use the procedure described above to determine scale factors for the three heaps.

             

            The results could look like three similarly- but irregularly-shaped piles of cans, plastic bottles, and glass bottles, proportionally sized to suggest the relative counts of recycled items.

             

            JET

            • 3. Re: how to make an odd shaped pie chart
              Mike Gondek2 MVP

              Are you familair with using the pie chart tool in illustrator?

              Click the pie tool

              Enter the size of the pie chart you want (egL i used 4" x 4")

              Enter the values in your excel style chart

              Clcik the chekmark to generate chart

              Expand the pie chart.

              Use the pieces to either pathfinder or mask.

              Screen shot 2012-04-11 at 12.12.59 PM.png

              Screen shot 2012-04-11 at 12.18.17 PM.png

              • 4. Re: how to make an odd shaped pie chart
                Steve Fairbairn Community Member

                Obviously this method will work as long as the original object is roughly pie-shaped.

                But what if it's L-shaped or even just plain square? You're going to get into hellish trouble reckoning out the areas of the slices (like JET explains).

                It's a bit like dividing seven potatoes equally between five people – usually the easiest way is to mash them.

                • 5. Re: how to make an odd shaped pie chart
                  Larry G. Schneider MVP

                  Still with the Bangers&Mash, eh Steve. Can't get the Englis out of the boy.

                  • 6. Re: how to make an odd shaped pie chart
                    Steve Fairbairn Community Member

                    Still with the Bangers&Mash, eh Steve.

                    First thing I go for when visiting the UK. Can't get decent bangers here.

                    As fot the spuds, have you guys (stateside) got another word for mashing?

                    • 7. Re: how to make an odd shaped pie chart
                      Larry G. Schneider MVP

                      Usually here referred to as mashed potatoes.

                      • 8. Re: how to make an odd shaped pie chart
                        Steve Fairbairn Community Member

                        Usually here referred to as mashed potatoes.

                        So that's just about the same. How about bangers or don't you have them? And I don't mean wieners/frankfurters.

                        Proper bangers ares made from fat pork, breadcrumbs moistened with milk, pepper, salt and various herbs.

                        Sold uncooked (pale and limp) and they fatten up when fried so you have to ***** them beforehand so that the skins don't split. Fry until crisp on the outside.

                        The final result looks something like this (the gravy is optional):

                        images.jpg

                        • 9. Re: how to make an odd shaped pie chart
                          tromboniator Community Member

                          I think it sounds (and looks) excellent, but imagination fails me when I try to figure out  how to ***** them. What did Nanny omit?

                          • 10. Re: how to make an odd shaped pie chart
                            Steve Fairbairn Community Member

                            It appears that Nanny deleted the very innocent word for what you do with a fork to make little holes.

                            p

                            r

                            i

                            c

                            k

                             

                            Sorry 'bout that :-)

                            • 11. Re: how to make an odd shaped pie chart
                              ajrunke03 Community Member

                              Ahahahaha. Best post ever.

                              • 12. Re: how to make an odd shaped pie chart
                                daymonic

                                Hahahaha how the hell did we get into bangers and mash recipees!!!!!

                                 

                                If I could pull this back to my original question for a minute, I'm looking for a method which can split more uneven shapes, the first one I'm working on is to relect differnt stats about wood recycling, and I want to split this odd shaped log into chunks to reflect the stats.

                                cross section.jpg

                                I did think about using the pie chart tool like Mike suggested, but that would mean the bits on the left and right have a much lower surface area than the ones on the top and bottom.

                                Is there no way to eithr tweak a standard pie so its shape fits this one, or to divide this up according to percentages of its surface area?

                                 

                                I'd really like to know as this is the only image I have which is remotely simlar to standard pies.

                                 

                                FYI pie and mash tops bangers and mash any day and gravy is NEVER optional!!!!!!

                                • 13. Re: how to make an odd shaped pie chart
                                  [Jongware] MVP

                                  After wrestling for about 2 hours with Illustrator's immensely frustratingly limited Javascript, I'm officially giving up on this.

                                   

                                  I came this far:

                                   

                                  1. Select the base object, and enter a series of values. Easy as Pie Chart, so far. Even drawing a proper pie on top of the selection -- to use as a base value -- is ... doable. Just.

                                   

                                  2. you cannot get 'the area' of a symbol or compound object. So I (manually!) draw an outline copy on top of the original and used that.

                                   

                                  3. you cannot 'intersect', 'minus back', or do any other pathfinder operation. So I copied Carlos' method of creating a Graphic Style for Minus Back.

                                   

                                  4. you cannot Expand Appearance from a script, and you cannot measure the area of a live Minus Back'ed object.

                                   

                                  There goes my idea, down the drain: calculate the deviation of the sliced-up object to the value required, adjust, and re-slice the object according to this new insight.

                                   

                                  Instead I got an entirely new insight. Guess what it was.

                                  • 14. Re: how to make an odd shaped pie chart
                                    Steve Fairbairn Community Member

                                    We got into mashed potatoes because the best way to recycle your log of firewood is to reduce it to sawdust and then regroup it.

                                    JET's answer is probably next best but my brain doesn't work the same way as his so I'm sure I would never get a script like he suggests to work properly.

                                    Mike's way is good too but you would need to fiddle with it if you want to get the centre vertices to match the centre of the annual rings. I reckon I would fake it and hope that no-one would notice (which they probably wouldn't if you did it well). It has something to do with positioning the centre of the (undistorted) pie chart on a point diametrically opposite the centre of the annual rings and then moving just the centre points back the the centre of the rings, but I don't know how to do it mathematically.

                                     

                                    Or maybe Jongware has got something up his sleeve that he's not letting on about.

                                    • 15. Re: how to make an odd shaped pie chart
                                      JETalmage Community Member

                                      Assuming the graphic is roughly circular, like the example you showed:

                                       

                                       

                                       

                                       

                                       

                                       

                                       

                                       

                                      JET

                                      • 16. Re: how to make an odd shaped pie chart
                                        CarlosCanto MVP

                                        [Jongware] wrote:

                                         

                                        After wrestling for about 2 hours with Illustrator's immensely frustratingly limited Javascript, I'm officially giving up on this.

                                         

                                        hahaha...sorry about that Jongware, I know, it's not funny...are you implying you can actually do stuff with ID scripting?

                                         

                                         

                                        Instead I got an entirely new insight. Guess what it was.

                                         

                                        #@%& Illustrator Scripting?

                                         

                                        Message was edited by: CarlosCanto

                                        • 17. Re: how to make an odd shaped pie chart
                                          [Jongware] MVP

                                          CarlosCanto wrote:

                                          ...are you implying you can actually do stuff with ID scripting?

                                           

                                          I sure can. You'll be amazed, but ...

                                           

                                          Instead I got an entirely new insight. Guess what it was.

                                           

                                          #@%& Illustrator Scripting?

                                           

                                           

                                          right! ... so you're going to have to use InDesign to use that forthcoming Amazing Script.

                                          • 18. Re: how to make an odd shaped pie chart
                                            Jacob Bugge MVP

                                            DE,

                                             

                                            In a stump chart case like this it would seem appropriate to use the pith as the starting point of the chart.

                                             

                                            The following images show a relatively simple way of making a quite accurate division in connexion with a stump that has a strongly asymmetric shape with reaction wood.

                                             

                                            Always keep a copy of the artwork at different stages.

                                             

                                            I) shows the stump, the stroke/nofill annual rings and the pith as a group kept on top and (mostly) locked in the following steps, the stroked and filled (outer) shape of the stump being worked with.

                                             

                                            II) shows a division aid in the form of a 360 (1 degrees) pie chart, made from a Polar grid with 0 Concentric Dividers and 360 Radial Dividers: the Radial Dividers are extended past the outer circle, and the pie pieces are formed by Pathfinder>Divide.

                                             

                                            III) shows the division aid centred over the pith.

                                             

                                            IV) shows the stump moved on top of the division aid, its fill covering the inner part.

                                             

                                            V) shows the result of Object>Path>Divide Objects Below where the stump has cut the division aid.

                                             

                                            VI) shows the result when the outlying superfluous parts of the division aid have been deleted.

                                             

                                            Now the division aid consists of 360 closed paths, each spanning 1 degree, all starting/meeting at the pith. These should be Ungrouped.

                                             

                                            At any time up to this point, the total stump area may be determined, for older versions the free Telegraphics PathArea Filter may be used (available at http://www.telegraphics.com.au/sw/browse/Filters).

                                             

                                            Now it is easy to select a number of closed paths of the division aid and use the PathArea filter (or whatever) to determine the proportion of the total area (simple division), to adjust by adding/removing and/or undoing/redoing, and then to Pathfinder>Unite (or whatever it is called in the version in question) to create a piece of the pie, and finally to increase the Stroke Weight as desired.

                                             

                                            VII) shows the result of creating the top piece of 11%.

                                             

                                            VIII) shows the result of creating all the pieces (made clockwise one at a time), the three 11% pieces (the first one and the two last ones) chosen to be alike, thus showing the great difference(s) in angles for identical areas.

                                             

                                            This procedure leads to a great number of Anchor Points in the bark; it is possible to get rid of them by scaling the pieces with the pith as the key object, placing the original stump path on top, and Object>Path>Divide Objects Below, then delete the outlying parts.

                                             

                                            It is also possible to move the pieces apart, away from the pith, if there is a wish to hurt the stump (even more).

                                             

                                            The accuracy is well within 0.1% of the total stump area for the least accurate pieces.

                                             

                                             

                                             

                                            • 19. Re: how to make an odd shaped pie chart
                                              krazykatykay

                                              OMG you potato heads, you had the right answer but you didn't know it. I have a MUCH easier answer that the math above:

                                              1. Make your pie chart in illustrator. You can color your wedges as you would like in the final. (Lots of tutorials on making a pie chart, not covered here.)

                                              2. THIS IS THE KEY THING: Ungroup the pie wedges.

                                              3. Create the shape you want. You just really want the outline in the end. This is your mask. I find it helpful to give it a transparency value.

                                              4. Place your mask over the pie chart. This is where transparency is helpful.

                                              5. Now make the mask clear -- no color value.

                                              6. Select pathfinder > divide. Since the pie chart is ungrouped, each wedge is divided based on the outline of your shape.

                                              7. Delete the shape parts outside your shape.

                                               

                                              Easy as pie. No math.