|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
LineChart not updating when DP changesI am adding data to a LineChart with Actionscript. I have buttons in a
datagrid that add different "fields" (attributes in the XML dataProvider, for example, jul1509="5") of data by sending a string of what attribute of the XML should be used for the yAxis of the LineSeries in the addToChart method, as shown below. This works fine. However, when I go to change the dataProvider, even though I can see the method to change the DP is indeed called, and the new data in the dataProvider is indeed different, but the LineChart does not alter or change, even though I also call linechart.invalidatestyles() to trigger a redraw. Relevant AS: private function onXMLCompositeLoadComplete(event:XMLFileLoaderEvent):void { _isXML = true; _compositeAssociateMeasures = new XMLListCollection(_chartXML.results.employees.employee.(@role == "associate").datasets.dataset.(@type="pretest").measure); _compositeManagerMeasures = new XMLListCollection(_chartXML.results.employees.employee.(@role == "manager").datasets.dataset.(@type="pretest").measure); /* XML looks like this: <xml> <results> <employees> <employee role="associate"> <datasets> <dataset type="pretest" name="Pre-test Agregate Associate Scores"> <measure category="Architecture" id="A 1" jul1509="5" aug1209="7" sept0309="6" /> <measure category="Architecture" id="A 2" jul1509="7" aug1209="8" sept0309="7" /> ...etc. */ } private function addToChart(itemArray:Array):void { for each(var item:String in itemArray) { var newLS:LineSeries = new LineSeries(); var newStroke:Stroke = new Stroke(); if(_colorId == _chartXML.config.ui.colors.color.length()) _colorId = 0; newStroke.color = _chartXML.config.ui.colors.color[_colorId].@value; newStroke.weight = 2; if(_isXML) newLS.yField = "@"+item; else newLS.yField = item; newLS.displayName = item; newLS.setStyle('showDataEffect', 'interpolateIn'); newLS.dataProvider = _compositeAssociateMeasures; newLS.setStyle('lineStroke', newStroke); var linechartSeriesArray:Array = linechart.series; linechartSeriesArray.push(newLS); linechart.series = linechartSeriesArray; linechart.invalidateSeriesStyles(); _currentChartItems.push(item) _colorId++; } } Relevant MXML: <mx:LineChart id="linechart" seriesFilters="[]" color="0x323232" height="250" width="{containerCanvas.width-25}" showDataTips="true" dataProvider="{_compositeAssociateMeasures}" themeColor="#FFA9A9"> <mx:horizontalAxis> <mx:CategoryAxis id="hAxis" categoryField="@id" /> </mx:horizontalAxis> <mx:horizontalAxisRenderers> <mx:AxisRenderer axis="{hAxis}" canDropLabels="false" color="0x666666"/> </mx:horizontalAxisRenderers> <mx:verticalAxisRenderers> <mx:AxisRenderer axis="{vAxis}" color="0x666666" /> </mx:verticalAxisRenderers> <mx:verticalAxis> <mx:LinearAxis id="vAxis" minimum="1" maximum="10"/> </mx:verticalAxis> </mx:LineChart> Any ideas? Thanks. Jason Merrill <<Picture (Device Independent Bitmap)>> Bank of America Global Learning Learning & Performance Soluions Join the Bank of America Flash Platform Community <http://sharepoint.bankofamerica.com/sites/tlc/flash/default.aspx> and visit our Instructional Technology Design Blog <http://sharepoint.bankofamerica.com/sites/SDTeam/itdblog/default.aspx> (note: these are for Bank of America employees only) |
|
|
Re: LineChart not updating when DP changeshmmmm... anyone?
|
|
|
Re: Re: LineChart not updating when DP changestry update manually using the id of the linechart (in the dp change event handler) like...
linechartid.dataProvider = dataprovider. ________________________________ From: jmerrill_2001 <jason.merrill@...> To: flexcoders@... Sent: Mon, November 9, 2009 4:43:24 PM Subject: [flexcoders] Re: LineChart not updating when DP changes hmmmm... anyone? |
|
|
Re: LineChart not updating when DP changes>>try update manually using the id of the linechart (in the dp change event handler) like...linechartid.dataProvider = dataprovider.
Huh? If you see in my code, that's exactly what I'm doing and why I'm confused the chart isn't changing even though the data is different. |
| Free embeddable forum powered by Nabble | Forum Help |