align of Y axis between two charts

Hello,


as the title mentions, i have two charts in which the Y value can vary between from 1 digit to up to 5 digits. I would like to know if there is a way to align these axis like the pictures below:

-> what is happening

image (1).png


-> what i would like to see: 

image (2).png


3 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team April 8, 2022 03:23 AM UTC

Hi Wanft,

You can achieve your requirement “Align Y-Axis in different chart” with the help of LabelExtent property of ChartAxis. Please find the code example below.


CodeSnippet:

<ContentPage.Resources>

    <OnPlatform x:Key="labelExtent" x:TypeArguments="x:Double">

        <On Platform="Android">80</On>

        <On Platform="iOS">80</On>

        <On Platform="UWP">40</On>

    </OnPlatform>

</ContentPage.Resources>

<StackLayout>

    <chart:SfChart x:Name="chart">      

 

        <chart:SfChart.SecondaryAxis>

            <chart:NumericalAxis  Minimum="0"

                                  Maximum="9"

                                  LabelExtent="{StaticResource labelExtent}"/>

 

        </chart:SfChart.SecondaryAxis>

 

        . . .

 

    </chart:SfChart>

   

    <chart:SfChart x:Name="chart1"

                   HorizontalOptions="FillAndExpand"

                   VerticalOptions="FillAndExpand">

 

        <chart:SfChart.SecondaryAxis>

            <chart:NumericalAxis Minimum="0"

                                 Maximum="99999"

                                 LabelExtent="{StaticResource labelExtent}"/>

        </chart:SfChart.SecondaryAxis>

 

        . . .

    </chart:SfChart>

</StackLayout>


We have attached the sample for your reference. Please find the sample from the below attachment.


Output:


For more details, please refer the below link

https://help.syncfusion.com/xamarin/charts/axis#label-extent


Regards,

Yuvaraj.


Attachment: Sample_LabelExtent_9e6b6d72.zip

Marked as answer

WA Wanft April 8, 2022 12:30 PM UTC

TY, we'll try that!


att.



YP Yuvaraj Palanisamy Syncfusion Team April 11, 2022 06:06 AM UTC

Hi Wanft,

Thanks for your update.

Please let us know if you have further assistance.


Regards,

Yuvaraj.


Loader.
Up arrow icon