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

Tooltip for xcategory in chart

1 Answer 28 Views
Chart
This is a migrated thread and some comments may be shown as answers.
ajin prasad
Top achievements
Rank 1
ajin prasad asked on 19 Oct 2016, 06:12 AM

Hi,

 

I am using Radchart and I use StackedBarSeriesDefinition and SeriesMappingCollection to bind it to Rad chart.

I have shortened the string to show it in x-axis. ie the Xcategory value. I need to show the full text on hover the label. Do we have any such things to show tooltip on Xaxis value?

 

 

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 19 Oct 2016, 12:04 PM
Hello,

This scenario can be achieved by setting a custom AxisLabel2D style as shown below:
<Style x:Key="ItemLabelStyle" TargetType="telerik:AxisLabel2D">
            <Setter Property="Foreground" Value="Orange" />
            <Setter Property="FontSize" Value="13.333" />
            <Setter Property="FontStyle" Value="Italic" />
            <Setter Property="ToolTip" Value="{Binding Value}" />
 </Style>
then attach to ChartArea's Loaded event and set the style for each axis label:
private void ChartArea_Loaded(object sender, RoutedEventArgs e)
        {
            ChartArea area = sender as ChartArea;
            HorizontalAxisLabels2D axisLabelsContainer = area.FindChildByType<HorizontalAxisLabels2D>();
            var axisLabels = axisLabelsContainer.ChildrenOfType<AxisLabel2D>();
            Style style = this.Resources["ItemLabelStyle"] as Style;
 
            foreach (var item in axisLabels)
            {
                item.Style = style;
            }
        }
In order to show your desired tooltip value, use the Tooltip property and  bind its value to a property of your business object.

I would also recommend using the newer RadChartView control for new development. More about comparing both charts can be found here.

Hope this helps.

Regards,
Peshito
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Chart
Asked by
ajin prasad
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Share this question
or