/// <summary> /// The event handler method is hooked when the radio button was clicked. /// </summary> /// <param name="sender">The radio button.</param> /// <param name="e">The event argument.</param> private void rdBtnOlapDataSource_Click(object sender, RoutedEventArgs e) { parentGrid.Children.RemoveAt(0); SfPivotChart pivotChart = new SfPivotChart { ShowToolTip = false, ChartType = PivotChartType.Scatter, Legend = null, Annotations = parentGrid.Resources["OlapAnnotationCollection"] as PivotChartAnnotationCollection }; busyIndicator.IsBusy = true; Task.Run(async() => { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; var taskCompletionSource = new TaskCompletionSource <bool>(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { pivotChart.OlapDataManager = this.viewModel?.OlapDataManager; parentGrid.Children.Insert(0, pivotChart); taskCompletionSource.SetResult(true); busyIndicator.IsBusy = false; }); await taskCompletionSource.Task; }); }
/// <summary> /// The event handler method is hooked when the radio button was clicked. /// </summary> /// <param name="sender">The radio button.</param> /// <param name="e">The event argument.</param> private void rdBtnOlapDataSource_Click(object sender, RoutedEventArgs e) { parentGrid.Children.RemoveAt(0); pivotChart = new SfPivotChart { Margin = new Thickness(25), ShowToolTip = false, ChartType = PivotChartType.Pie, AdornmentsInfo = GetAdornmentsInfo(), Legend = null }; busyIndicator.IsBusy = true; Task t = Task.Run(async() => { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; var taskCompletionSource = new TaskCompletionSource <bool>(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { pivotChart.OlapDataManager = this.adornmentsViewModel?.OlapDataManager; parentGrid.Children.Insert(0, pivotChart); taskCompletionSource.SetResult(true); busyIndicator.IsBusy = false; }); await taskCompletionSource.Task; }); }
/// <summary> /// The event handler method is hooked when the radio button was clicked. /// </summary> /// <param name="sender">The radio button.</param> /// <param name="e">The event argument.</param> private void rdBtnRelationalData_Click(object sender, RoutedEventArgs e) { parentGrid.Children.RemoveAt(0); SfPivotChart pivotChart = new SfPivotChart { ShowToolTip = false, ChartType = PivotChartType.Scatter, Legend = null, Annotations = parentGrid.Resources["RelationalAnnotationCollection"] as PivotChartAnnotationCollection }; busyIndicator.IsBusy = true; Task.Run(async() => { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; var taskCompletionSource = new TaskCompletionSource <bool>(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { pivotChart.ItemSource = ProductSales.GetSalesData(); // Adding PivotAxis to the Control pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "Product", TotalHeader = "Total" }); pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "Country", TotalHeader = "Total" }); if (DeviceFamily.GetDeviceFamily() == Devices.Desktop) { pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "State", TotalHeader = "Total" }); } // Adding PivotLegend to the Control pivotChart.PivotLegend.Add(new PivotItem { FieldMappingName = "Date", TotalHeader = "Total" }); //Adding PivotCalculations to the Control pivotChart.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Quantity", Format = "#.#" }); parentGrid.Children.Insert(0, pivotChart1); taskCompletionSource.SetResult(true); busyIndicator.IsBusy = false; }); await taskCompletionSource.Task; }); }
/// <summary> /// The event handler method is hooked when the radio button was clicked. /// </summary> /// <param name="sender">The radio button.</param> /// <param name="e">The event argument.</param> private void rdBtnRelationalData_Click(object sender, RoutedEventArgs e) { parentGrid.Children.RemoveAt(0); pivotChart = new SfPivotChart { Margin = new Thickness(25), ShowToolTip = false, ChartType = PivotChartType.Pie, AdornmentsInfo = GetAdornmentsInfo(), Legend = null }; busyIndicator.IsBusy = true; Task t = Task.Run(async() => { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; var taskCompletionSource = new TaskCompletionSource <bool>(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { pivotChart.ItemSource = ProductSales.GetSalesData(); // Adding PivotAxis to the Control pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "Product", TotalHeader = "Total" }); pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "Country", TotalHeader = "Total" }); pivotChart.PivotAxis.Add(new PivotItem { FieldMappingName = "State", TotalHeader = "Total" }); // Adding PivotLegend to the Control pivotChart.PivotLegend.Add(new PivotItem { FieldMappingName = "Date", TotalHeader = "Total" }); //Adding PivotCalculations to the Control pivotChart.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Quantity", Format = "#.#" }); parentGrid.Children.Insert(0, pivotChart1); taskCompletionSource.SetResult(true); busyIndicator.IsBusy = false; }); await taskCompletionSource.Task; }); }
/// <summary> /// Method is used to freeing the memory with clearing instances, events and objects. /// </summary> public sealed override void Dispose() { this.pivotChart1?.Dispose(); this.pivotChart1 = null; this.pivotChart?.Dispose(); this.pivotChart = null; this.viewModel?.Dispose(); this.viewModel = null; this.busyIndicator?.Dispose(); this.busyIndicator = null; if (this.rdBtnOlapDataSource != null) { this.rdBtnOlapDataSource.Click -= this.rdBtnOlapDataSource_Click; } this.rdBtnOlapDataSource = null; if (this.rdBtnRelationalData != null) { this.rdBtnRelationalData.Click -= this.rdBtnRelationalData_Click; } this.rdBtnRelationalData = null; base.Dispose(); }
/// <summary> /// The event handler method is hooked when the radio button was clicked. /// </summary> /// <param name="sender">The radio button.</param> /// <param name="e">The event argument.</param> private void rdBtnOlapDataSource_Click(object sender, RoutedEventArgs e) { parentGrid.Children.RemoveAt(0); pivotChart = new SfPivotChart { ShowToolTip = true, ChartType = cmb_ChartType.SelectedItem as PivotChartType? ?? PivotChartType.Column, }; busyIndicator.IsBusy = true; Task.Run(async() => { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; var taskCompletionSource = new TaskCompletionSource <bool>(); await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { pivotChart.OlapDataManager = viewModel.OlapDataManager; parentGrid.Children.Insert(0, pivotChart); taskCompletionSource.SetResult(true); busyIndicator.IsBusy = false; }); await taskCompletionSource.Task; }); }