Drill Down ToolTip Shows Previous WCF Results

2 posts, 0 answers
  1. Drew
    Drew avatar
    13 posts
    Member since:
    Nov 2010

    Posted 10 Nov 2010 Link to this post

    Hi,

    I have created a LineSeries chart which displays a series of Student results. The ToolTip for each result should then show a Drill Down Chart of more detailed results. All the data is called from a WCF service.

    The issue I have is the Drill Down chart is showing the results from the previous WCF Result.
    i.e. I hover over Student A and no data is shown. I then hover over Student B and Student A's results are shown.

    Here is my Code:

    Private Sub ChartArea_ItemToolTipOpening(ByVal tooltip As ItemToolTip2D, ByVal e As ItemToolTipEventArgs)
        mService.GetStudentResultsAsync(e.DataSeries.LegendLabel)
        tooltip.Content = GetDetailBorder()
    End Sub
     
    Private Sub mService_GetStudentResultsCompleted(ByVal sender As Object, ByVal e As ServiceReference1.GetStudentResultsCompletedEventArgs) Handles mService.GetStudentResultsCompleted
        Me.DetailChart = New RadChart()
     
        DetailChart.Background = New SolidColorBrush(Colors.Transparent)
        DetailChart.DefaultView.ChartLegend.Visibility = Windows.Visibility.Collapsed
        DetailChart.Width = 300
        DetailChart.Height = 300
     
        Dim Definition As ISeriesDefinition = New LineSeriesDefinition() With {.LegendDisplayMode = LegendDisplayMode.DataPointLabel, .ShowItemLabels = True, .ShowItemToolTips = True}
         Dim Mapping As New SeriesMapping() With {.SeriesDefinition = Definition}
     
        Mapping.ItemMappings.Add(New ItemMapping() With {.DataPointMember = DataPointMember.XCategory, .FieldName = "ResultsName"})
        Mapping.ItemMappings.Add(New ItemMapping() With {.DataPointMember = DataPointMember.YValue, .FieldName = "Cost"})
     
        DetailChart.SeriesMappings.Add(Mapping)
     
        For Each Test In e.Result
            Dim LineSeries As New DataSeries()
     
            Dim LineDefinition As SeriesDefinition = New LineSeriesDefinition()
            LineDefinition.ShowItemLabels = False
            LineDefinition.ShowItemToolTips = True
            LineDefinition.Appearance.PointMark.Shape = MarkerShape.Diamond
            Definition.AnimationSettings = New AnimationSettings() With {.ItemAnimationDuration = New TimeSpan(0, 0, 0, 0, 0)}
            LineSeries.Definition = Definition
     
            If Not Test.Result2008 = 0 Then LineSeries.Add(New DataPoint(Test.Result2008))
            If Not Test.Result2009 = 0 Then LineSeries.Add(New DataPoint(Test.Result2009))
            If Not Test.Result2010 = 0 Then LineSeries.Add(New DataPoint(Test.Result2010))
     
            Me.DetailChart.DefaultView.ChartArea.DataSeries.Add(LineSeries)
        Next
    End Sub
     
    Private Function GetDetailBorder() As Border
        Dim NewBorder As New Border() With {.Background = DetailChart.Background, .BorderBrush = New SolidColorBrush(Colors.Blue), .BorderThickness = New Thickness(1), .CornerRadius = New CornerRadius(20), .Padding = New Thickness(5)}
        NewBorder.Child = DetailChart
     
        Return NewBorder
    End Function

    Help would really be appreciated.
  2. Velin
    Admin
    Velin avatar
    391 posts

    Posted 16 Nov 2010 Link to this post

    Hello Drew,

    Here is the reason for this behavior - you are asynchronously calling the web service within the ItemTooltipOpening event handler and immediately after that you try to show the data. At this time the web service call has not returned so the item tooltip is empty. The same happens again when the tooltip is shown for the second time. This time, however, the first web service call has completed and the data from the first call is shown. You can verify that this is the case if you set a break point in both the mService_GetStudentResultsCompleted and GetDetailBorder functions and you will be able to see the order these methods are executed.

    Hope this will help.

    Best wishes,
    Ryan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top