We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Collection visibility is not updated properly

Hello,

I am trying to control the visibility of a collection of data points dynamically, and the chart doesn't update properly unless something else gets done (e.g. transposing the axes). Could you provide me with a solution or even a temporary work-around?

Regards,
Jeremie

1 Reply

DA Devi Aruna Maharasi Murugan Syncfusion Team July 8, 2016 05:23 PM UTC

Hi Jeremie, 
  
Thanks for contacting Syncfusion Support 
  
Query: I am trying to control the visibility of a collection of data points dynamically 
  
We have analyzed your requirement. We can able to control the visibility of data points using CustomTemplate for the series, by binding visibility property from your underlying model as in below code snippet.  
  
Code example 
[XAML] 
 
   <chart:ScatterSeries  ScatterHeight="30" ScatterWidth="30"  
                         XBindingPath="Year" YBindingPath="Count" x:Name="Scatter" 
                         ItemsSource="{Binding }"> 
       <chart:ScatterSeries.CustomTemplate> 
            <DataTemplate > 
                <Canvas> 
                   <Ellipse Fill="Purple" Stretch="Fill"   
                            Visibility="{Binding Path=Item.CanVisible}" 
                            Height="{Binding ScatterHeight}"  
                            Width="{Binding ScatterWidth}"  
                            Canvas.Left="{Binding RectX}" Canvas.Top="{Binding RectY}"> 
                   </Ellipse> 
                </Canvas> 
            </DataTemplate> 
       </chart:ScatterSeries.CustomTemplate>            
   </chart:ScatterSeries> 
 
 
  
We have prepared a demo sample based on your requirement and it can be downloaded from below link, 
  
Sample: Visibility 
  
Please refer our UG documentation link to know more about series customization using the CustomTemplate property present in the series 
  
  
Query: the chart doesn't update properly unless something else gets done (e.g. transposing the axes). 
  
We can able to update the chart properly by using ListenPropertyChange property of chart series, when dynamically changing the data objects present in your underlying model. We need to enable the ListenPropertyChange property of the series, to make the chart listen to the property changes of your data object. The default value of ListenPropertyChange property is false. Please refer our UG documentation link to know more about ListenPropertyChange property, 
  
  
Regards, 
Devi 


Loader.
Up arrow icon