5 Replies Latest reply on Aug 11, 2009 8:34 AM by matthew horn

    PlotChart fillFunction

    paraglidersd

      I am using a fillFunction on a plotChart to determine which color the item should be.  Is there a way to determine which 'shape' and whether the drawn shape is color-filled or just outlined?  -Thanks,Bill

        • 1. Re: PlotChart fillFunction
          matthew horn Level 3

          You can determine whether the shape is filled or not by setting the returned IFill's alpha set to 0 (it's the second param in the SolidColor constructor). For example:

           

          private function myFillFunction(element:ChartItem, index:Number):IFill {
               // some logic here to specify a custom color

               // ...

           

               var c:SolidColor = new SolidColor(myColor, 0);

               return c;

          }

           

          To change shape of a data point within a series based on its values, I think you could extend the series' item renderer (such as CircleItemRenderer), but I don't have an example that I can show you.

           

          matt horn

          flex docs

          • 2. Re: PlotChart fillFunction
            paraglidersd Level 1

            Thanks for the response, Matt.  Unfortunately, setting the IFill alpha to zero makes it so that the data point doesnt display at all (meaning, its transparent?).  I want to draw, for example, the outline of a diamond and not have it filled in.  Maybe I did something wrong or misunderstood your post?

            • 3. Re: PlotChart fillFunction
              matthew horn Level 3

              Ah, well, you can create a border around the diamon by setting the stroke, like this:

               

               

               

               

              <mx:SolidColor id="sc" alpha="0"/>

               

               

              <mx:Stroke id="s" color="0x000000" weight="1"/>

               

              Then in the series:

               

               

              fill="

              {sc}"

              stroke="

              {s}"

               

              hth,

              matt horn

              flex docs

              • 4. Re: PlotChart fillFunction
                paraglidersd Level 1

                Thank you.  I will try that.  If I am reading this right, I will have to have a different series for each 'type' of data I want to plot.  E.g., Some I want to be blue diamonds, some red circles, etc.   -Bill

                • 5. Re: PlotChart fillFunction
                  matthew horn Level 3

                  Well, yes and no. If you want to use different "item renderers" -- that is, different shapes for each "type" of data, then yes, you'll need a separate series. For example, if you were charting the condition of products, you could have a circle for products that are "new", a diamond for products that are "very good", and a box for products that are "poor" condition.

                   

                  You can set the colors for each series (like a red circle) for the series without having to use a fill function. The fill function is if you want different colors of teh same "type" of items. Maybe your "new" product series would have red circles for items that are out of stock and green circles for items that are in stock, for example.

                   

                  hth,

                  matt horn

                  flex docs