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

[Solved] Piechart Series Label in ToolTip

3 Answers 272 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alfred
Top achievements
Rank 1
Alfred asked on 19 Mar 2013, 08:53 PM
How do you display the series label in the pie chat tool tip?  When I chose DataPoint.Label I get the pie wedge percentage instead of the label.  DataPoint.Value returns the pie wedge value as I would expect.  Below is my example:

<StackPanel Background="White">

<TextBlock Text="{Binding DataPoint.Label}" Margin="4,4,3,3" Foreground="#99441D"/>

<TextBlock Text="{Binding DataPoint.Value, Converter={StaticResource LabelConverter}}" Margin="4,4,3,3" Foreground="#506005"/>

</StackPanel>



Thanks,
Al

3 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 22 Mar 2013, 02:09 PM
Hello Alfred,

Thank you for using our RadControls for Windows 8.

If I understand you correctly when you bind to DataPoint.Label what you expect is to get the value of the DataPoint. By default the label of each DataPoint in PieChart is represented as a percent of the whole sum of values. You can define the desired labels' content in the series through the PieSeries.LabelDefinitions property. More information is available in our online documentation - http://www.telerik.com/help/windows-8-xaml/radchart-labels-chartserieslabeldefinition.html.

I hope this information is useful. Let me know if you need further assistance.

 

Regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Alfred
Top achievements
Rank 1
answered on 22 Mar 2013, 04:15 PM
If I understand you correctly the Label definition works for the tool tip as well as the chart label. I ask this because the example in the link is for displaying a label.  I do not want to display a label.  I want the information displayed in a tool tip.  Let me know if the assumption is correct.

Thanks,
Al
0
Ivaylo Gergov
Telerik team
answered on 26 Mar 2013, 11:17 AM
Hello Alfred,

Sorry for misleading you with our suggestion about using ChartLabelDefinition.Binding -- indeed it will only be reflected visually as series item label and not in the DataPoint.Label property.

If what you want is to change the appearance of the ChartToolTipBehavior, you can use its attached ContentTemplate property and define a custom DataTemplate (check the example in our online documentation here). Note, that the context you receive is again of DataPointInfo type so you can directly access your business object through the DataPoint.DataItem property (in this way you can bind directly to a property from the business object that holds your desired label string):
<telerik:RadPieChart x:Name="RadChart1" PaletteName="DefaultDark">
    <telerik:RadPieChart.Behaviors>
        <telerik:ChartTooltipBehavior />
    </telerik:RadPieChart.Behaviors>
 
    <telerik:PieSeries RadiusFactor="0.85" ShowLabels="False">
 
        <telerik:ChartTooltipBehavior.ContentTemplate>
            <DataTemplate>
                <Border Padding="10" Background="Wheat">
                    <TextBlock Text="{Binding DataPoint.DataItem.Label}" />
                </Border>
            </DataTemplate>
        </telerik:ChartTooltipBehavior.ContentTemplate>
    </telerik:PieSeries>
</telerik:RadPieChart>

I hope this helps.

 

Kind regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
Alfred
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Alfred
Top achievements
Rank 1
Share this question
or