Data not binding when UseDefaultLayout = false

2 posts, 0 answers
  1. Sowjanya
    Sowjanya avatar
    8 posts
    Member since:
    May 2013

    Posted 24 Jul 2013 Link to this post

    <telerikChart:RadChart Grid.Row="2" x:Name="HouseConsumptionChart" Background="Transparent" BorderThickness="0" Height="362" Width="850" UseDefaultLayout="False" VerticalAlignment="Center"
                                        LayoutUpdated="HouseConsumptionChart_LayoutUpdated">
                    <telerikChart:RadChart.SeriesMappings >
                        <telerikCharting:SeriesMapping ItemsSource="{Binding HouseConsumptionData}" >
                            <telerikCharting:SeriesMapping.SeriesDefinition>
                                <telerikCharting:LineSeriesDefinition EmptyPointBehavior="Gap" PointMarkItemStyle="{Binding PointMarkStyle}" LegendDisplayMode="None" ShowItemLabels="False" ShowItemToolTips="True">
                                    <telerikCharting:LineSeriesDefinition.Appearance>
                                        <telerikCharting:SeriesAppearanceSettings Stroke="#1e6a88" />
                                    </telerikCharting:LineSeriesDefinition.Appearance>
                                </telerikCharting:LineSeriesDefinition>
                            </telerikCharting:SeriesMapping.SeriesDefinition>
                            <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Consumption"/>
                            <telerikCharting:ItemMapping DataPointMember="XValue" FieldName="TimeStamp" />
                        </telerikCharting:SeriesMapping>
      
                        <telerikCharting:SeriesMapping ItemsSource="{Binding EmptyPointsHouseConsumptionData}" >
                            <telerikCharting:SeriesMapping.SeriesDefinition>
                                <telerikCharting:LineSeriesDefinition LegendDisplayMode="None" ShowItemLabels="False" ShowPointMarks="False" ShowItemToolTips="False">
                                    <telerik:LineSeriesDefinition.SeriesStyle>
                                        <Style TargetType="telerik:LineSeries">
                                            <Setter Property="BorderLineStyle">
                                                <Setter.Value>
                                                    <Style TargetType="Shape">
                                                        <!--Set the stroke to be the same as the previous series-->
                                                        <Setter Property="Stroke" Value="Red"/>
                                                        <Setter Property="StrokeThickness" Value="2"/>
                                                        <Setter Property="StrokeDashArray" Value="2"/>
                                                    </Style>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </telerik:LineSeriesDefinition.SeriesStyle>
                                </telerikCharting:LineSeriesDefinition>
                            </telerikCharting:SeriesMapping.SeriesDefinition>
                            <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Consumption"/>
                            <telerikCharting:ItemMapping DataPointMember="XValue" FieldName="TimeStamp" />
                        </telerikCharting:SeriesMapping>
      
                        <telerikCharting:SeriesMapping ItemsSource="{Binding HouseConsumptionData}" >
                            <telerikCharting:SeriesMapping.SeriesDefinition>
                                <telerikCharting:LineSeriesDefinition AxisName="EuroGraph" LegendDisplayMode="None" ShowItemLabels="False" ShowItemToolTips="True" >
                                    <telerikCharting:LineSeriesDefinition.Appearance>
                                        <telerikCharting:SeriesAppearanceSettings Stroke="#919191" />
                                    </telerikCharting:LineSeriesDefinition.Appearance>
                                </telerikCharting:LineSeriesDefinition>
                            </telerikCharting:SeriesMapping.SeriesDefinition>
                            <telerikCharting:ItemMapping DataPointMember="YValue" FieldName="Cost" />
                            <telerikCharting:ItemMapping DataPointMember="XValue" FieldName="TimeStamp" />
                        </telerikCharting:SeriesMapping>
                    </telerikChart:RadChart.SeriesMappings>
      
                    <telerikChart:RadChart.DefaultView>
                        <telerikCharting:ChartDefaultView>
                            <telerikCharting:ChartDefaultView.ChartArea>
                                <telerikCharting:ChartArea EnableAnimations="False" NoDataControlStyle="{StaticResource NoDataControlStyle}" ItemToolTipOpening="ChartArea_ItemToolTipOpening">
                                    <telerikCharting:ChartArea.Annotations>
                                        <telerikCharting:CustomGridLine Style="{StaticResource CustomGridLineStyle}" Stroke="Red" StrokeThickness="2" YIntercept="{Binding ConsumptionLimit}"/>
                                    </telerikCharting:ChartArea.Annotations>
                                    <telerikCharting:ChartArea.AxisX>
                                        <telerikCharting:AxisX MinorGridLinesVisibility="Visible" MajorGridLinesVisibility="Visible" MajorTicksVisibility="Collapsed" />
                                    </telerikCharting:ChartArea.AxisX>
                                    <telerikCharting:ChartArea.AxisY>
                                        <telerikCharting:AxisY MajorTicksVisibility="Collapsed"  MinorGridLinesVisibility="Visible" StripLinesVisibility="Collapsed" MajorGridLinesVisibility="Visible" MinorTicksVisibility="Collapsed" AutoRange="False" MinValue="{Binding Path=ConsumptionMinValue}" MaxValue="{Binding Path=ConsumptionMaxValue}"  Step="{Binding Path=ConsumptionGraphYAxisStep}">
                                            <!--<telerikCharting:AxisY.AxisStyles>
                                                <telerikCharting:AxisStyles AxisLineStyle="{StaticResource AxisYLineStyle}" />
                                            </telerikCharting:AxisY.AxisStyles>-->
                                        </telerikCharting:AxisY>
                                    </telerikCharting:ChartArea.AxisY>
                                    <telerikCharting:ChartArea.AdditionalYAxes>
                                        <telerikCharting:AxisY AxisName="EuroGraph" >
                                            <!--<telerikCharting:AxisY.AxisStyles>
                                                <telerikCharting:AxisStyles AxisLineStyle="{StaticResource AxisYLineStyle}" />
                                            </telerikCharting:AxisY.AxisStyles>-->
                                        </telerikCharting:AxisY>
                                    </telerikCharting:ChartArea.AdditionalYAxes>
                                </telerikCharting:ChartArea>
                            </telerikCharting:ChartDefaultView.ChartArea>
                            <telerikCharting:ChartDefaultView.ChartLegend>
                                <telerikCharting:ChartLegend Visibility="Collapsed"/>
                            </telerikCharting:ChartDefaultView.ChartLegend>
                        </telerikCharting:ChartDefaultView>
                    </telerikChart:RadChart.DefaultView>
                </telerikChart:RadChart>
    Hi,
    We are using Rad Controls for Silverlight 2013 Q1 licensed version, when I set UseDefaultLayout = False, the data is not binding. I have Itemsource for each series mappings. Please help me find a solution.
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 26 Jul 2013 Link to this post

    Hi Sowjanya,

    When you set UseDefaultLayout to false you tell the control that RadChart.DefaultView will not be used and that you will be defining you own layout consisting of one or more named ChartAreas. When UseDefaultLayout is set to false, the SeriesMappings expect that they will be associated with a particular ChartArea using their ChartAreaName property. 

    Basically you need to either leave UseDefaultLayout to true, or replace RadChart.DefaultView with the following:
    <Grid>
         <telerikCharting:ChartArea Name="chartArea">
         <!--your ChartArea definition-->
         </telerikCharting:ChartArea>
    </Grid>
    and set the ChartAreaName of all of your SeriesMapping to "chartArea".

    For more information, please check the following help topics:
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top