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

Avoid scrolling to top when updating SfChart which has a legend

Hello,

The problem is that we've got a long page with a vertical scrollbar which contains a Pie Chart with a legend, and at the bottom a simple button which adds a new item to the items source of the chart.
Once we update the items source of the chart, it updates the chart correctly and seems to automatically set the focus to the legend and scroll us to the top of the page, our question is if we could avoid this scroll behaviour and just keep the scroll where we are.

I've attached a sample with the problem.
What is also strange is that if we don't have the legend it doesn't jump to the top, but we need to have that legend.

Have a nice day,
Alexandru.

Attachment: AvoidScrollSample_461e9f09.zip

3 Replies

DA Devi Aruna Maharasi Murugan Syncfusion Team March 10, 2017 09:23 AM UTC

Hi Alexandru, 
  
Thanks for contacting Syncfusion Support. 
  
The reported problem is occurred due to ItemWrapGrid used in the ItemsPanelTemplete of legend.  We can avoid this problem by using WrapGrid in the ItemsPanelTemplate instead of ItemWrapGrid as shown in the below code snippet, 

 
<syncfusionChart:SfChart.Legend> 
       <syncfusionChart:ChartLegend > 
            <syncfusionChart:ChartLegend.ItemsPanel> 
                         <ItemsPanelTemplate> 
                                <WrapGrid Orientation="Horizontal" 
                                          MaximumRowsOrColumns="2" 
                                          ItemWidth="150" /> 
                         </ItemsPanelTemplate> 
            </syncfusionChart:ChartLegend.ItemsPanel>             
       </syncfusionChart:ChartLegend> 
</syncfusionChart:SfChart.Legend> 
  
We have prepared a sample with reference of attached sample and it can be downloaded from below link, 
  
Sample: PieScrolling 
  
Regards, 
Devi 






AP Alexandru Pastor Opris March 10, 2017 09:35 AM UTC

Hello Devi,

Thank you so much, that indeed worked perfectly.

Have a nice day,
Alexandru.


DA Devi Aruna Maharasi Murugan Syncfusion Team March 13, 2017 03:42 AM UTC

Hi Alexandru, 
  
Thanks for your update. 
  
Please let us know, if you need any further assistance on this. 
  
Regards, 
Devi 


Loader.
Up arrow icon