1 Reply Latest reply on Aug 24, 2009 2:29 AM by _Natasha_

    plot chart problem

    peddireddyss

      Hi experts,

       

          In plotchart using cirlcular item renderer am getting full details.But instead of that one using customItemRenderer am unable to get full details.This is my customItemRender(CirlceFileRenderer ) action script class file

      package
      {
          import flash.display.Graphics;
         
          import mx.charts.series.items.PlotSeriesItem;
          import mx.core.IDataRenderer;
          import mx.skins.ProgrammaticSkin;

       

          public class CirlceFileRenderer extends ProgrammaticSkin implements IDataRenderer
          {
              public function CirlceFileRenderer()
              {
              }
              private var _chartItem:PlotSeriesItem;
              public function get data():Object
              {
                  return _chartItem;
              }

       

              public function set data(value:Object):void
              {
                  _chartItem = value as PlotSeriesItem;
                  invalidateProperties();
              }

       

              override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
              {
                  super.updateDisplayList(unscaledWidth, unscaledHeight);
                  var g:Graphics = graphics;
                  g.clear();
                  var col:Number = 0;
                  var x:Number = 0;
                  var y:Number=0;
                  //if(_chartItem!=null)
                  //{
                  var obj:Object = _chartItem.item as Object;
                  //col = getColor(obj.Color as Number);
                  x= obj.Xdata as Number;
                  y=obj.Ydata as Number;
                  //} 
                  g.beginFill(col);
                  trace("X :"+x+" Y :"+y);
                  trace("_chartItem.x:"+_chartItem.x+" _chartItem.y :"+_chartItem.y);
                  g.drawCircle(_chartItem.x,_chartItem.y,1);
                  //g.drawCircle(x,y,1);
                  //g.drawRect(_chartItem.x,_chartItem.y,unscaledWidth,unscaledHeight);
                  // g.drawRect(x,y,1,2);
                  g.endFill();

       

              }
              public function getColor(x:Number):Number   
              {
                  if(x < 0.0)
                      return 0x000000;
                  else if (x < 0.125)
                      return 0x000088;
                  else if (x < 0.375)
                      return 0x0000FF;
                  else if (x < 0.625)
                      return 0x00FFFF;
                  else if (x < 0.875)
                      return 0xFFFF00;
                  else if (x <= 1.0)
                      return 0x880000;   
                  else
                      return 0xFFFFFF;   
              }
          }
      }

       

      Flex action script code is like this:

       

       

       

      private function handleResult(event:ResultEvent):void
                  {             
                      temparray = event.result as Array;
                      for(var i:int =0;i<256;i++)
                      {
                          var ta:Array = new Array();
                          var ar:Array = new Array();
                          ar = temparray[i];
                          for(var j:int = 0;j<288;j++)
                          {
                          //    trace("a["+i+"]["+j+"] -:"+ar[j]+" Color:"+(Math.abs(ar[j])-131) / 20);
                              ta.push({Xdata:i,Ydata:j,Color:(Math.abs(ar[j])-131) / 20  });
                         
                          }
                          var ps:PlotSeries = new PlotSeries();
                          ps.xField = "Xdata";
                          ps.yField = "Ydata";
                          //ps.radius = 1;
                          ps.setStyle("itemRenderer",new ClassFactory(CirlceFileRenderer));
                          ps.dataProvider = ta;
                          newarr.addItem(ps);
                      }    
                      chart.series = newarr.toArray();       
                  }

       

       

      Am unable to find the problem.I didn't get full details in plot chart.

       

       

       

      Please tell me this is urgent requirement....

        • 1. Re: plot chart problem
          _Natasha_ Level 4

          Hi,

          what info you didn't get?

           

           

          try this

           

          public function set data(value:Object):void
                  {
                      _chartItem = value as PlotSeriesItem;

                    super.data = value;
                      invalidateProperties();
                  }