PieChart tooltips

2 posts, 1 answers
  1. Stuart
    Stuart avatar
    3 posts
    Member since:
    Aug 2012

    Posted 19 Dec 2012 Link to this post

    I have a pie chart displaying with labels but I can't get the tooltips to display at all.

    <Controls:RadChart IsHitTestVisible="False" 
                               ItemsSource="{Binding PieChartSlices}" 
                               PaletteBrushes="{Binding PieChartSlices, Converter={StaticResource PieChartToBrushCollectionConverter}}" 
                               Background="Transparent" 
                               BorderThickness="0">
                <Controls:RadChart.DefaultView>
                    <Charting:ChartDefaultView>
                        <Charting:ChartDefaultView.ChartLegend>
                            <Charting:ChartLegend Visibility="Collapsed"/>
                        </Charting:ChartDefaultView.ChartLegend>
                        <Charting:ChartDefaultView.ChartArea>
                            <Charting:ChartArea Background="Transparent" SmartLabelsEnabled="True" NoDataString="" />
                        </Charting:ChartDefaultView.ChartArea>
                    </Charting:ChartDefaultView>
                </Controls:RadChart.DefaultView>
                <Controls:RadChart.DefaultSeriesDefinition>
                    <Charting:PieSeriesDefinition MaskVisibility="Collapsed" 
                                                  RadiusFactor="0.575"
                                                  LegendDisplayMode="None"
                                                  ShowItemLabels="True" 
                                                  ShowItemToolTips="True"
                                                  SeriesItemLabelStyle="{StaticResource PieChartLabelStyle}">
                        <Charting:PieSeriesDefinition.SeriesItemTooltipStyle>
                            <Style TargetType="Charting:ItemToolTip2D">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <TextBlock Text="This is tooltip!" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Charting:PieSeriesDefinition.SeriesItemTooltipStyle>
                        <Charting:PieSeriesDefinition.LabelSettings>
                            <Charting:RadialLabelSettings SpiderModeEnabled="True" ShowConnectors="True"   />
                        </Charting:PieSeriesDefinition.LabelSettings>
                    </Charting:PieSeriesDefinition>
                </Controls:RadChart.DefaultSeriesDefinition>
                <Controls:RadChart.SeriesMappings>
                    <Charting:SeriesMapping>
                        <Charting:SeriesMapping.ItemMappings>
                            <Charting:ItemMapping DataPointMember="YValue" FieldName="Count"/>
                        </Charting:SeriesMapping.ItemMappings>
                    </Charting:SeriesMapping>
                </Controls:RadChart.SeriesMappings>
            </Controls:RadChart>

    I've also tried setting the ItemToolTipFormat property instead of setting the SeriesItemTooltipStyle.

     

    ItemToolTipFormat="#%"

     

     

    At this stage I just want any form of tooltip to appear whether auto generated or custom styled but the ShowItemToolTips flag just doesn't seem to make any difference. Any ideas?

     

  2. Answer
    Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 21 Dec 2012 Link to this post

    Hello Stuart,

    The reason why your tooltips are not shown is because you have set the IsHitTestVisible property of the chart to False. Simply change it to True and this will solve the issue.

    More about IsHitTestVisible property can be found here.

    Hope this helps.

    All the best,
    Peshito
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top