Opposed secondary axis scale not correct

I need a secondary axis on the right hand side, with the same settings (min, round style, etc.) as the first secondary axis.

I have added an opposed secondary axis with the same settings as the main secondary axis (apart from OpposedPosition and IsVertical).

However, the opposed secondary axis does not have the correct round or maximum setting. See screenshot.

Reproduction solution attached - only the iOS project is needed to demonstrate it.Screenshot 2021-09-26 at 16.02.41.png


Attachment: SecondaryAxisDemo_84b449e6.zip

3 Replies

DD Devakumar Dhanapoosanam Syncfusion Team September 27, 2021 09:47 AM UTC

Hi James Lavery, 
 
Greetings from Syncfusion. 
 
Query: I need a secondary axis on the right-hand side, with the same settings (min, round style, etc.) as the first secondary axis. 
 
We have analyzed your query and we would like to let you know that the additional axis added in the chart Axes collection which is not dependent with chart series. Hence, axis ranges are not updated similar like secondary axis. We have achieved your requirement using the Minimum and Maximum properties of chart axis to binding with the secondary axis VisibleMinimum and VisibleMaximum properties as in the below code example. 
 
XAML: 
 
<chart:SfChart.SecondaryAxis> 
    <chart:NumericalAxis x:Name="MainSecondaryAxis" 
        Minimum="0" 
        RangePadding="Round" /> 
</chart:SfChart.SecondaryAxis> 
 
<chart:SfChart.Axes> 
    <chart:NumericalAxis 
        Name="OpposedSecondaryAxis" 
        OpposedPosition="True" 
        IsVertical="True" 
        Minimum="{Binding Source={x:Reference MainSecondaryAxis}, Path=VisibleMinimum}"  
        Maximum="{Binding Source={x:Reference MainSecondaryAxis}, Path=VisibleMaximum}" 
        RangePadding="Round" /> 
</chart:SfChart.Axes> 
 
 
Please find the modified sample from the below link  
 
 
Output: 
 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Devakumar D 



JL James Lavery September 27, 2021 08:58 PM UTC

Thank you - I can see the logic being used in the solution.

The sample works on Android, but on an iOS Simulator (an iPhone 11 running iOS 14) the app does not start up fully. It gets to the splash screen and hangs.

I cannot see any errors in the application output or console.

Can you confirm that you have run the sample on an iOS simulator?

Regards,

James



DD Devakumar Dhanapoosanam Syncfusion Team September 28, 2021 11:44 AM UTC

Hi James Lavery,

Sorry for the inconvenience caused in iOS platform. 
 
We have achieved your requirement using the secondary axis ActualRangeChanged event args ActualMinimum and ActualMaximum properties value for the duplicate axis Minimum and Maximum property as in the below code example. 
 
<chart:SfChart.SecondaryAxis> 
    <chart:NumericalAxis x:Name="MainSecondaryAxis" 
         Minimum="0" 
         RangePadding="Round"  
         ActualRangeChanged="MainSecondaryAxis_ActualRangeChanged"/> 
</chart:SfChart.SecondaryAxis> 
 
<chart:SfChart.Axes> 
    <chart:NumericalAxis x:Name="OpposedSecondaryAxis" 
        OpposedPosition="True" 
        IsVertical="True" 
        RangePadding="Round" /> 
</chart:SfChart.Axes> 
 
private void MainSecondaryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
{ 
    OpposedSecondaryAxis.Minimum = (double)e.ActualMinimum; 
    OpposedSecondaryAxis.Maximum = (double)e.ActualMaximum; 
} 
 
 
Output:  
 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Devakumar D 


Loader.
Up arrow icon