Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex Chart won't filter
    text
    copied!<p>I have flex 4, zend &amp; php. I am trying to generate a chart w/ 5 yrs of data &amp; then let the user (without making another call to the server) get a 1 yr chart w/ the same data. (In other words, the 1 yr's worth of data is a subset of the 5 yrs). I can get the initial 5 yr chart but when I try to apply a filter, as below, I get no data. What am I doing wrong?</p> <p>I have the following code:</p> <p>` </p> <pre><code> &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:datadata="services.datadata.*"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent; protected function getData(event:FlexEvent):void { getDataResult.token = dataData.getData(); } public function filterByRange(item:Object):Boolean { var result:Boolean = true; if (item.date.time &gt; 2007-01-01 &amp;&amp; item.date.time &lt; 2008-12-31 ){ result = false; } return result; dg.refresh(); } ]]&gt; &lt;/fx:Script&gt; &lt;fx:Declarations&gt; &lt;s:ArrayCollection id="dg" filterFunction="filterByRange" list="{getDataResult.lastResult}" /&gt; &lt;s:CallResponder id="getDataResult"/&gt; &lt;datadata:DataData id="dataData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/&gt; &lt;/fx:Declarations&gt; &lt;mx:AreaChart id="areachart1" width="100%" height="100%" creationComplete="getData(event)" dataProvider="{dg}" showDataTips="true"&gt; &lt;mx:series&gt; &lt;mx:AreaSeries yField="price" id="areaSeries" xField="date"/&gt; &lt;/mx:series&gt; &lt;mx:horizontalAxis&gt; &lt;mx:DateTimeAxis/&gt; &lt;/mx:horizontalAxis&gt; &lt;/mx:AreaChart&gt; </code></pre> <p><br> `</p> <p>This is what my PHP code looks like. Remember, I am using Zend.</p> <p>` </p> <pre><code> public function getData() { $stmt = mysqli_prepare($this-&gt;connection, "SELECT * FROM $this-&gt;tablename"); $this-&gt;throwExceptionOnError(); mysqli_stmt_execute($stmt); $this-&gt;throwExceptionOnError(); $rows = array(); mysqli_stmt_bind_result($stmt, $row-&gt;date, $row-&gt;price); while (mysqli_stmt_fetch($stmt)) { $row-&gt;date = new DateTime($row-&gt;date); $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row-&gt;date, $row-&gt;price); } mysqli_stmt_free_result($stmt); mysqli_close($this-&gt;connection); return $rows; } </code></pre> <p>`</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload