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

RadChartView Inside TabControl Content Template

2 Answers 57 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 26 Oct 2017, 12:59 PM

I am building an application that will have an unknown number of tabs. Inside each tab is a chart with two data sets. I can get the dynamically created tabs working. I can also get the chart working outside of the tab control, but when I combine them, the chart area just says No Data points. It should be noted that I am following the MVVM pattern, so there is no code behind for the view. Everything is done with databinding in the xaml. The data to which I am binding is an observable collection with an observable collection inside it. Here is the view xaml.

<Grid>
        <TabControl ItemsSource="{Binding TotalGradeProfile}">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </TabControl.ItemTemplate>
 
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <telerik:RadCartesianChart x:Name="chart"
                                               Palette="Summer">
 
                        <telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:LinearAxis/>
                        </telerik:RadCartesianChart.HorizontalAxis>
 
                        <telerik:RadCartesianChart.VerticalAxis>
                            <telerik:LinearAxis HorizontalAlignment="Right"></telerik:LinearAxis>
                        </telerik:RadCartesianChart.VerticalAxis>
 
                        <telerik:RadCartesianChart.SeriesProvider>
                            <telerik:ChartSeriesProvider Source="{Binding GradeProfiles}">
                                <telerik:ChartSeriesProvider.SeriesDescriptors>
                                    <telerik:ScatterSeriesDescriptor XValuePath="Mp"
                                                                     YValuePath="RegionGrade">
                                        <telerik:ScatterSeriesDescriptor.Style>
                                            <Style TargetType="telerik:ScatterLineSeries">
                                                <Setter Property="StrokeThickness" Value="2"/>
                                            </Style>
 
                                        </telerik:ScatterSeriesDescriptor.Style>
                                    </telerik:ScatterSeriesDescriptor>
                                </telerik:ChartSeriesProvider.SeriesDescriptors>
                            </telerik:ChartSeriesProvider>
                        </telerik:RadCartesianChart.SeriesProvider>
                    </telerik:RadCartesianChart>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </Grid>

 

2 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 27 Oct 2017, 06:32 PM
Solved.
0
Rob
Top achievements
Rank 1
answered on 09 Nov 2017, 04:20 PM

Brad,

 

Can you provide some more detail about how you solved the problem?

I'm having a similar scenario where I have a TabControl with a ContentTemplate that contains a RadCartesianChart bound to a collection of custom data objects. The Category axis is populating with data, but the Value axis won't (the bindings should be correct).

Tags
Chart
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or