RadChartView Inside TabControl Content Template

3 posts, 0 answers
  1. Brad
    Brad avatar
    4 posts
    Member since:
    Mar 2016

    Posted 26 Oct Link to this post

    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. Brad
    Brad avatar
    4 posts
    Member since:
    Mar 2016

    Posted 27 Oct in reply to Brad Link to this post

    Solved.
  3. Rob
    Rob avatar
    8 posts
    Member since:
    Sep 2015

    Posted 09 Nov Link to this post

    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).

Back to Top