No Tooltip on PieChart

3 posts, 0 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 17 Nov 2014 Link to this post

    Hi!

    I have desperately tried to get a tooltip to show up on my PieChert without success.

    Here is my XAML:

    <telerik:RadPieChart.Behaviors>
        <telerik:ChartTooltipBehavior HorizontalOffset="-6" VerticalOffset="-49" />
    </telerik:RadPieChart.Behaviors>
    <telerik:RadPieChart.TooltipTemplate>
        <DataTemplate>
            <Grid>
                <Path Data="M-1236,-441 L-1180,-441 -1180,-424 -1228,-424 -1230.5,-420 -1233,-424 -1236,-424 z" Stretch="Fill" Fill="White" Stroke="Gray" StrokeThickness="1" />
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding DataItem.Name}" Margin="4,3,4,9" />
                    <TextBlock Text="{Binding DataItem.Value}" Margin="4,3,4,9" />
                    <TextBlock Text="%" Margin="4,3,4,9" />
                </StackPanel>
            </Grid>
        </DataTemplate>
    </telerik:RadPieChart.TooltipTemplate>

    <telerik:PieSeries ItemsSource="{Binding ShiftTypes, Source={StaticResource ViewModel}}" ValueBinding="Value" RadiusFactor="0.85" />

    My view model has a collecion that looks like this:
    private ObservableCollection<ShiftTypesQuotaGaugeChartData> shiftTypes;
          public ObservableCollection<ShiftTypesQuotaGaugeChartData> ShiftTypes
          {
              get { return this.shiftTypes; }
              set
              {
                  this.shiftTypes = value;
                  this.OnPropertyChanged("ShiftTypes");
              }
          }

    public class ShiftTypesQuotaGaugeChartData
    {
        public string Name { get; set; }
        public int Value { get; set; }
    }

    The chart itself works just fine, its just the tooltip that does not popup at all.
    Even tried with a simple hard coded text.

    When I set a breakpoint on the binding it actually stops there.

    Regards,
    Håkan


  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 19 Nov 2014 Link to this post

    Hi Håkan,

    I prepared for you a project demonstrating how the ChartTooltipBehavior can be used in the RadPieChart. Please note that you need to ensure that the mouse pointer is over a specific pie slice for a short period of time before the tooltip to be visualized.

    Please take a look at the attached project and let me know if it works for you.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 20 Nov 2014 in reply to Pavel R. Pavlov Link to this post

    Hi Pavel.

    I don't understand why the example was so complex, with a template selector and a converter returning the same value etc...
    Is that needed?

    Anyway, it does not work as expected for me.
    When I run the latest version of the Telerik controls, it seems to work fine, but the problem is that I'm running on Silverlight 4, so I use the 2012 Q2 SP2 version.
    In that case your example does not show any labels in the chart, and the tooltip is displayed in the top left corner.
    But that might be a minor problem, at least it shows a tooltip, in my project I do not get a tooltip at all.
    What can be the cause of that?

    Regards,
    Håkan
Back to Top