Why my tooltip is not showing?

2 posts, 1 answers
  1. ardmore
    ardmore avatar
    28 posts
    Member since:
    Jul 2016

    Posted 07 Nov 2017 Link to this post

    I used MVVM to create a data source(property), then I use RadCartesianChart to plot it. It works but I can not see the tooltip when hover mouse to the bars.

    <telerik:ChartDataSource x:Name="ChartDataSource1" Items="{Binding Sales}" />
    <telerik:RadCartesianChart x:Name="barSeries">
          <telerik:ChartTooltipBehavior="Top" VerticalOffset="20" />
                <Path Data="M-1236,-441 L-1180,-441 -1180,-424 -1228,-424 -1230.5,-420 -1233,-424 -1236,-424 z"
                          Stretch="Fill" Fill="Beige" Stroke="Gray" StrokeThickness="2"/>
                    <StackPanel Margin="5,5,5,18">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Path=DataItem.Quarter}" FontWeight="Bold" FontSize="11"/>
                 <telerik:CartesianChartGrid MajorLinesVisibility="XY"
        <telerik:BarSeries CategoryBinding="Quarter" ValueBinding="Profit" Items="{Binding Element=ChartDataSource1}"/>



  2. Answer
    Dinko avatar
    657 posts

    Posted 10 Nov 2017 Link to this post

    Hi Hui Zhao,

    Thank you for your interest in RadChartView control.

    This behavior is expected when you have used ChartDataSource. Basically, the DataItem property no longer points to a view model from your collection. The sampling combines several data items into a single data point. In this case, the DataItem property of the DataPoint holds a reference to an object of type DataPointSamplingInfo which holds information about the sampled data and the aggregate used to sample it. You can read more about this behavior in the DataPointSamplingInfo section in our documentation. 

    In your case, you can remove the DataItem from the binding. Attached to this reply you can find sample project based on the provided code snippet which demonstrates this approach. Hope this information is helpful.

    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.
Back to Top