This is a migrated thread and some comments may be shown as answers.

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

1 Answer 258 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 07 Nov 2017, 01:04 PM

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?

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 10 Nov 2017, 11:39 AM
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.
Tags
ChartView
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or