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

chart tooltip axis title

3 Answers 99 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
scorp
Top achievements
Rank 1
scorp asked on 07 May 2012, 11:02 PM
Can we have a tooltip show up on mouse hover on the chart's Axis Title?

3 Answers, 1 is accepted

Sort by
0
Accepted
Peshito
Telerik team
answered on 10 May 2012, 09:15 AM
Hello,

Yes, it can be done by creating a style targeting the AxisTitle and using the ToolTipService.ToolTip property to set the text you would like. See the code below as an example:
<UserControl.Resources>
<Style x:Key="chartTitleStyle" TargetType="telerik:AxisTitle">
    <Setter Property="ToolTipService.ToolTip" Value="My axis tooltip text here" />
</Style>
and then use the TitleStyle property of the AxisX to apply the style, like this:
radChart.DefaultView.ChartArea.AxisX.Title = "Axis Title";
radChart.DefaultView.ChartArea.AxisX.AxisStyles.TitleStyle = this.Resources["chartTitleStyle"] as Style;

Using the above approach will show a tooltop when user hovers the axis title.

More about tooltips can be found here.

Hope this helps.

Regards,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
scorp
Top achievements
Rank 1
answered on 15 May 2012, 03:55 PM
Thanks that worked. Is there a way to increase the font size of the tooltip?
0
Peshito
Telerik team
answered on 18 May 2012, 09:41 AM
Hi,

You can increase the size of the tooltip's text by using RadToolTipService instead of ToolTipService. Then using RadToolTipService.ToolTipContentTemplate property you can create your own template like this:
<UserControl.Resources>
        <Style x:Key="chartTitleStyle" TargetType="telerik:AxisTitle">
            <Setter Property="telerik:RadToolTipService.ToolTipContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid MaxWidth="200">
                            <Rectangle Margin="0" RadiusX="2" RadiusY="2" Fill="Brown" />
                            <Rectangle Margin="2" RadiusX="2" RadiusY="2" Fill="Beige" />
                            <TextBlock Margin="5" TextWrapping="Wrap" FontFamily="Comic Sans MS" Text="My Tooltip text"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="telerik:RadToolTipService.ToolTipContent" Value="TEST" />
        </Style>
    </UserControl.Resources>

Hope this helps.

Greetings,
Peshito
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
scorp
Top achievements
Rank 1
Answers by
Peshito
Telerik team
scorp
Top achievements
Rank 1
Share this question
or