This question is locked. New answers and comments are not allowed.
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.
Thanks
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 Object, ByVal 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