4 Replies Latest reply on Dec 9, 2008 6:51 AM by socialmoviemap

    LineChart + select item

    socialmoviemap
      Hello,

      since 2 weeks i develope an applikation in Flex 3. There i have a LineChart. My problem is, to get the selected item or the clicked item. Here are my Source Code of the LineChart and a Selection of my XML file.

      httpservice <=> id of HttpService

      quote:



      ....
      [Bindable]
      public var selectedItem: Object;

      ....

      <mx:LineChart id="linechart" height="100%" width="100%" showDataTips="true" dataProvider="{httpservice.lastResult.li}" y="30">

      <mx:seriesFilters>
      <mx:Array/>
      </mx:seriesFilters>

      <mx:horizontalAxis>
      <mx:CategoryAxis categoryField="year" id="yearAxis" />
      </mx:horizontalAxis>

      <mx:series>
      <mx:LineSeries yField="count" id="line" form="curve" click="this.selectedItem=LineSeries(event.target).selectedItem; ">
      <mx:lineStroke>
      <mx:Stroke color="0xff9000" weight="3" alpha="1"/>
      </mx:lineStroke>
      </mx:LineSeries>
      </mx:series>

      </mx:LineChart>



      Here is the XMLFile...

      quote:


      <list>
      <li><year>1907</year><count>2</count></li>
      <li><year>1912</year><count>1</count></li>
      <li><year>1919</year><count>4</count></li>
      <li><year>1920</year><count>233</count></li>




      The LineChart looks fine, but know i want to get the clicked item:

      example: "you clicked year: 1919"

      thx

      greetings