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

Not able to bind values to Chart Series Label.

1 Answer 74 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Rakesh
Top achievements
Rank 1
Rakesh asked on 09 Apr 2013, 04:10 PM

Hi Telerik,
I am tryint create PieChart. I could able to generate the chart,but have difficulty in customizing label.
Please go throught the attached code.
I don't want default % values to display as a label's. if you locate DataItem.MainCode,that is where i am trying to change lable data. I get empty label's on chart.

<telerik:PieSeries x:Name="PieSeries1" ShowLabels="True"    RadiusFactor="0.7" AllowSelect="True" SelectedPointOffset="0.2" 
                       IsSelected="True"  ItemsSource="{Binding PendingCertificationSatusInfosColl}" IsHitTestVisible="True"
                       ValueBinding="PendingCount"  >         
    <telerik:PieSeries.LabelDefinitions
        <!--<telerik:ChartSeriesLabelDefinition Margin="-5,0,0,0" DefaultVisualStyle="{StaticResource LabelStyle}" />-->
        <telerik:ChartSeriesLabelDefinition Margin="-15,0,0,0" DefaultVisualStyle="{StaticResource LabelStyle}" 
                                                
            <telerik:ChartSeriesLabelDefinition.Template
                <DataTemplate
                    <StackPanel
                        <TextBlock Text="{Binding DataItem.MainCode}" 
                                       HorizontalAlignment="Center"
                                       Foreground="White" /> 
                        <TextBlock Text="{Binding DataItem.PendingCount}" 
                                       HorizontalAlignment="Center"
                                       Foreground="White"  /> 
                    </StackPanel
                </DataTemplate
            </telerik:ChartSeriesLabelDefinition.Template
        </telerik:ChartSeriesLabelDefinition
    </telerik:PieSeries.LabelDefinitions
    <telerik:PieSeries.AngleRange
        <telerik:AngleRange StartAngle="270"
                                    SweepAngle="360" /> 
    </telerik:PieSeries.AngleRange
    <telerik:PieSeries.Effect
        <DropShadowEffect BlurRadius="5" ShadowDepth="0"  Direction="315" Color="White"/> 
    </telerik:PieSeries.Effect
</telerik:PieSeries>


Thanks
Rakesh

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 12 Apr 2013, 08:49 AM
Hi Rakesh,

I created a small project based on your code snippet. I altered just a few things in order to compile and run the project. Everything seems ok, I see a properly displayed pie chart with labels. Check the attached image and project for a reference. Is it possible that the Background of your project is White? Both of the TextBlocks have White foreground, so this might be the reason you do not see the labels even though they are there. Let us know how it goes.

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or