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

Remove Duplicate Axis

Hello,

I am trying to use the below example of SeriesDataTemplateSelector and place the different series types on separate chart rows.

How to generate dynamic number of series based on common items source in WPF Chart (SfChart)? | Syncfusion KB

I want the Y axis for both to be numerical axis' but I need to bind different data to them. When I attempt the below, I end up with an axis for every chart series. Any help to remove the multiple axes would be

 appreciated.





Attachment: WpfApp1_fcbf573f.zip

3 Replies

NM Nanthini Mahalingam Syncfusion Team March 16, 2023 01:51 PM UTC

Hi Chris Hilger,


We have analyzed your query and would like to inform you that we can remove duplicate axes by setting the numerical axis on resource content. Additionally, we can use the axis key to correspond with the series as shown in the code snippet.

[Xaml]

<Grid.Resources>

            <chart:NumericalAxis FontSize="14" PlotOffsetStart="20" x:Key="numericalAxis">

                <chart:NumericalAxis.Header>

                    <TextBlock Text="Price in US dollars" FontSize="12"/>

                </chart:NumericalAxis.Header>

            </chart:NumericalAxis>

            <DataTemplate x:Key="columnSeriesTemplate">

                <chart:ColumnSeries XBindingPath="Component" YAxis="{StaticResource numericalAxis}"

                                    YBindingPath="Price" ItemsSource="{Binding PriceCollection}"

                                    Label="{Binding Year}">

                </chart:ColumnSeries>

            </DataTemplate>

 

            <DataTemplate x:Key="lineSeriesTemplate" >

                <chart:LineSeries XBindingPath="Component" YAxis="{StaticResource numericalAxis}"

                                  YBindingPath="Price" ItemsSource="{Binding PriceCollection}"

                                  Label="{Binding Year}">

                </chart:LineSeries>

            </DataTemplate>

 

        </Grid.Resources>

 


Output

Graphical user interface, application

Description automatically generated with medium confidence



Please let us know if you need further assistance.


Regards,

Nanthini Mahalingam.


Attachment: F181172_348571e.zip


CH Chris Hilger March 16, 2023 06:30 PM UTC

This seems to fix my issue. 

Thank you



PR Preethi Rajakandham Syncfusion Team March 17, 2023 08:48 AM UTC

Hi Chris,

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help.

Regards,

Preethi R


Loader.
Up arrow icon