Anybody have ANY insight?

Bueller? Bueller?


--- In flexcoders@yahoogroups.com, "carl_steinhilber"
<[EMAIL PROTECTED]> wrote:
>
> --- In flexcoders@yahoogroups.com, "Ely Greenfield" <egreenfi@> wrote:
> > Hi Carl. I'd like to help, but I really need to see your code.  
> > Again, a very simple example...
> 
> Thanks Ely. I've trimmed it down as much as I think I can... I have a
> lot more going on, but this is it in it's basic form... and it still
> exhibits the same issues.
> 
> MXML
> ==============================================
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="appInit()" layout="absolute">
> <mx:Script>
> <![CDATA[
>    [Bindable]
>    public var localData:Array;
>               
>    private function appInit(){
>     localData = [
>       {"name":"Plot
> A","xAxis":"5","yAxis":"6","size":"240000","visible":"1"}, 
>       {"name":"Plot
> B","xAxis":"-5","yAxis":"6","size":"500000","visible":"1"}, 
>       {"name":"Plot
> C","xAxis":"5","yAxis":"-6","size":"500000","visible":"1"}
>       ]; 
>    }
>    private function redrawChart(){
>       plotClient.dataProvider = gridClient.dataProvider;
>    }
> ]]>
> </mx:Script>
> 
> <mx:HBox>
> <mx:Panel width="100%" height="100%">
>    <mx:PlotChart id="plotClient" height="100%" width="100%"
> dataProvider="{localData}" axisTitleStyleName="linearAxis"
> paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20"
> showDataTips="true"  >
>    <mx:horizontalAxis>
>       <mx:LinearAxis baseAtZero="false" maximum="11" minimum="-11"
> title="&lt;  X Axis  &gt;" />
>    </mx:horizontalAxis>
>    <mx:verticalAxis>
>       <mx:LinearAxis baseAtZero="false" maximum="11" minimum="-11"
> title="&lt;  Y Axis  &gt;" />
>    </mx:verticalAxis>
>    <mx:series>
>       <mx:PlotSeries displayName="Chart" id="chartPlotSeries"
> itemRenderer="ClientItemRenderer" xField="xAxis" yField="yAxis" />
>    </mx:series>
>    </mx:PlotChart>
> </mx:Panel>   
> <mx:Panel width="100%" height="100%">
>    <mx:DataGrid dataProvider="{localData}" click="redrawChart()"
> editable="true" height="100%" id="gridClient" name="gridClient"
> width="100%" >
>      <mx:columns>
>         <mx:DataGridColumn dataField="name" headerText="Name"
> textAlign="left" />
>         <mx:DataGridColumn dataField="xAxis" headerText="X Axis" />
>         <mx:DataGridColumn dataField="yAxis" headerText="Y Axis" />
>         <mx:DataGridColumn dataField="size" headerText="Size" />
>         <mx:DataGridColumn dataField="visible" headerText="Show" />
>      </mx:columns>
>    </mx:DataGrid>
> </mx:Panel>   
> </mx:HBox>
> </mx:Application>
> 
> And my ClientItemRenderer AS is pretty much just a revision of the
> samples on QuietlyScheming
> 
> ClientItemRenderer.as
> ==============================================
> package
> {
>    import mx.skins.ProgrammaticSkin;
>    import flash.geom.Rectangle;
>    import mx.graphics.*;
>    import flash.display.Graphics;
>    import mx.core.IDataRenderer;
> 
>    import mx.charts.ChartItem;
>    import flash.events.MouseEvent;
>    import mx.core.UIComponent;
>    import mx.controls.Label;
>    import mx.charts.PlotChart;
>    import mx.charts.series.items.PlotSeriesItem;
>    import flash.events.Event;
>    import mx.events.FlexEvent;
> 
>    public class ClientItemRenderer extends UIComponent implements
> IDataRenderer
>    {
>       private var _label:Label;
>       private var _status:Label;
>       private var _itemFill:uint;
>       private var _itemVisible:Boolean;
>       private var _itemSize:int;
>       private var _itemXAxis:int;
>       private var _itemYAxis:int;
> 
>       public function ClientItemRenderer()
>       {
>          super();
>          _label = new Label();
>          addChild(_label);
>          _label.setStyle("color",0x000000);        
>          _status = new Label();
>          addChild(_status);
>          _status.setStyle("color",0x000000);        
>       }
>       private var _chartItem:ChartItem;
>       
>       public function get data():Object
>       {
>          return _chartItem;
>       }
>       
>       public function set data(value:Object):void
>       {
>          if (_chartItem == value)
>             return;
>          _chartItem = ChartItem(value);
>          _itemVisible = false;
> 
>          if(_chartItem != null){
>             _itemXAxis = _chartItem.item.xAxis;
>             _itemYAxis = _chartItem.item.yAxis;
> 
>             var clientRev = _chartItem.item.size;
>             _itemSize = 1;
>             if (int(clientRev) > 250000) _itemSize = 2;
>             if (int(clientRev) > 500000) _itemSize = 3;
>             if (int(clientRev) > 750000) _itemSize = 4;
>             if (int(clientRev) > 999999) _itemSize = 5;
>             if (_chartItem.item.visible==1) _itemVisible = true;
>             _label.text = _chartItem.item.name;
>             _status.text = String(_itemSize);
> 
>             _itemFill = 0xFFA023;
>             if (_itemXAxis < 0 && _itemYAxis < 0) _itemFill = 0xFF0000;
>             if (_itemXAxis >= 0 && _itemYAxis >= 0) _itemFill =
0x26B417;
>          }
>          this.invalidateProperties();
>       }
>       
>       private var _over:Boolean = false;
>               
>       private static var rcFill:Rectangle = new Rectangle();
>               
>       override protected function
> updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
>       {
>          super.updateDisplayList(unscaledWidth, unscaledHeight);
>          if (_itemVisible){
>             var fill:* = (_over)? 0x0000FF:_itemFill;
>             var w:Number = (_itemSize - 1) * 4;
>             var g:Graphics = graphics;
>             g.clear();                
>             g.beginFill(fill);
>             g.drawCircle( unscaledWidth / 2, 
>                                     unscaledHeight / 2,
>                           unscaledWidth / 2 + w);
>             g.endFill();
>            
>
_label.setActualSize(_label.getExplicitOrMeasuredWidth(),_label.getExplicitOrMeasuredHeight());
>             _label.move(unscaledWidth/2 -
> _label.getExplicitOrMeasuredWidth()/2,- (15 + w));
>          }
>       }
>         
>    }
> }
> 
> At designtime, if I set the visible of any of the items in localData
> to 0, or adjust the size, the chart renders as expected when the app
> is launched.
> 
> And at runtime, if I change the values for XAxis and/or YAxis in the
> dataGrid, the items on the chart move as expected. But changing the
> values for size or visible, however, don't redraw the items. And if I
> move an item into the lowerleft quadrant, where it should paint as red
> fill, it retains the fill that it was initially drawn as instead.
> 
> I tried adding invalidateDisplayList() and validateNow() to the
> redrawChart() function and it had no effect.
> 
> Any help would be much appreciated!
> Thanks,
> -Carl
>


Reply via email to