ChartLegend Tooltip

2 posts, 0 answers
  1. Philip Ashworth
    Philip Ashworth avatar
    41 posts
    Member since:
    Dec 2009

    Posted 18 Feb 2010 Link to this post

    Hi,

    Is it possible to display a tooltip over a chart legend item?
    I have a max width on the chart legends, some of the long names are cut off. I wanted to provide a tooltip to display the full name, is it possible?

    Thanks Phil.
  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 23 Feb 2010 Link to this post

    Hello Philip Ashworth,

    Currently you need to re-template the ChartLegendItem. Here is a sample style:
    <Style TargetType="telerikCharting:ChartLegendItem">
        <Setter Property="Foreground" Value="{StaticResource LegendForeground}" />
        <Setter Property="MarkerStrokeThickness" Value="{StaticResource LegendItemMarkerStrokeThickness}" />
        <Setter Property="Template" >
            <Setter.Value>
                <ControlTemplate TargetType="telerikCharting:ChartLegendItem">
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" ToolTipService.ToolTip="{TemplateBinding Label}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Rectangle x:Name="PART_LegendItemMarker"
                       Height="15"
                       Width="30"
                                   StrokeThickness="{TemplateBinding MarkerStrokeThickness}"
                                   RadiusX="2"
                                   RadiusY="2"
                       HorizontalAlignment="Left"
                                   VerticalAlignment="Bottom"
                                   Margin="0,0,0,5"
                                   Style="{TemplateBinding ItemStyle}" />
                        <TextBlock Grid.Column="1"
                                   Padding="0"
                                   Margin="5"
                                   VerticalAlignment="Center"
                                   Foreground="{TemplateBinding Foreground}"
                                   Text="{TemplateBinding Label}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    Then set this style through the RadChart.DefaultView.ChartLegend.LegendItemStyle property.

    Best,
    Joshua
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top