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

Tooltip - Include both X and Y Axis Values

3 Answers 138 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Purna
Top achievements
Rank 1
Purna asked on 21 Nov 2017, 01:23 AM

How can I display the X and Y values in the tool tip for radCartesianchart bar series

 

In radChart, there is a option as below:

<telerik:BarSeriesDefinition ItemToolTipFormat="the X value is #X, the Y value is #Y"ShowItemToolTips="True" />
    </telerik:SeriesMapping.SeriesDefinition>

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 22 Nov 2017, 10:13 AM
Hello Purna,

You can enable the tooltip in RadCartesianChart by defining a new ChartToolTipBehavior. Then you can customize its appearance via the TooltipTemplate property of the series. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Purna
Top achievements
Rank 1
answered on 22 Nov 2017, 11:46 PM

Hello

My XAML is as follows:

 <telerik:RadCartesianChart Name="chart" HoverMode="FadeOtherSeries" ClipToBounds="False" >

                            <telerik:RadCartesianChart.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Export To Image" Click="MenuItem_Click" />
                                </ContextMenu>
                            </telerik:RadCartesianChart.ContextMenu>
                            <telerik:RadCartesianChart.HorizontalAxis>
                                <telerik:CategoricalAxis />
                            </telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:RadCartesianChart.VerticalAxis>
                                <telerik:LinearAxis HorizontalAlignment="Right" />
                            </telerik:RadCartesianChart.VerticalAxis>
                            <telerik:RadCartesianChart.Behaviors>
                                <telerik:ChartTooltipBehavior  > 
                                    </telerik:ChartTooltipBehavior>
                            </telerik:RadCartesianChart.Behaviors>
                        </telerik:RadCartesianChart>

In the documentaion there is no example for dynamic bar stacked series. I am not sure how can I have the template when the bar series is not added in the XAML(it is added from code behind).

Without template, the tool tip shown is

Value = xxxx

Category = yyyyy

 

But I need to change the text as shown below in Bold

Text1=xxxx

Text2=yyyy

 

 

0
Martin Ivanov
Telerik team
answered on 27 Nov 2017, 01:39 PM
Hello Purna,

There are several ways to get a DataTemplate in code-behind.
  • Create it in code using FrameworkElementFactory.
  • Save the template as a string and use the XamlReader.Parse() method to create a DataTemplate object.
  • Or you can define the template in the resources of the application or the view and use the Resources dictionary in code to get the template. For example:
    <Window.Resources
        <DataTemplate x:Key="chartToolTipTemplate">
            <!-- some elements here -->
        </DataTemplate>
    </Window.Resources>

    series.TooltipTemplate = this.Resources["chartToolTipTemplate"] as  DataTemplate;
I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Purna
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Purna
Top achievements
Rank 1
Share this question
or