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

ChartLegend Tooltip

1 Answer 64 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Philip Ashworth
Top achievements
Rank 1
Philip Ashworth asked on 18 Feb 2010, 03:31 PM
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.

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 23 Feb 2010, 08:33 AM
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.
Tags
Chart
Asked by
Philip Ashworth
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or