public override View GetSampleContent(Context context) { var chart = new SfChart(context); ; chart.SetBackgroundColor(Color.White); chart.Title.Text = "Average temperature for the year 2014"; chart.Title.SetPadding(0, 0, 0, 15); NumericalStripLine numericalStripLines1 = new NumericalStripLine(); numericalStripLines1.Start = 28; numericalStripLines1.Width = 8; numericalStripLines1.Text = "Low Temperature"; numericalStripLines1.FillColor = Color.ParseColor("#C8D16D"); numericalStripLines1.LabelStyle.TextSize = 20; NumericalStripLine numericalStripLines2 = new NumericalStripLine(); numericalStripLines2.Start = 36; numericalStripLines2.Width = 8; numericalStripLines2.Text = "Average Temperature"; numericalStripLines2.FillColor = Color.ParseColor("#F4C762"); numericalStripLines2.LabelStyle.TextSize = 20; NumericalStripLine numericalStripLines3 = new NumericalStripLine(); numericalStripLines3.Start = 44; numericalStripLines3.Width = 8; numericalStripLines3.Text = "High Temperature"; numericalStripLines3.FillColor = Color.ParseColor("#EF7878"); numericalStripLines3.LabelStyle.TextSize = 20; NumericalAxis numericalAxis = new NumericalAxis() { Minimum = 28, Maximum = 52}; numericalAxis.Title.Text = "Temperature in celsius"; numericalAxis.StripLines.Add(numericalStripLines1); numericalAxis.StripLines.Add(numericalStripLines2); numericalAxis.StripLines.Add(numericalStripLines3); chart.PrimaryAxis = new CategoryAxis(); (chart.PrimaryAxis as CategoryAxis).LabelPlacement = LabelPlacement.BetweenTicks; chart.PrimaryAxis.Title.Text = "Months"; chart.SecondaryAxis = numericalAxis; var areaSeries = new SplineSeries { StrokeWidth = 3, DataSource = MainPage.GetStripLineData(), Color = Color.ParseColor("#2F4F4F") }; chart.Series.Add(areaSeries); return chart; }
public override View GetSampleContent(Context context) { var chart = new SfChart(context);; chart.SetBackgroundColor(Color.White); chart.PrimaryAxis = new CategoryAxis {PlotOffset = 20}; chart.SecondaryAxis = new NumericalAxis(); var series = new SplineSeries { DataSource = MainPage.GetData1(), StrokeWidth = 3, }; series.DataMarker.ShowLabel = true; chart.Series.Add(series); return chart; }
private RadCartesianChartView createChart(){ //Create the Chart View RadCartesianChartView chart = new RadCartesianChartView(this.Activity); //Create the spline area series and attach axes and value bindings. SplineSeries splineSeries = new SplineSeries(); splineSeries.ValueBinding = new ValueBinding(); splineSeries.CategoryBinding = new CategoryBinding(); LinearAxis verticalAxis = new LinearAxis(); //The values in the linear axis will not have values after the decimal point. verticalAxis.LabelFormat = "%.0f"; CategoricalAxis horizontalAxis = new CategoricalAxis(); splineSeries.VerticalAxis = verticalAxis; splineSeries.HorizontalAxis = horizontalAxis; //Bind series to data splineSeries.Data = this.getData(); //Add series to chart chart.Series.Add(splineSeries); return chart; }
protected override void OnNavigatedTo(NavigationEventArgs e) { var transfer = (timerToChartsTransfer)e.Parameter; var tc = new TelemetryClient(); tc.TrackEvent("Charts Viewed"); Demands.Clear(); //for(int i=0; i<transfer.trackact.activity[(int)transfer.activity_pos].timer_data.Count; i++) //{ // TimeTable tb = new TimeTable(); // tb.eventCount = i + 1; // tb.seconds = transfer.trackact.activity[(int)transfer.activity_pos].timer_data[i].time_in_seconds; // Demands.Add(tb); //} DateTime dt = (DateTime.Now).AddDays(-10); for (int i = 0; i < transfer.trackact.activity[(int)transfer.activity_pos].timer_data.Count; i++) { TimeTable tb = new TimeTable(); DateTime da = transfer.trackact.activity[(int)transfer.activity_pos].timer_data[i].startTime; tb.Demand = da.ToLocalTime(); tb.runningMedian = transfer.trackact.activity[(int)transfer.activity_pos].timer_data[i].running_median; tb.seconds = transfer.trackact.activity[(int)transfer.activity_pos].timer_data[i].time_in_seconds; Demands.Add(tb); } //SfChart chart = new SfChart(); myChart.HorizontalAlignment = HorizontalAlignment.Center; myChart.VerticalAlignment = VerticalAlignment.Center; myChart.Header = "Time and Median"; myChart.Foreground = new SolidColorBrush(Colors.White); DateTimeCategoryAxis primaryCategoryAxis = new DateTimeCategoryAxis(); primaryCategoryAxis.Interval = 1; primaryCategoryAxis.Header = "Timer Started"; primaryCategoryAxis.LabelFormat = "dd/MM hh:mm tt"; primaryCategoryAxis.Foreground = new SolidColorBrush(Colors.White); myChart.PrimaryAxis = primaryCategoryAxis; NumericalAxis secondaryNumericalAxis = new NumericalAxis(); secondaryNumericalAxis.Header = "Time (in seconds)"; secondaryNumericalAxis.Minimum = 0; secondaryNumericalAxis.Foreground = new SolidColorBrush(Colors.White); myChart.SecondaryAxis = secondaryNumericalAxis; SplineSeries series2 = new SplineSeries(); series2.ItemsSource = Demands; series2.ShowTooltip = true; series2.Label = "Median Time"; series2.XBindingPath = "Demand"; series2.YBindingPath = "runningMedian"; series2.EnableAnimation = true; ColumnSeries series1 = new ColumnSeries(); series1.EnableAnimation = true; series1.ShowTooltip = true; series1.Label = "Time (in seconds)"; series1.ItemsSource = Demands; series1.XBindingPath = "Demand"; series1.YBindingPath = "seconds"; myChart.Series.Add(series1); myChart.Series.Add(series2); myChart.Legend = new ChartLegend() { Visibility = Visibility.Visible }; //Hashtable datetime_ht = new Hashtable(); //List<long> total_time_day = new List<long>(); //datetime_ht.Clear(); //total_time_day.Clear(); //Demands = new ObservableCollection<GoldDemand>(); //transfer = (timerToChartsTransfer)e.Parameter; //var activity = transfer.trackact.activity[(int)transfer.activity_pos]; //int m = 0; //for (int l = 0; l < activity.timer_data.Count; l++) //{ // if (!datetime_ht.Contains(((activity.timer_data[l].startTime).ToLocalTime()).Date)) // { // datetime_ht.Add(((activity.timer_data[l].startTime).ToLocalTime()).Date, m); // total_time_day.Add(activity.timer_data[l].time_in_seconds); // m++; // } // else // { // int pos = (int)datetime_ht[((activity.timer_data[l].startTime).ToLocalTime()).Date]; // total_time_day[pos] = total_time_day[pos] + activity.timer_data[l].time_in_seconds; // } //} //Demands.Clear(); //int i = 0; //foreach (var act in activity.timer_data) //{ // GoldDemand dem_event = new GoldDemand(); // if (datetime_ht.Contains(((act.startTime).ToLocalTime()).Date)) // { // GoldDemand dem = new GoldDemand(); // dem.date = ((act.startTime).ToLocalTime()).Date; // dem.Demand = String.Format("{0:dd/MM}", dem.date); // //myChart.Header = ; // //dem.Demand = i + 1; // int pos = (int)datetime_ht[((act.startTime).ToLocalTime()).Date]; // dem.seconds = total_time_day[pos]; // datetime_ht.Remove(((act.startTime).ToLocalTime()).Date); // Demands.Add(dem); // //total_time_day.RemoveAt(pos); // } // dem_event.event_count = i; // i = i + 1; //} //this.DataContext = this; //i = 0; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { ResultCollection = new ObservableCollection<WiFiNetworkDisplay>(); var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector()); if (result.Count >= 1) { firstAdapter = await WiFiAdapter.FromIdAsync(result[0].Id); } foreach (var network in firstAdapter.NetworkReport.AvailableNetworks) { var networkDisplay = new WiFiNetworkDisplay(network, firstAdapter); await networkDisplay.UpdateConnectivityLevel(); ResultCollection.Add(networkDisplay); } // sfdgNetList.DataContext = WiFiScan.WiFiNetworkDisplay; sfdgNetList.AllowSorting = true; sfdgNetList.AllowFiltering = true; sfdgNetList.RowHeight = 13; sfdgNetList.HeaderRowHeight = 30; sfdgNetList.AutoGenerateColumns = false; sfdgNetList.ItemsSource = ResultCollection; sfdgNetList.ColumnSizer = Syncfusion.UI.Xaml.Grid.GridLengthUnitType.Auto; sfdgNetList.Columns.Add(new GridTextColumn() { HeaderText = "SSID", MappingName = "Ssid" }); sfdgNetList.Columns.Add(new GridTextColumn() { HeaderText = "BSSID", MappingName = "Bssid" }); sfdgNetList.Columns.Add(new GridTextColumn() { HeaderText = "Channel", MappingName = "Channel" }); sfdgNetList.Columns.Add(new GridTextColumn() { HeaderText = "RSSI", MappingName = "Rssi" }); sfdgNetList.Columns.Add(new GridTextColumn() { HeaderText = "Security", MappingName = "SecuritySettings" }); //Chart Stuff sfChartNetView24.Header = "Wi-Fi Networks"; NumericalAxis primaryAxis = new Syncfusion.UI.Xaml.Charts.NumericalAxis(); primaryAxis.Minimum = 0; primaryAxis.Maximum = 14; primaryAxis.Interval = 1; primaryAxis.Header = "Channels"; sfChartNetView24.PrimaryAxis = primaryAxis; NumericalAxis SecondaryNumericalAxis = new Syncfusion.UI.Xaml.Charts.NumericalAxis(); SecondaryNumericalAxis.Header = "Signal Strength"; SecondaryNumericalAxis.Minimum = -100; SecondaryNumericalAxis.Maximum = -15; SecondaryNumericalAxis.Interval = 10; sfChartNetView24.SecondaryAxis = SecondaryNumericalAxis; ChartSeriesInput = new ObservableCollection<ChartHelperBssidNodeSeries>(); ChartSeriesInput = HelperFunctions.ChartHelper(ResultCollection); foreach (ChartHelperBssidNodeSeries c in ChartSeriesInput) { SplineSeries mySeries = new SplineSeries(); mySeries.ItemsSource = c.Series; mySeries.Label = "Home"; mySeries.XBindingPath = "Channel"; mySeries.YBindingPath = "Rssi"; mySeries.StrokeThickness = 2; //mySeries.EnableAnimation = true; //mySeries.AnimationDuration = System.TimeSpan.FromSeconds(.2); sfChartNetView24.Series.Add(mySeries); } //Chart Stuff sfChartNetView52.Header = "Wi-Fi Networks"; NumericalAxis primaryAxis52 = new Syncfusion.UI.Xaml.Charts.NumericalAxis(); primaryAxis52.Minimum = 36; primaryAxis52.Maximum = 165; primaryAxis52.Interval = 2; primaryAxis52.IsTextScaleFactorEnabled = true; primaryAxis52.LabelsIntersectAction = AxisLabelsIntersectAction.Hide; primaryAxis.Header = "Channels"; sfChartNetView52.PrimaryAxis = primaryAxis52; NumericalAxis SecondaryNumericalAxis52 = new Syncfusion.UI.Xaml.Charts.NumericalAxis(); SecondaryNumericalAxis52.Header = "Signal Strength"; SecondaryNumericalAxis52.Minimum = -100; SecondaryNumericalAxis52.Maximum = -15; SecondaryNumericalAxis52.Interval = 10; sfChartNetView24.SecondaryAxis = SecondaryNumericalAxis52; ChartSeriesInput = new ObservableCollection<ChartHelperBssidNodeSeries>(); ChartSeriesInput = HelperFunctions.ChartHelper(ResultCollection); foreach (ChartHelperBssidNodeSeries c in ChartSeriesInput) { SplineSeries mySeries = new SplineSeries(); mySeries.ItemsSource = c.Series; mySeries.Label = "Home"; mySeries.XBindingPath = "Channel"; mySeries.YBindingPath = "Rssi"; mySeries.StrokeThickness = 2; //mySeries.EnableAnimation = true; //mySeries.AnimationDuration = System.TimeSpan.FromSeconds(.2); sfChartNetView52.Series.Add(mySeries); } }
private StackLayout GetChart() { SfChart chart = new SfChart(); chart.PrimaryAxis = new CategoryAxis() { LabelPlacement = LabelPlacement.BetweenTicks }; chart.SecondaryAxis = new NumericalAxis(); ChartDataMarker dataMarker = new ChartDataMarker() { ShowLabel = true }; dataMarker.LabelStyle.TextColor = Color.White; dataMarker.LabelStyle.Font = Font.SystemFontOfSize(25); ColumnSeries col_bars = new ColumnSeries () { ItemsSource = GetData1(), DataMarkerPosition = Syncfusion.SfChart.XForms.DataMarkerPosition.Center, }; col_bars.DataMarker = dataMarker; SplineSeries col_splines = new SplineSeries(){ ItemsSource = GetData1(), StrokeWidth = 3 }; chart.Series.Add (col_bars); chart.Series.Add (col_splines); chart.VerticalOptions = LayoutOptions.FillAndExpand; chart.HorizontalOptions = LayoutOptions.FillAndExpand; ////////////// Picker# /// /// Picker Period Picker p_list_period = new Picker { Title = menu_labels_[2], VerticalOptions = LayoutOptions.StartAndExpand }; String [] periodNameList = {"periodo 1", "periodo 2"}; foreach (string periodName in periodNameList) { p_list_period.Items.Add(periodName); } p_list_period.SelectedIndex = 0; /// Picker year Picker p_list_year = new Picker { Title = menu_labels_[0], VerticalOptions = LayoutOptions.StartAndExpand }; String [] yearNameList = {"2010", "2011", "2012", "2013", "2014"}; foreach (string yearName in yearNameList) { p_list_year.Items.Add(yearName); } p_list_year.SelectedIndex = 0; /// Picker zona Picker p_list_zone = new Picker { Title = menu_labels_[1], VerticalOptions = LayoutOptions.StartAndExpand }; String [] zoneNameList = {"Norte", "Sur", "Este", "Oeste"}; foreach (string zoneName in zoneNameList) { p_list_zone.Items.Add(zoneName); } p_list_zone.SelectedIndex = 0; /// Picker QUINCENA Picker p_list_quincena = new Picker { Title = menu_labels_[3], VerticalOptions = LayoutOptions.StartAndExpand }; String [] quincenaNameList = {"Quincena 1", "Quincena 2"}; foreach (string quincenaName in quincenaNameList) { p_list_quincena.Items.Add(quincenaName); } p_list_quincena.SelectedIndex = 0; /// Picker MES Picker p_list_mes = new Picker { Title = menu_labels_[3], VerticalOptions = LayoutOptions.StartAndExpand }; String [] mesNameList = {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre", "Noviembre", "Diciembre"}; foreach (string mesName in mesNameList) { p_list_mes.Items.Add(mesName); } p_list_mes.SelectedIndex = 0; /////// p_list_year.SelectedIndexChanged += (sender, args) => { if (p_list_year.SelectedIndex == -1) { col_bars.ItemsSource = GetData1(); } else { int num = p_list_year.SelectedIndex; if (num == 0) col_bars.ItemsSource = GetData1(); else col_bars.ItemsSource = GetData2(); } }; pmenu_pesquera_ = GetMenuPesquera (); pmenu_pesquera_.VerticalOptions = LayoutOptions.Start; StackLayout main_layout = new StackLayout (){ Padding = GlobalParameters.MAIN_LAYOUT_PADDING_, Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { pmenu_pesquera_, new Label(){ Text = title_page_, HorizontalOptions = LayoutOptions.Center }, new StackLayout(){ Spacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[0] }, p_list_year, new StackLayout{ Spacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.CenterAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[1] }, p_list_zone } }, new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[2] }, p_list_period } }, new StackLayout(){ Spacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[3] }, p_list_mes, new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[4] }, p_list_quincena } }, chart } }; return main_layout; }
private async void GetChart() { SfChart chart = new SfChart(); chart.PrimaryAxis = new CategoryAxis() { LabelPlacement = LabelPlacement.BetweenTicks }; chart.SecondaryAxis = new NumericalAxis(); chart.ChartBehaviors.Add(new ChartZoomPanBehavior(){ EnablePanning = true, EnableZooming = true}) ; ChartDataMarker col_dataMarker = new ChartDataMarker() { ShowLabel = true }; col_dataMarker.LabelStyle.Font = Font.SystemFontOfSize(10); col_dataMarker.LabelStyle.BackgroundColor = Color.Transparent; col_dataMarker.LabelStyle.TextColor = Color.Black; ChartDataMarker spline_dataMarker = new ChartDataMarker() { ShowLabel = true }; spline_dataMarker.LabelStyle.Font = Font.SystemFontOfSize(10); spline_dataMarker.LabelStyle.BackgroundColor = Color.Transparent; spline_dataMarker.LabelStyle.TextColor = Color.Purple; col_bars_ = new ColumnSeries () { Label = "TM", ItemsSource = GetEmptyData(), DataMarkerPosition = Syncfusion.SfChart.XForms.DataMarkerPosition.Center, }; col_bars_.DataMarker = col_dataMarker; //Appearance col_bars_.ColorModel.Palette = ChartColorPalette.Custom; col_bars_.ColorModel.CustomBrushes = GlobalParameters.COLORS_GRAPHIC05; col_splines_ = new SplineSeries(){ Label = "N° E/P", ItemsSource = GetEmptyData(), StrokeWidth = 3, YAxis = new NumericalAxis(){ OpposedPosition = true, ShowMajorGridLines = false } }; col_splines_.DataMarker = spline_dataMarker; chart.Series.Add (col_bars_); chart.Series.Add (col_splines_); chart.VerticalOptions = LayoutOptions.FillAndExpand; chart.HorizontalOptions = LayoutOptions.FillAndExpand; chart.Legend = new ChartLegend (); ////////////// Picker# /// /// Picker Period p_list_period_ = new Picker { Title = menu_labels_[2], VerticalOptions = LayoutOptions.StartAndExpand, Scale = GlobalParameters.SCALE_PICKER, WidthRequest = GlobalParameters.WIDTH_PICKER_PERIODO }; /// Picker Year p_list_year_ = new Picker { Title = menu_labels_[0], VerticalOptions = LayoutOptions.StartAndExpand, Scale = GlobalParameters.SCALE_PICKER, }; /// Picker zona p_list_zone_ = new Picker { Title = menu_labels_[1], VerticalOptions = LayoutOptions.StartAndExpand, Scale = GlobalParameters.SCALE_PICKER, WidthRequest = GlobalParameters.WIDTH_PICKER_ZONE }; /// Picker QUINCENA p_list_quincena_ = new Picker { Title = menu_labels_[3], VerticalOptions = LayoutOptions.StartAndExpand, Scale = GlobalParameters.SCALE_PICKER, }; foreach (string quincenaName in GlobalParameters.LIST_QUINCENAS) { p_list_quincena_.Items.Add(quincenaName); } p_list_quincena_.SelectedIndex = 0; /// Picker MES p_list_mes_ = new Picker { Title = menu_labels_[4], VerticalOptions = LayoutOptions.StartAndExpand, Scale = GlobalParameters.SCALE_PICKER, }; foreach (string mesName in GlobalParameters.LIST_MESES) { p_list_mes_.Items.Add(mesName); } p_list_mes_.SelectedIndex = 0; /////// p_list_year_.SelectedIndexChanged += (sender, args) => { if (p_list_year_.SelectedIndex == -1) { col_bars_.ItemsSource = GetEmptyData(); } else { /* int num = p_list_year_.SelectedIndex; if (num == 0) col_bars_.ItemsSource = GetEmptyData(); else col_bars_.ItemsSource = GetData2(); */ LoadZones(); } }; p_list_zone_.SelectedIndexChanged += (sender, args) => { if ( p_list_zone_.SelectedIndex == -1 ){ col_bars_.ItemsSource = GetEmptyData(); }else{ LoadPeriodos( false ); } }; p_list_period_.SelectedIndexChanged += ( sender, args) => { if (p_list_period_.SelectedIndex == -1) { col_bars_.ItemsSource = GetEmptyData(); } else { //LoadAllGrafico05 (false); } }; p_list_mes_.SelectedIndexChanged += ( sender, args) => { if (p_list_mes_.SelectedIndex == -1) { col_bars_.ItemsSource = GetEmptyData(); } else { //LoadAllGrafico05 (false); } }; p_list_quincena_.SelectedIndexChanged += ( sender, args) => { if (p_list_quincena_.SelectedIndex == -1) { col_bars_.ItemsSource = GetEmptyData(); } else { //LoadAllGrafico05 (false); } }; Button refrescar = new Button (); refrescar.HorizontalOptions = new LayoutOptions (LayoutAlignment.Fill, true); refrescar.Image = (FileImageSource) FileImageSource.FromFile("refrescar.png"); refrescar.Clicked += (object sender, EventArgs e) => { LoadAllGrafico05 (false); }; StackLayout main_layout = new StackLayout (){ Padding = GlobalParameters.MAIN_LAYOUT_PADDING_, Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Children = { //pmenu_pesquera_, indicator, new Label(){ Text = title_page_, HorizontalOptions = LayoutOptions.Center }, new StackLayout(){ Spacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[0], VerticalOptions = LayoutOptions.Center }, p_list_year_, new StackLayout{ Spacing = 0, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.CenterAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[1], VerticalOptions = LayoutOptions.Center }, p_list_zone_ } }, new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[2], VerticalOptions = LayoutOptions.Center }, p_list_period_ } }, new StackLayout(){ Spacing = 1, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Children = { new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = menu_labels_[3], VerticalOptions = LayoutOptions.Center }, p_list_mes_, new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = " " + menu_labels_[4], VerticalOptions = LayoutOptions.Center }, p_list_quincena_, new Label(){ FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_, Text = " " }, refrescar } }, chart } }; main_page_ = main_layout; List<dtoAnio> yearNameList = await http_loader_.LoadAniosFromInternet (); p_list_year_.Items.Clear (); foreach (dtoAnio yearName in yearNameList) { p_list_year_.Items.Add(yearName.anoTempo.ToString()); } p_list_year_.SelectedIndex = 0; }
private void OnChartTypeSelectionChanged1(object sender, SelectionChangedEventArgs e) { if (Basic_Chart != null) { if (Basic_Chart.Behaviors.Count == 0) { Basic_Chart.Behaviors.Add(new ChartZoomPanBehavior()); } (Basic_Chart.SecondaryAxis as NumericalAxis).ClearValue(NumericalAxis.MaximumProperty); } ComboBox comboBox = sender as ComboBox; if (comboBox.SelectedIndex == 0 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Visible; Column_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; Basic_Chart.PrimaryAxis = this.primaryAxis; Basic_Chart.SecondaryAxis = this.secondaryAxis; Basic_Chart.Legend = this.legend; Basic_Chart.Header = this.header; LineSeries series1 = new LineSeries(); LineSeries series2 = new LineSeries(); LineSeries series3 = new LineSeries(); DataTemplate template1 = MainGrid.Resources["labelTemplate1"] as DataTemplate; DataTemplate template2 = MainGrid.Resources["labelTemplate2"] as DataTemplate; DataTemplate template3 = MainGrid.Resources["labelTemplate3"] as DataTemplate; ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo(); adornmentInfo1.ShowLabel = true; ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo(); adornmentInfo2.ShowLabel = true; ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo(); adornmentInfo3.ShowLabel = true; series1.XBindingPath = "Year"; series1.YBindingPath = "IND"; series1.ItemsSource = viewModel.power; series1.ShowTooltip = true; series1.EnableAnimation = true; adornmentInfo1.LabelTemplate = template1; series1.AdornmentsInfo = adornmentInfo1; series1.Label = "India"; series2.XBindingPath = "Year"; series2.YBindingPath = "GER"; series2.ItemsSource = viewModel.power; series2.ShowTooltip = true; series2.EnableAnimation = true; adornmentInfo2.LabelTemplate = template2; series2.AdornmentsInfo = adornmentInfo2; series2.Label = "Germany"; series3.XBindingPath = "Year"; series3.YBindingPath = "FRA"; series3.ItemsSource = viewModel.power; series3.EnableAnimation = true; series3.ShowTooltip = true; adornmentInfo3.LabelTemplate = template3; series3.AdornmentsInfo = adornmentInfo3; series3.Label = "France"; Basic_Chart.Series.Clear(); Basic_Chart.PrimaryAxis.ZoomFactor = 1; Basic_Chart.SecondaryAxis.ZoomFactor = 1; Basic_Chart.Series.Add(series1); Basic_Chart.Series.Add(series2); Basic_Chart.Series.Add(series3); } else if (comboBox.SelectedIndex == 1 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Visible; Column_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; Basic_Chart.PrimaryAxis = this.primaryAxis; Basic_Chart.SecondaryAxis = this.secondaryAxis; Basic_Chart.Legend = this.legend; Basic_Chart.Header = this.header; SplineSeries series1 = new SplineSeries(); SplineSeries series2 = new SplineSeries(); SplineSeries series3 = new SplineSeries(); DataTemplate template1 = MainGrid.Resources["labelTemplate1"] as DataTemplate; DataTemplate template2 = MainGrid.Resources["labelTemplate2"] as DataTemplate; DataTemplate template3 = MainGrid.Resources["labelTemplate3"] as DataTemplate; ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo(); adornmentInfo1.ShowLabel = true; ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo(); adornmentInfo2.ShowLabel = true; ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo(); adornmentInfo3.ShowLabel = true; series1.XBindingPath = "Year"; series1.YBindingPath = "IND"; series1.ItemsSource = viewModel.power; series1.EnableAnimation = true; adornmentInfo1.LabelTemplate = template1; series1.AdornmentsInfo = adornmentInfo1; series1.ShowTooltip = true; series1.Label = "India"; series2.XBindingPath = "Year"; series2.YBindingPath = "GER"; series2.ItemsSource = viewModel.power; series2.EnableAnimation = true; adornmentInfo2.LabelTemplate = template2; series2.AdornmentsInfo = adornmentInfo2; series2.ShowTooltip = true; series2.Label = "Germany"; series3.XBindingPath = "Year"; series3.YBindingPath = "FRA"; series3.ItemsSource = viewModel.power; series3.EnableAnimation = true; adornmentInfo3.LabelTemplate = template3; series3.AdornmentsInfo = adornmentInfo3; series3.ShowTooltip = true; series3.Label = "France"; Basic_Chart.Series.Clear(); Basic_Chart.PrimaryAxis.ZoomFactor = 1; Basic_Chart.SecondaryAxis.ZoomFactor = 1; Basic_Chart.Series.Add(series1); Basic_Chart.Series.Add(series2); Basic_Chart.Series.Add(series3); } else if (comboBox.SelectedIndex == 2) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Visible; (SplineRangeArea_Chart.Series[0] as AdornmentSeries).AdornmentsInfo = new ChartAdornmentInfo() { AdornmentsPosition = AdornmentsPosition.TopAndBottom, Symbol = ChartSymbol.Ellipse, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, ShowLabel = true, LabelTemplate = this.MainGrid.Resources["splineRangeAreaAdornment"] as DataTemplate }; } else if (comboBox.SelectedIndex == 3 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Visible; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; } else if (comboBox.SelectedIndex == 4) { Basic_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Collapsed; Histogram_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Visible; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; } else if (comboBox.SelectedIndex == 5 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Visible; Scatter_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; } else if (comboBox.SelectedIndex == 6 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Visible; Column_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; Basic_Chart.PrimaryAxis = this.primaryAxis; Basic_Chart.SecondaryAxis = this.secondaryAxis; Basic_Chart.Legend = this.legend; Basic_Chart.Header = this.header; StepLineSeries series1 = new StepLineSeries(); StepLineSeries series2 = new StepLineSeries(); StepLineSeries series3 = new StepLineSeries(); DataTemplate template1 = MainGrid.Resources["labelTemplate1"] as DataTemplate; DataTemplate template2 = MainGrid.Resources["labelTemplate2"] as DataTemplate; DataTemplate template3 = MainGrid.Resources["labelTemplate3"] as DataTemplate; ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo(); adornmentInfo1.ShowLabel = true; ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo(); adornmentInfo2.ShowLabel = true; ChartAdornmentInfo adornmentInfo3 = new ChartAdornmentInfo(); adornmentInfo3.ShowLabel = true; series1.XBindingPath = "Year"; series1.YBindingPath = "IND"; series1.ShowTooltip = true; series1.ItemsSource = viewModel.power; adornmentInfo1.LabelTemplate = template1; series1.AdornmentsInfo = adornmentInfo1; series1.Label = "India"; series2.XBindingPath = "Year"; series2.YBindingPath = "GER"; series2.ItemsSource = viewModel.power; series2.ShowTooltip = true; adornmentInfo2.LabelTemplate = template2; series2.AdornmentsInfo = adornmentInfo2; series2.Label = "Germany"; series3.XBindingPath = "Year"; series3.YBindingPath = "FRA"; series3.ItemsSource = viewModel.power; series3.ShowTooltip = true; adornmentInfo3.LabelTemplate = template3; series3.AdornmentsInfo = adornmentInfo3; series3.Label = "France"; Basic_Chart.Series.Clear(); Basic_Chart.PrimaryAxis.ZoomFactor = 1; Basic_Chart.SecondaryAxis.ZoomFactor = 1; Basic_Chart.Series.Add(series1); Basic_Chart.Series.Add(series2); Basic_Chart.Series.Add(series3); } else if (comboBox.SelectedIndex == 7 && viewModel != null) { Histogram_Chart.Visibility = Visibility.Collapsed; Basic_Chart.Visibility = Visibility.Visible; Column_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; Basic_Chart.PrimaryAxis = this.primaryAxis; Basic_Chart.SecondaryAxis = this.secondaryAxis; Basic_Chart.Legend = this.legend; Basic_Chart.Header = this.header; StepAreaSeries series1 = new StepAreaSeries(); StepAreaSeries series2 = new StepAreaSeries(); DataTemplate template1 = MainGrid.Resources["labelTemplateStepArea"] as DataTemplate; DataTemplate template2 = MainGrid.Resources["labelTemplateStepArea1"] as DataTemplate; ChartAdornmentInfo adornmentInfo1 = new ChartAdornmentInfo { ShowLabel = true, LabelTemplate = template1, }; ChartAdornmentInfo adornmentInfo2 = new ChartAdornmentInfo { ShowLabel = true, LabelTemplate = template2, }; series1.AdornmentsInfo = adornmentInfo1; adornmentInfo1.SymbolInterior = new SolidColorBrush(Color.FromArgb(255, 51, 102, 204)); series1.XBindingPath = "Year"; series1.YBindingPath = "AUS"; series1.Label = "Australia"; series1.ItemsSource = viewModel.power; series1.StrokeThickness = 2; series1.Stroke = new SolidColorBrush(Color.FromArgb(255, 27, 161, 226)); series1.Interior = new SolidColorBrush(Color.FromArgb(120, 27, 161, 226)); series1.ShowTooltip = true; series2.AdornmentsInfo = adornmentInfo2; adornmentInfo1.SymbolInterior = new SolidColorBrush(Color.FromArgb(255, 73, 70, 133)); series2.XBindingPath = "Year"; series2.YBindingPath = "UK"; series2.Label = "UK"; series2.ItemsSource = viewModel.power; series2.StrokeThickness = 2; series2.Stroke = new SolidColorBrush(Color.FromArgb(250, 47, 180, 170)); series2.Interior = new SolidColorBrush(Color.FromArgb(200, 47, 180, 170)); series2.ShowTooltip = true; Basic_Chart.Series.Clear(); Basic_Chart.PrimaryAxis.ZoomFactor = 1; Basic_Chart.SecondaryAxis.ZoomFactor = 1; Basic_Chart.Series.Add(series1); Basic_Chart.Series.Add(series2); } else if (comboBox.SelectedIndex == 8) { Basic_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Collapsed; Histogram_Chart.Visibility = Visibility.Visible; boxWhiskerChart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Collapsed; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; } else { Basic_Chart.Visibility = Visibility.Collapsed; Scatter_Chart.Visibility = Visibility.Collapsed; Column_Chart.Visibility = Visibility.Collapsed; Histogram_Chart.Visibility = Visibility.Collapsed; boxWhiskerChart.Visibility = Visibility.Collapsed; Waterfall_Chart.Visibility = Visibility.Visible; SplineRangeArea_Chart.Visibility = Visibility.Collapsed; } }