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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Two questions on the secondary axis of SfChart

Thread ID:

Created:

Updated:

Platform:

Replies:

140850 Nov 11,2018 09:43 AM UTC Nov 14,2018 09:57 AM UTC WPF 3
loading
Tags: SfChart
Sascha
Asked On November 11, 2018 09:43 AM UTC

Hello Syncfusion Support! 

We have two questions on the secondary axis. As a precondition, we set the y-axis on a minimum of 0. The maximum is "open" because we don't want to cap it.

Question 1:
When we have on our charts only data points with an x value of 0, the secondary axis (y) will show 0, 1, 1. This is very confusing!

Question 2:
When in our data are some outliers of y-values, the y-axis will automatically scale. Ok, that is a great feature, of course. But we are using the zooming capability to show specific ranges of time. The y-axis will be still orientated on the outliers although they are not visible. Therefore we have no chance to show normal data for this selected range of time. This is confusing, too! Maybe there is a switch for this behavior?

We are grateful for any suggestions!

Regards, 
Sascha


Muneesh Kumar G [Syncfusion]
Replied On November 12, 2018 10:34 AM UTC

Hi Sascha, 
 
Greetings from Syncfusion, we have analyzed your requirements. Please find the response below.  
 
Query 1: When we have on our charts only data points with an x value of 0, the secondary axis (y) will show 0, 1, 1. This is very confusing! 
 
We have checked the mentioned data with ColumnSeries, ScatterSeries. Y-Axis have not shown the mentioned confusing labels. Please find the output screenshot below.  
 
 
 
Code snippet 
  public void GenerateData() 
        { 
            Data = new ObservableCollection<Model>(); 
            Random rd = new Random(); 
            for (int i = 0; i < 6; i++) 
            { 
                Data.Add(new Model() 
                { 
                    XValue = 0, 
                    YValue = rd.Next(0, 50) 
                }); 
            } 
        } 
 
 
Query 2: When in our data are some outliers of y-values, the y-axis will automatically scale. Ok, that is a great feature, of course. But we are using the zooming capability to show specific ranges of time. The y-axis will be still orientated on the outliers although they are not visible. Therefore we have no chance to show normal data for this selected range of time. This is confusing, too! Maybe there is a switch for this behavior? 
 
We are unable to get your exact requirement from this. We suspect that the query related to SelectionZooming rect range not zoomed in accurate. We have checked the selection zooming with our sample, it works fine with zooming.   
 
Can you please check with the sample in the following location? If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to give better solution in this. 
 
 
Regards, 
Muneesh Kumar G. 
 


Sascha
Replied On November 14, 2018 05:47 AM UTC

Hello Syncfusion Support!

Thank you for your quick answer!

I don't think I've described our challenges accurately enough. So here are some screenshots to demonstrate the problems. 

For question 1:



There are only 0 Values on the x-axis and the y-axis shows the value 1 twice. Min is set to 0. We don't want to set max.

Question 2:



Here a sfChart where we can see an outlier, so the y-axe is at 42000. 

If we zoom or pan further, the y-axe stays at 50000, even if it wouldn't be necessary now. 


The other values are no longer recognizable. We don't want manually zoom on the y-axis. 

Thank you very much!

Regards,
Sascha



Muneesh Kumar G [Syncfusion]
Replied On November 14, 2018 09:57 AM UTC

Hi Sascha, 
 
Thanks for your update, please find the response below.  
 
Query 1: There are only 0 Values on the x-axis and the y-axis shows the value 1 twice. Min is set to 0. We don't want to set max. 
 
We have checked this scenario with our sample, it works fine with secondary axis labels. We suspect that you have formatted the axis label using LabelFormat or LabelCreated event. Please update us the code snippet regarding SfChart (XAML, C#) or replicate the scenario in the below attached sample. That would be helpful for us to give better solution in this.  
 
Screenshot:  
 
 
 
Query 2: Here a sfChart where we can see an outlier, so the y-axe is at 42000. If we zoom or pan further, the y-axe stays at 50000, even if it wouldn't be necessary now.  
 
We would like to inform you that currently we don’t have direct support to y axis range auto update based on visible data. So, we have achieved this by extending NumericalAxis and overriding CalculateVisibleRange then setting custom VisibleRange as per the below code snippet.  
 
Code snippet 
public class NumericalAxisExt : NumericalAxis 
    { 
        List<double> yValues = new List<double>(); 
 
        protected override void CalculateVisibleRange(Size avalableSize) 
        { 
            base.CalculateVisibleRange(avalableSize); 
 
            .. 
 
            if (actualyValues != null && actualyValues.Count > (int)range.Start && actualyValues.Count > (int)range.End) 
            { 
                for (int i = (int)range.Start; i <= range.End; i++) 
                { 
                    yValues.Add(actualyValues[i]); 
                } 
 
                if (yValues.Count > 0) 
                { 
                    double min = yValues.Min(); 
                    double max = yValues.Max(); 
 
                    VisibleRange = new DoubleRange(min, max); 
                } 
            } 
            
           var visibleInterval = CalculateNiceInterval(VisibleRange, avalableSize); 
 
           typeof(ChartAxis).GetProperty("VisibleInterval", System.Reflection.BindingFlags.NonPublic | 
                System.Reflection.BindingFlags.Instance).SetValue(this, visibleInterval); 
        } 
    } 
 
We have modified our sample based on this, please find the sample from the following location.  
 
 
Please let us know if you have any queries.  
 
Regards, 
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

or the page will be automatically redirected to 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

;