How to combine SeriesProvider with a LineSeries on a single plot...

2 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    4 posts
    Member since:
    Nov 2017

    Posted 07 Nov Link to this post

    I have several curves on a single plot which are populated with a SeriesProvider like as follows:

    <telerik:RadCartesianChart.SeriesProvider>
        <telerik:ChartSeriesProvider Source="{Binding DataToPlot.OperationConditions}">
             <telerik:ChartSeriesProvider.SeriesDescriptors>
                <telerik:CategoricalSeriesDescriptor ItemsSourcePath="DataPoints" ValuePath="Magnitude" CategoryPath="TimeLabel">
                    <telerik:CategoricalSeriesDescriptor.Style>
                        <Style TargetType="telerik:LineSeries" BasedOn="{StaticResource LineSeriesStyle}">
                                                    <Setter Property="LegendSettings">
                                                        <Setter.Value>
                                                            <telerik:SeriesLegendSettings Title="{Binding Name}"/>
                                                        </Setter.Value>
                            </Setter>
                        </Style>
                    </telerik:CategoricalSeriesDescriptor.Style>
                </telerik:CategoricalSeriesDescriptor>
            </telerik:ChartSeriesProvider.SeriesDescriptors>
        </telerik:ChartSeriesProvider>
    </telerik:RadCartesianChart.SeriesProvider>

     

    In addition, I have another set of data which I should populate on the same plot with the same X-axis values (date/time). However these data have another order of magnitude (another physical meaning), so the only way is to add additional Y-axis on the same plot. I have the following xaml-code:

    <telerik:LineSeries ItemsSource="{Binding Path=DataToPlot.VibrationConditions}"
                                                CategoryBinding="TimeLabel"
                                                ValueBinding="Magnitude">
                                <telerik:LineSeries.VerticalAxis>
                                    <telerik:LinearAxis HorizontalLocation="Left" ElementBrush="Green"/>
                                </telerik:LineSeries.VerticalAxis>
     </telerik:LineSeries>

     

    When these blocks of code are located one after other, the former (data which are populated with a SeriesProvider) is depicted on a plot as I expected, but the latter (data which are populated with LineSeries) is depicted as a vertical green line to the left of the first Y-Axis (see attachment).

    Is is possible to combine multiply Y-data (from various sources and distinct populating mechanism) on a single plot?

     

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1475 posts

    Posted 10 Nov Link to this post

    Hello Dmitry,

    The chart can be populated both with the Series collection and SeriesProvider, but this is not considered as supported scenario, because as you can see it might lead to issues. Actually, the green line next to the Y-axis is not the series, but only its axis. So, you have series, but without data. 

    To achieve your requirement I would recommend you to move the additional series in the SeriesProvider source with the other series. In your case this is the DataToPlot.OperationConditions collection.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top