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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to constrain axis range but still allow it to change dynamically based on data?

Thread ID:

Created:

Updated:

Platform:

Replies:

146584 Aug 9,2019 05:04 AM UTC Aug 12,2019 09:57 AM UTC UWP 1
loading
Tags: SfChart
Ben
Asked On August 9, 2019 05:04 AM UTC

For example, when plotting live data, I want my y-axis to always be between 0 and 10000, unless data goes above 10000. Then I want it to adjust in intervals of 1000. As data disappears from the live series, if all points all go below 10000, I want the maximum to reset to 10000. Is this possible?

Muneesh Kumar G [Syncfusion]
Replied On August 12, 2019 09:57 AM UTC

Hi Ben, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and you can achieve this by raising ActualRangeChanged event in secondaryaxis and update the e.ActualMaximum value based on your condition as per the below code snippet.  
 
Code snippet 
 
<syncfusion:SfChart x:Name="Chart" Margin="20" > 
 
            <syncfusion:SfChart.SecondaryAxis> 
                <syncfusion:NumericalAxis ActualRangeChanged="NumericalAxis_ActualRangeChanged"/> 
            </syncfusion:SfChart.SecondaryAxis> 
             
            <syncfusion:FastColumnBitmapSeries x:Name="series1" 
                                               ItemsSource="{Binding Data}" 
                                                   XBindingPath="XValue" 
                                               YBindingPath="YValue"/> 
        </syncfusion:SfChart> 
 
 
 
 
private void NumericalAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            if ((double)e.ActualMaximum < 10000) 
                e.ActualMaximum = 10000; 
            else 
                e.ActualMaximum = 11000; 
        } 
 
 
 
We have prepared a sample based on this, please find the sample from the following location.  
 
 
Please let us know if you have any other queries.  
 
Thanks, 
Muneesh Kumar G. 
 
 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon