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.
Unfortunately, activation email could not send to your email. Please try again.

Showing the first few bars in sfchart and enable scrolling to see the rest

Thread ID:

Created:

Updated:

Platform:

Replies:

130989 Jun 14,2017 08:03 PM Jun 19,2017 01:46 AM Xamarin.Forms 3
loading
Tags: SfChart
Naveen C Ramachandrappa
Asked On June 14, 2017 08:03 PM

Hi,

I referred the below link.

https://www.syncfusion.com/kb/7721/how-to-display-fixed-number-of-data-points-in-sfchart

But with this it always shows the last set of bars . However, I want to show the first few bars based on the number specified and enable scrolling to see the bars on the right.

Is it possible?

Saravana Pandian Murugan [Syncfusion]
Replied On June 15, 2017 07:28 AM

Hi Naveen, 
  
Thanks for using Syncfusion products. 
  
You can achieve this requirement by using ZoomFactor/ZoomPosition of ChartAxis. Please find the code snippet below. 
  
Code Example: 
  
  
chart.PrimaryAxis = new CategoryAxis() 
            { 
  
                ZoomFactor = 0.5, 
  
                ZoomPosition = 0       
      
            }; 
  
  
  
ZoomFactor defines the percentage of visible range from the total range of axis. For instance, when the Range is from 0 to 100 and ZoomFactor is 0.5, the visible range will be 0 to 50 or 50 to 100 (the start of the range will be determined by ZoomPosition).  
  
ZoomPosition: 
  
ZoomPosition defines the start of the range of values that need to be displayed as a result of ZoomFactor. For the above scenario, when the ZoomPosition is 0.25 then the visible range will be from 25 to 75. 
  
Note: The sum of ZoomFactor and ZoomPosition must also fall within the value of 0 to 1. 
  
We have attached a sample for your reference which can be downloaded from the below location. 
  
  
Please check the sample and let us know if you need further assistance on this. 
  
Regards, 
Saravana Pandian M. 


Naveen C Ramachandrappa
Replied On June 16, 2017 04:46 PM

Hi,

Thanks for the info. I have an additional question.

Let say I have 8 bars and I show only 4 bars when the chart comes up using the zoom factor and zoom position.

If I try zooming out completely, I will end up seeing all the 8 bars but I want to restrict user to see only 4 bars at the max when he tries to zoom out and to see the rest he has to scroll. At no point in time, I want him to see more than 4 bars. So, I want to lock user on zoom out . Is there a way to achieve this?

Parthiban Sundaram [Syncfusion]
Replied On June 19, 2017 01:46 AM

  
  
Thanks for the update. 
  
Please find the below code snippet to lock the Zooming.  
  
Code Snippet: 
  
            
 chart.ChartBehaviors.Add(newChartZoomPanBehavior() 
            { 
                EnableDoubleTap = false, 
                EnableZooming = false 
            }); 
  
 
  
Also, we have modified the sample based on your requirement. Please download from following location. 
  
   
Please let us know, if you need further assistance on this.  
  
Regards,
Parthiban S
  
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;