0 Replies Latest reply on Aug 31, 2010 1:30 PM by t90mks9

    Setting solidcolor to a pie chart clise doesn't persist the color

    t90mks9

      I have a need to dynamically change the color of inidvidual pie slices in a Pie chart.  I am able to do it using colorpicker in an item handler,.  However, when I set the "fill" property of the PieSeriesItem to the desired color, it seems to chnage the color, but, the next time I click on the handler again, it reverts it back to the original color.  Any help would be appreciated.  Thanks.

       

      private function selectItemHandler(e:ChartItemEvent):void {
                  var hitData:HitData = e.hitData;
                  psi = PieSeriesItem(hitData.chartItem);               
                 
                  cp = new ColorPicker();
                  this.addChild(cp);
                  cp.addEventListener(ColorPickerEvent.CHANGE, changeItemColor);
                  cp.x = e.localX;
                  cp.y = e.localY;
                  cp.open();
              }
             
              private function changeItemColor(e:ColorPickerEvent):void {
                  var c:SolidColor = new SolidColor(cp.selectedColor);
                 
                  psi.fill = c;               
                 
                  // This next line triggers a call to updateDisplayList():
                  psi.itemRenderer.height = csi.itemRenderer.height;          
                 
                  this.removeChild(cp);
              }