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

animation while loading tooltip

3 Answers 54 Views
Chart
This is a migrated thread and some comments may be shown as answers.
cielo valdoz
Top achievements
Rank 1
cielo valdoz asked on 14 May 2010, 02:48 AM
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

3 Answers, 1 is accepted

Sort by
0
Jim Daly
Top achievements
Rank 1
answered on 18 May 2010, 07:40 PM
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.
0
Oscar
Top achievements
Rank 1
answered on 06 Apr 2011, 04:34 AM
Hello Telerik team,

Any improvements in 2011Q1 to what Cielo Valdoz is asking

Regards
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 08 Apr 2011, 10:44 AM
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.
Tags
Chart
Asked by
cielo valdoz
Top achievements
Rank 1
Answers by
Jim Daly
Top achievements
Rank 1
Oscar
Top achievements
Rank 1
Bartholomeo Rocca
Top achievements
Rank 1
Share this question
or