3 Replies Latest reply on May 19, 2009 11:34 AM by _Natasha_

    Question on Charts. please help.

    tcflex

      Hi All,

       

      I have a bubble series with a bindable data provider associated with it. (Array Collection). This array collection is dynamically refreshed for every x seconds. If I select a chart item and after x secs once the data provider gets refreshed the selection is no more available. But I have a scenario if the selected item is part of the newly refreshed data it should stay selected. In order to solve this i had created a persistent array where it store all the selected items in the chart. once the chart data gets refreshed I am comparing with the new refreshed data with the persistent array to check if the present data set contains any previous selected chart items. If it finds any of those persistent items, I am trying to select them by using selected indices property of a series. The problem starts here, after setting selectedIndices property to an array of items, the chart elements still are not highlighted or selected.

       

      One interesting observation:

      ---------------------------------------

       

      I have a chartClick handler which listens for chartClick events. If I click on any part of the chart the items which are stored as part of persistent array are getting selected. So I thought of dispatching a manual chart click event as soon as I set the selected indices property. But it proved worth less.

       

      Regards,

      Arjun.

        • 1. Re: Question on Charts. please help.
          _Natasha_ Level 4

          Hi,

          in this case you have a problem with ArrayCollection. But usually ArrayCollection save all selected data in other controls such as Tree and DataGrid. Check that you don't change dataProvider manually.

           

          If it's so you have minimum two variants:

          1. listen collectionChange of your ArrayCollection and save selectedItem.item data. And in Series.updateComplete event handler find object in dataProvider and set selectedIndex to select the same object.

          2. Create your own collection like ArrayCollection based on Array and handle all changes yourself: create event before changes to save data you need, change dataProvider and restore after updating - idea is the same.

          • 2. Re: Question on Charts. please help.
            tcflex Level 1

            Thanks for the reply sand helpful tips.

             

            1) first problem: My ArrayCollection is not genrating a collection change event. Because I created the array collection by giving a source array. some where in the docs long time back ago I read, if you wrap up the array inside the array collection, then it is not caple of dispatching any events related to ICollection interface.

             

            2) Since the dataprovider is a bindable property i had implemented a changewatcher to it. It never comes to the handler function.

             

            thanks,

            tc.

             

             

            • 3. Re: Question on Charts. please help.
              _Natasha_ Level 4

              If you change data in your array by direction access to your source - no event will be dispatching. You should change data using IList or ICollectionView interfaces.

              If you know the moments then you change data you can manually dispatch events.