RE: [flexcoders] Re: Absolutely forcing chart to redraw

2007-05-15 Thread Ely Greenfield
 

 

 

My guess would be that you've got a performance gate at the top of your
set data(...) function.  If the item renderer is being a passed a
reference to an item it already knows about, your set data(...) function
bails out. Which means that the code immediate below...which loads all
of the data out of the item into cached fields...never gets run. So if
the dataprovider hasn't changed, but the individual items have,
generally your item renderer won't update its cached  values.

 

Remove that line, and it might solve your problems? 

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of simonjpalmer
Sent: Tuesday, May 15, 2007 1:49 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Absolutely forcing chart to redraw

 

grasping at straws, have you tried a bubble chart instead? I suspect
the series are derived from the same root.

or maybe you could subclass the plotseries and overload
updateTransform or some other suitable method.

just ideas

I managed to get my similar problem basically working by writing a
fair bit of code that made sure the bound data actually changed. In
my case (which I think was different) I was not quite binding
correctly so the data I was changing was not causing the update. I
haven't cracked it completely and I'm certain that I get situations
where item renderers are re-used as new data points occasionally
have the same colour properties as data points which have been removed
from the chart and are inappropriate for their data. All a bit
mysterious I'm afraid.

Is the charting code going open source?

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, carl_steinhilber
[EMAIL PROTECTED] wrote:

 Anybody have ANY insight?
 
 Bueller? Bueller?
 
 
 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com , carl_steinhilber
 carl_steinhilber@ wrote:
 
  --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.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:24,visible:1}, 
  {name:Plot
  B,xAxis:-5,yAxis:6,size:50,visible:1}, 
  {name:Plot
  C,xAxis:5,yAxis:-6,size:50,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

RE: [flexcoders] Re: Absolutely forcing chart to redraw

2007-05-11 Thread Ely Greenfield
 

Hi Carl. I'd like to help, but I really need to see your code.  Again, a
very simple example...of your item renderer, and the mxml, and some
actionscript that shows what kind of a change you're trying to
make...will be necessary to really help.  I don't see your item renderer
code in the post below.

 

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of carl_steinhilber
Sent: Friday, May 11, 2007 8:56 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Absolutely forcing chart to redraw

 

Anyone else have any ideas?
I really need to get this solved, or I'll have to throw out the entire
app and build it in something else. This is crucial functionality.

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, carl_steinhilber
[EMAIL PROTECTED] wrote:

 Thanks Ely... I was hoping to catch your attention ;-)
 
 The (complete) code for the itemRenderer is below in my original
 posting. Was there some other sample code that would be useful? I
 can't imagine that the MXML would be all that helpful... as all that
 would show is that I'm assigning the custom itemRenderer to the
 PlotSeries of the chart. But... let me know.
 
 Basically my app consists of two panes, one contains the chart, and
 one contains a datagrid, both bound to the same object for their
 dataProviders. The object is actually being populated via a DB query
 using Flexcubed's FlexSQL SWC (since the backend is ASP and I can't
 use CF on this project). But I don't think that plays into it since
 I've checked a number of times that the array is created as expected
 and is valid.
 
 The query loads up a bindable object (localData). I have a button to
 save the data back to the DB, but until the user elects to do so, I
 just want to operate with the local version of the object. So I can't
 go back to the DB for a full refresh. But I tried something like:
 {
 var origDataProvider = chart.dataProvider;
 chart.dataProvider = new Object();
 chart.dataProvider = origDataProvider;
 }
 and even that didn't refresh the chart appropriately.
 
 Can you give me some pointers to have my dataprovider items dispatch
 change events?
 
 Thanks much!
 -Carl 

 At runtime, the chart initially loads exactly as expected (items the
 correct size, color and position). Then if I update the values for
 xAxis and/or yAxis, the item moves on the chart as expected (though if
 it moves from a positive value to negative value on either axis, the
 color remains green).
 But if I update the value for size it doesn't update the item on the
 chart, and if I update visible to false the item remains visible.

 

image001.jpgimage002.jpg