4 Replies Latest reply on Dec 20, 2010 9:18 AM by WCSessums

    How to set PieChart radius?

      I have two PieCharts -- one displays a subset of the data shown in the other. Therefore, I'd like the second to be proportionally smaller. How do I control the diameter of a PieChart?

      Here's an example. The second chart is larger than the first, even though it represents a subset of the first.

      Thanks for the help!
        • 1. Re: How to set PieChart radius?
          maxrahder Level 1
          Any ideas?
          • 2. How to set PieChart radius?
            shawnyale Level 1
            You can ty setting the outerRadius property to a function of the first series. Such as
            <mx:Panel x="358" y="10" width="340" height="439" layout="absolute" title="Scores">
            <mx:VBox x="0" y="0" height="100%" textAlign="center" width="100%">
            <mx:PieChart id="piechart2" height="100%" width="100%" dataProvider="{b}">
            <mx:PieSeries id="pieSeries1"/>
            <mx:PieSeries id="pieSeries2" displayName="name" field="score" labelPosition="outside" labelFunction="wedgeLabel" outerRadius={pieSeries1.outerRadius * .5 } />

            This may work but you will need to determine which of the two series are visible at a given time. I imagine if you use a view state for the chart, then you can just add the second series into the second viewstate and remove the first series. Regardless, I would think that binding off of the outerRadius property of the first series would give you what you want.

            If you are looking at using subsets from one chart to another, I would recommend looking at using chart-drill down. I have used drill-downs before and they provide a great way to move from one set to another. You can find a great example at Ely's blog:

            Let us know how it works out.
            • 3. How to set PieChart radius?
              maxrahder Level 1
              Thanks for the suggestions -- I'm still trying things out. However, note that according the the API the "outerRadius" property is

              The percentage of the total space available to the PieSeries to use when rendering the contents of the series. This value is managed by the containing chart, and should not be assigned to directly.
              In other words, it's not an absolute number, like a number of pixels, but rather, it's a percentage of the "available" space. That's the problem -- apparently, Flex is deciding how much available space there is, based in part on things like label positions, which are somewhat out of our control.
              • 4. Re: How to set PieChart radius?

                I do not know what method is used to calculate the size of the chart; however, this will get you pretty close.



                X=desired Diameter

                Y=Diameter to enter as Width and Height in Graph Dialog


                Y= -.0009*X^2 + 1.1448*X + .0256