chart tooltip axis title

4 posts, 1 answers
  1. scorp
    scorp avatar
    59 posts
    Member since:
    Dec 2010

    Posted 07 May 2012 Link to this post

    Can we have a tooltip show up on mouse hover on the chart's Axis Title?
  2. Answer
    Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 10 May 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. scorp
    scorp avatar
    59 posts
    Member since:
    Dec 2010

    Posted 15 May 2012 Link to this post

    Thanks that worked. Is there a way to increase the font size of the tooltip?
  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 18 May 2012 Link to this post

    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 >>

Back to Top