animation while loading tooltip

4 posts, 0 answers
  1. cielo valdoz
    cielo valdoz avatar
    33 posts
    Member since:
    Dec 2009

    Posted 13 May 2010 Link to this post

    Hi,

    Im adding a tooltip chart within a chart and im getting the data using wcf service. but it takes time before loading the tooltip chart. how can i display a loading animation or busy icon while calling the service? whenever i point the mouse, the tooltip chart will appear but without data then after a few seconds, it will load the data from datatabase.

    Pls see the screenshot i attached.

    Dim chartToolTip As New RadChart()  
     
    Private Sub ChartTotalSales_ItemToolTipOpening(ByVal tooltip As Telerik.Windows.Controls.Charting.ItemToolTip2D, ByVal e As Telerik.Windows.Controls.Charting.ItemToolTipEventArgs) Handles ChartTotalSales.ItemToolTipOpening  
     
            Dim bitMod As Integer 
            Dim intCategoryGroup As Integer 
            Dim intCategory As Integer 
            Dim dateFrom As Date 
            Dim dateTo As Date 
            Dim timeFrom As TimeSpan  
            Dim timeTo As TimeSpan  
            Dim intTerminal As Integer 
            Dim intSalesPerson As Integer 
     
            chartToolTip = New RadChart  
            If chkTotalSalesAll.IsChecked Then 
                bitMod = -1  
                intCategoryGroup = 0  
                intCategory = 0  
            Else 
                If chkTotalSalesMOD.IsChecked Then 
                    bitMod = 1  
                Else 
                    bitMod = 0  
                End If 
                intCategoryGroup = cmbTotalSalesCategoryGroup.SelectedValue  
                intCategory = cmbTotalSalesCategory.SelectedValue  
            End If 
     
            If chkTotalSalesTerminalAll.IsChecked Then 
                intTerminal = 0  
            Else 
                intTerminal = cmbTotalSalesTerminal.SelectedValue  
            End If 
     
            If chkTotalSalesSalesPersonAll.IsChecked Then 
                intSalesPerson = 0  
            Else 
                intSalesPerson = cmbTotalSalesSalesPerson.SelectedValue  
            End If 
     
            If rbtTotalSalesPeriodDates.IsChecked Then 
                dateFrom = dteTotalSalesPeriodFrom.SelectedDate  
                dateTo = dteTotalSalesPeriodTo.SelectedDate  
            ElseIf rbtTotalSalesPeriodWeek.IsChecked Then 
                dateFrom = Now.Date.AddDays(-7)  
                dateTo = Now.Date 
            ElseIf rbtTotalSalesPeriodMonth.IsChecked Then 
                dateFrom = Now.Date.AddMonths(-1)  
                dateTo = Now.Date 
            ElseIf rbtTotalSalesPeriodTrimester.IsChecked Then 
                dateFrom = Now.Date.AddMonths(-3)  
                dateTo = Now.Date 
            ElseIf rbtTotalSalesPeriodYear.IsChecked Then 
                dateFrom = Now.Date.AddYears(-1)  
                dateTo = Now.Date 
            End If 
     
            If rbtTotalSalesPeriodTime.IsChecked Then 
                timeFrom = timeTotalSalesPeriodFrom.SelectedTime  
                timeTo = timeTotalSalesPeriodTo.SelectedTime  
            ElseIf rbtTotalSalesPeriodBreakfast.IsChecked Then 
                timeFrom = New TimeSpan(6, 0, 0)  
                timeTo = New TimeSpan(10, 59, 0)  
            ElseIf rbtTotalSalesPeriodLunch.IsChecked Then 
                timeFrom = New TimeSpan(11, 0, 0)  
                timeTo = New TimeSpan(12, 59, 0)  
            ElseIf rbtTotalSalesPeriodDinner.IsChecked Then 
                timeFrom = New TimeSpan(18, 0, 0)  
                timeTo = New TimeSpan(21, 59, 0)  
            ElseIf rbtTotalSalesPeriodLateNight.IsChecked Then 
                timeFrom = New TimeSpan(22, 0, 0)  
                timeTo = New TimeSpan(23, 59, 0)  
            End If 
     
            Select Case fctGetPeriod()  
                Case 2  
                    Dim mService As DashboardService.DashboardClient = New DashboardService.DashboardClient()  
                    AddHandler mService.GetWeeklySalesCompleted, AddressOf webService_GetWeeklySalesCompleted  
     
                 
                    mService.GetWeeklySalesAsync(bitMod, intCategoryGroup, intCategory, e.DataPoint.XValue, _  
                                                dateFrom, dateTo, timeFrom, timeTo, intTerminal, intSalesPerson)  
                    chartToolTip.Height = 200  
                    chartToolTip.Width = 350  
                    chartToolTip.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed  
                    chartToolTip.DefaultView.ChartTitle.Content = "Weekly Sales" 
                    chartToolTip.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Inside  
     
                    tooltip.Content = chartToolTip  
                Case 3, 4  
                    Dim mService As DashboardService.DashboardClient = New DashboardService.DashboardClient()  
                    AddHandler mService.GetMonthlySalesCompleted, AddressOf webService_GetMonthlySalesCompleted  
     
                    mService.GetMonthlySalesAsync(bitMod, intCategoryGroup, intCategory, e.DataPoint.XValue, _  
                                              dateFrom, dateTo, timeFrom, timeTo, intTerminal, intSalesPerson)  
                    chartToolTip.Height = 200  
                    chartToolTip.Width = 700  
                    chartToolTip.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed  
                    chartToolTip.DefaultView.ChartTitle.Content = "Monthly Sales" 
                    chartToolTip.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Inside  
     
                    tooltip.Content = chartToolTip  
            End Select 
     
        End Sub 
     
        Private Sub webService_GetMonthlySalesCompleted(ByVal sender As ObjectByVal e As DashboardService.GetMonthlySalesCompletedEventArgs) Handles webService.GetMonthlySalesCompleted  
     
            chartToolTip.Height = 200  
            chartToolTip.Width = 700  
            chartToolTip.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed  
            chartToolTip.DefaultView.ChartTitle.Content = "Monthly Sales" 
            chartToolTip.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Inside  
     
            Dim LineSeries As New DataSeries()  
            LineSeries.Definition = New LineSeriesDefinition()  
            LineSeries.Definition.ShowItemLabels = False 
     
            For i As Integer = 0 To e.Result.Count - 1  
                Dim point As New DataPoint  
                point.YValue = e.Result.Item(i).Amount  
                point.XCategory = e.Result.Item(i).Period  
                LineSeries.Add(point)  
            Next 
     
            chartToolTip.DefaultView.ChartArea.DataSeries.Clear()  
            chartToolTip.DefaultView.ChartArea.DataSeries.Add(LineSeries)  
     
            'Dim tooltip As New Charting.ItemToolTip2D  
            'tooltip.Content = chartToolTip  
        End Sub 

    Thanks
  2. Jim Daly
    Jim Daly avatar
    13 posts
    Member since:
    Apr 2010

    Posted 18 May 2010 Link to this post

    One way you could do it is to initially set the Content of your tooltip to an instance of the ActivityControl (or BusyIndicator as it is called in the SL Toolkit), and then set the Content to your RadChart when the data has returned from your service call.
  3. DevCraft banner
  4. Oscar
    Oscar avatar
    25 posts
    Member since:
    Aug 2012

    Posted 05 Apr 2011 Link to this post

    Hello Telerik team,

    Any improvements in 2011Q1 to what Cielo Valdoz is asking

    Regards
  5. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 08 Apr 2011 Link to this post

    Hello Oscar,

    As far as I know there are no built-in improvements in RadChart regarding this scenario but you should still be able to achieve the desired effect with a BusyIndicator as mentioned previously.


    Greetings,
    Bart.
Back to Top