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
close icon

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

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?

1 Reply

MK Muneesh Kumar G Syncfusion Team 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:NumericalAxis ActualRangeChanged="NumericalAxis_ActualRangeChanged"/> 
            <syncfusion:FastColumnBitmapSeries x:Name="series1" 
                                               ItemsSource="{Binding Data}" 
private void NumericalAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
            if ((double)e.ActualMaximum < 10000) 
                e.ActualMaximum = 10000; 
                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.  
Muneesh Kumar G. 

Live Chat Icon For mobile
Up arrow icon