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

Multiple axis for multiple series

Thread ID:

Created:

Updated:

Platform:

Replies:

127661 Nov 30,2016 06:20 PM UTC Dec 2,2016 11:51 AM UTC UWP 4
loading
Tags: SfChart
Luca Spolidoro
Asked On November 30, 2016 06:20 PM UTC

Hello, I have a chart with 4 line series.
I would like 2 series to use the default Y Axis, and the other 2 to use a custom Y Axis positioned at the right side of the chart.

This is my current code, but it will create a third Y axis (that I don't want):
<sfChart:SfChart>
    <!--  Horizontal axis for SfChart (Dates)  -->
    <sfChart:SfChart.PrimaryAxis>
        <sfChart:DateTimeAxis FontSize="14" LabelFormat="{x:Bind model:Salary.GraphDateFormat, Mode=OneTime}" />
    </sfChart:SfChart.PrimaryAxis>
 
    <!--  Vertical axis for SfChart (Cumulative Money)  -->
    <sfChart:SfChart.SecondaryAxis>
        <sfChart:NumericalAxis FontSize="14" LabelFormat="C0" />
    </sfChart:SfChart.SecondaryAxis>
 
    <sfChart:SfChart.Legend>
        <sfChart:ChartLegend Visibility="Visible" />
    </sfChart:SfChart.Legend>
 
    <!--  Series for SfChart  -->
    <sfChart:LineSeries ItemsSource="{Binding LucaSerie}"
                        Label="Luca"
                        XBindingPath="Key.Date"
                        YBindingPath="Value" />
    <sfChart:LineSeries ItemsSource="{Binding KatyaSerie}"
                        Label="Katya"
                        XBindingPath="Key.Date"
                        YBindingPath="Value" />
    <sfChart:LineSeries ItemsSource="{Binding LucaCumulativeSerie}"
                        Label="Luca (Cumulative)"
                        XBindingPath="Key.Date"
                        YBindingPath="Value">
        <sfChart:LineSeries.YAxis>
            <sfChart:NumericalAxis FontSize="14"
                                   Header="Cumulative"
                                   LabelFormat="C0"
                                   OpposedPosition="True" />
        </sfChart:LineSeries.YAxis>
    </sfChart:LineSeries>
    <sfChart:LineSeries ItemsSource="{Binding KatyaCumulativeSerie}"
                        Label="Katya (Cumulative)"
                        XBindingPath="Key.Date"
                        YBindingPath="Value">
        <sfChart:LineSeries.YAxis>
            <sfChart:NumericalAxis FontSize="14"
                                   Header="Cumulative"
                                   LabelFormat="C0"
                                   OpposedPosition="True" />
        </sfChart:LineSeries.YAxis>
 
    </sfChart:LineSeries>
</sfChart:SfChart>

This is the result (as you can see there are 3 Y axes, I would like just 2):

thanks for the help!

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On December 1, 2016 10:13 AM UTC

Hi Luca, 
  
Thanks for contacting Syncfusion Support. 
  
We are able to achieve your requirement (using single axis for multiple series) by sharing same YAxis to multiple series as shown in the below code snippet, 
 
      <chart:LineSeries.YAxis> 
          <chart:NumericalAxis Name="yaxis"  /> 
      </chart:LineSeries.YAxis> 
         
      </chart:LineSeries> 
             
        <chart:LineSeries YAxis="{Binding ElementName=yaxis}"/> 
  
We have prepared a demos sample based on this requirement and it can be downloaded from below link, 
  
Sample: LineSeriesUWP 
  
Regards, 
Devi 





Luca Spolidoro
Replied On December 1, 2016 08:07 PM UTC

Thanks a lot, I solved the problem!
At first I tried at first by adding the Y Axis as resource, but I got an error that the Axis couldn't be added to 2 series.
With binding everything works!

Luca Spolidoro
Replied On December 1, 2016 09:30 PM UTC

PS: I think it would be very useful if you add this scenario in the axis documentation:
https://help.syncfusion.com/uwp/sfchart/axis

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On December 2, 2016 11:51 AM UTC

Hi Luca, 
  
Thanks for your update. 
  
We will include this scenario in our UG documentation and please let us know if you need any further assistance. 
  
Regards, 
Devi 


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.

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

;