コード例 #1
0
        public async Task Load(string courseCode)
        {
            var result = await _studentController.GetAttendance(Global.CurrentStudent.Id, courseCode);

            Dictionary <string, List <Attendance> > res = new Dictionary <string, List <Attendance> >();

            foreach (var attendance in result)
            {
                if (!res.ContainsKey(attendance.Date.Month.ToString()))
                {
                    res[attendance.Date.Month.ToString()] = new List <Attendance>();
                }

                res[attendance.Date.Month.ToString()].Add(attendance);
            }

            var l = new ObservableCollection <DashboardContentView.AttendanceModel>();

            foreach (var re in res.Keys)
            {
                var da = new DashboardContentView.AttendanceModel(re, res[re].Count(x => x.Present));
                l.Add(da);
            }

            l = new ObservableCollection <DashboardContentView.AttendanceModel>(l.OrderByDescending(i => Convert.ToInt16(i.Month)));

            var marker = new ChartDataMarker()
            {
                LabelStyle = new DataMarkerLabelStyle()
                {
                    LabelPosition = DataMarkerLabelPosition.Inner
                }
            };

            ChartVisual.Series.Add(new ColumnSeries()
            {
                ItemsSource       = l,
                DataMarker        = marker,
                XBindingPath      = "Month",
                YBindingPath      = "Target",
                Label             = "Hello",
                Width             = 100,
                EnableAnimation   = true,
                AnimationDuration = 1,
                Spacing           = 0.5,
            });
            CpbPresent.Progress = (result.Count(x => x.Present) * 100) / result.Count;
        }
コード例 #2
0
        public DashboardContentView()
        {
            InitializeComponent();
            BindingContext     = this;
            _studentController = new StudentController();
            return;

            Data = new ObservableCollection <AttendanceModel>()
            {
                new AttendanceModel("Jan", 50),
                new AttendanceModel("Feb", 70),
                new AttendanceModel("Mar", 65),
                new AttendanceModel("Apr", 57),
                new AttendanceModel("May", 48),
            };
            var marker = new ChartDataMarker()
            {
                LabelStyle = new DataMarkerLabelStyle()
                {
                    LabelPosition = DataMarkerLabelPosition.Inner
                }
            };

            ChartAttendance.Series.Add(new ColumnSeries()
            {
                ItemsSource = Data, XBindingPath = "Month", YBindingPath = "Target", Label = "Hello", Width = 100, EnableAnimation = true, AnimationDuration = 1, DataMarker = marker
            });
            ChartAttendance.Series.Add(new ColumnSeries()
            {
                ItemsSource = Data, XBindingPath = "Month", YBindingPath = "Target", Label = "HelloWorld", EnableAnimation = true, AnimationDuration = 1, DataMarker = marker
            });
            ChartAttendance.Series.Add(new ColumnSeries()
            {
                ItemsSource = Data, XBindingPath = "Month", YBindingPath = "Target", Label = "HelloS", EnableAnimation = true, AnimationDuration = 1, DataMarker = marker
            });
            ChartAttendance.Series.Add(new ColumnSeries()
            {
                ItemsSource = Data, XBindingPath = "Month", YBindingPath = "Target", EnableAnimation = true, AnimationDuration = 1, DataMarker = marker
            });
        }
コード例 #3
0
        public async Task LoadEverything()
        {
            var result = await _studentController.GetStudentSemesters(CurrentStudent.Id);

            LblGpa.Text = result.Average(x => x.Gpa).ToString();

            var courses = await _studentController.GetCourses(CurrentStudent.Id);

            var atts = new Dictionary <string, List <Attendance> >();

            foreach (var course in courses)
            {
                var attendance = await _studentController.GetAttendance(CurrentStudent.Id, course.Course.Code);

                foreach (var att in attendance)
                {
                    if (!atts.ContainsKey(att.Date.Month.ToString()))
                    {
                        atts[att.Date.Month.ToString()] = new List <Attendance>();
                    }

                    atts[att.Date.Month.ToString()].Add(att);
                }

                var data = new ObservableCollection <DashboardContentView.AttendanceModel>();

                foreach (var re in atts.Keys)
                {
                    var da = new AttendanceModel(re, atts[re].Count(x => x.Present));
                    data.Add(da);
                }

                data = new ObservableCollection <DashboardContentView.AttendanceModel>(
                    data.OrderBy(i => Convert.ToInt16(i.Month)));


                var marker = new ChartDataMarker()
                {
                    LabelStyle = new DataMarkerLabelStyle()
                    {
                        LabelPosition = DataMarkerLabelPosition.Inner
                    }
                };

                ChartAttendance.Series.Add(new ColumnSeries()
                {
                    ItemsSource       = data,
                    DataMarker        = marker,
                    XBindingPath      = "Month",
                    YBindingPath      = "Target",
                    Label             = course.Course.Name,
                    EnableAnimation   = true,
                    AnimationDuration = 1
                });
            }

            var results = await _studentController.GetStudentSemesters(CurrentStudent.Id);

            foreach (var semester in results)
            {
                var resultsData = new ObservableCollection <AttendanceModel>();
                resultsData.Add(new AttendanceModel(semester.Title.Split('#')[1], semester.Gpa));
                var markerResult = new ChartDataMarker()
                {
                    LabelStyle = new DataMarkerLabelStyle()
                    {
                        LabelPosition = DataMarkerLabelPosition.Inner
                    }
                };


                ChartResults.Series.Add(new ColumnSeries()
                {
                    ItemsSource       = resultsData,
                    DataMarker        = markerResult,
                    XBindingPath      = "Month",
                    YBindingPath      = "Target",
                    Label             = semester.Title,
                    EnableAnimation   = true,
                    AnimationDuration = 1,
                    Spacing           = 0.1
                });
            }
        }
コード例 #4
0
		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;
			chart.Series.Add (col_bars);

			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 region
			Picker p_list_region = new Picker
			{
				Title = menu_labels_[3],
				VerticalOptions = LayoutOptions.StartAndExpand
			};

			String [] regionNameList = {"Callao", "Ica", "Ancash", "La Libertad", "Piura"};
			foreach (string regionName in regionNameList)
			{
				p_list_region.Items.Add(regionName);
			}
			p_list_region.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_region
						}
					},
					chart
				}
			};
			return main_layout;
		}
コード例 #5
0
		private async void GetChart()
		{

			SfChart chart = new SfChart(){ Legend = new ChartLegend(){
					DockPosition = LegendPlacement.Bottom
				} };
			chart.Legend.LabelStyle.Font = Font.SystemFontOfSize(GlobalParameters.LEGEND_TEXT_SIZE_SERIES_, FontAttributes.None);

			chart.PrimaryAxis = new CategoryAxis() { LabelPlacement = LabelPlacement.BetweenTicks };
			chart.SecondaryAxis = new NumericalAxis();

			ChartDataMarker dataMarker = new ChartDataMarker() { ShowLabel = true };
			dataMarker.LabelStyle.Font = Font.SystemFontOfSize(11);
			dataMarker.LabelStyle.BackgroundColor = Color.White;
			dataMarker.LabelStyle.TextColor = Color.Black;
			chart.ChartBehaviors.Add(new ChartZoomPanBehavior(){ EnablePanning = true, EnableZooming = true}) ;

			col_bars_ = new ColumnSeries () {
				Label = "Puerto",
				ItemsSource = GetEmptyData(),
				DataMarkerPosition = Syncfusion.SfChart.XForms.DataMarkerPosition.Top,
			};

			//Appearance
			col_bars_.ColorModel.Palette = ChartColorPalette.Custom;
			col_bars_.ColorModel.CustomBrushes = GlobalParameters.COLORS_GRAPHIC03;

			col_bars_.DataMarker = dataMarker;
			col_bars_.EnableDataPointSelection = true;

			chart.Series.Add (col_bars_);

			chart.VerticalOptions = LayoutOptions.FillAndExpand;
			chart.HorizontalOptions = LayoutOptions.FillAndExpand;


			////////////// Picker#
			/// 
			/// Picker Period
			p_list_period_ = new Picker
			{
				Title = menu_labels_[2],
				VerticalOptions = LayoutOptions.StartAndExpand,
				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 region
			p_list_region_ = new Picker
			{
				Title = menu_labels_[3],
				VerticalOptions = LayoutOptions.StartAndExpand,
				Scale = GlobalParameters.SCALE_PICKER,
				WidthRequest = GlobalParameters.WIDTH_PICKER_REGION
			};
					


			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();
					*/
					if(first_time_loading_zones == false)  {
						LoadZones();
					}
					first_time_loading_zones = false;
				}
			};

			p_list_zone_.SelectedIndexChanged +=  (sender, args) => {
				if ( p_list_zone_.SelectedIndex == -1 ){
					col_bars_.ItemsSource = GetEmptyData();
				}else{
					if(first_time_loading_periods == false)  {
						LoadPeriodos( false );
					}
					first_time_loading_periods = false;
				}
			};

			p_list_period_.SelectedIndexChanged += ( sender, args) => {
				if (p_list_period_.SelectedIndex == -1) {
					col_bars_.ItemsSource = GetEmptyData();
				} else {
					if (first_time_loading_regions == false){
						LoadRegions (false);
					}
					first_time_loading_regions = false;
				}
			};

			p_list_region_.SelectedIndexChanged += ( sender, args) => {
				if (p_list_region_.SelectedIndex == -1) {
					col_bars_.ItemsSource = GetEmptyData();
				} else {
					LoadAllGrafico03 (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 = 0,
						VerticalOptions = LayoutOptions.Start,
						HorizontalOptions = LayoutOptions.FillAndExpand,
						Orientation = StackOrientation.Horizontal,
						Children = {
							new Label(){
								FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_,
								Text = menu_labels_[3],
								VerticalOptions = LayoutOptions.Center
							},
							p_list_region_
						}
					},
					chart
				}
			};
			main_page_ = main_layout;

			if (first_time_loading_years == false) {
				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;
			}
			first_time_loading_years = false;

			chart.SelectionChanged += (object sender, ChartSelectionEventArgs csea) => {
				ShowGra04PescaPlantaBarWithData( csea.SelectedDataPointIndex );
			};
		}
コード例 #6
0
        private void SetOverallDescription()
        {
            UpdateOverallScore();
            borderFrame.BindingContext = Ot;
            StackLayout score = new StackLayout()
            {
                VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center
            };
            Label scoreLabel = new Label()
            {
                TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 12f, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center
            };
            Binding b = new Binding("OverallAll");

            b.StringFormat = "{0}%";
            scoreLabel.SetBinding(Label.TextProperty, b);
            score.Children.Add(scoreLabel);
            borderFrame.Content = score;
            borderFrame.SetBinding(Frame.BackgroundColorProperty, new Binding("OverallColor"));
            borderFrame.Parent = overallScore;


            StackLayout Holder = new StackLayout();

            chart = new SfChart()
            {
                SideBySideSeriesPlacement = false, HeightRequest = 150, BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.StartAndExpand, WidthRequest = Application.Current.MainPage.Width
            };
            //Initializing Primary Axis

            chart.SideBySideSeriesPlacement = false;
            CategoryAxis primaryAxis = new CategoryAxis()
            {
                LabelStyle = new ChartAxisLabelStyle()
                {
                    TextColor = Color.White, LabelAlignment = ChartAxisLabelAlignment.Center, LabelsPosition = AxisElementPosition.Outside, WrappedLabelAlignment = ChartAxisLabelAlignment.Center
                }, OpposedPosition = false
            };

            //Initializing Secondary Axis
            NumericalAxis secondaryAxis = new NumericalAxis()
            {
                Minimum = 0, Maximum = 119, Interval = 20, RangePadding = NumericalPadding.None, LabelStyle = new ChartAxisLabelStyle()
                {
                    TextColor = Color.White
                }, IsInversed = false
            };

            chart.SecondaryAxis  = secondaryAxis;
            chart.PrimaryAxis    = primaryAxis;
            chart.BindingContext = Ot;
            BarSeries series2 = new BarSeries()
            {
                XBindingPath = "Description",
                YBindingPath = "WeightPercent"
            };

            series2.SetBinding(ChartSeries.ItemsSourceProperty, new Binding("CatsOverall"));
            series2.ColorModel        = ColorModel;
            series2.StrokeWidth       = 0.3;
            series2.EnableAnimation   = true;
            series2.AnimationDuration = 0.8;
            ChartDataMarker cDm = new ChartDataMarker();

            cDm.LabelTemplate = new DataTemplate(() =>
            {
                StackLayout layout = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, Spacing = 0
                };
                Label l1 = new Label()
                {
                    TextColor = Color.White, FontSize = 10f
                };
                l1.SetBinding(Label.TextProperty, new Binding("WeightPercent", stringFormat: "{0}"));
                Label l2 = new Label()
                {
                    TextColor = Color.White, FontSize = 10f
                };
                l2.SetBinding(Label.TextProperty, new Binding("Weight", stringFormat: "/{0}"));
                layout.Children.Add(l1);
                layout.Children.Add(l2);
                return(layout);
            });
            cDm.LabelStyle.TextColor = Color.White;
            series2.DataMarker       = cDm;

            BarSeries series1 = new BarSeries()
            {
                XBindingPath = "Description",
                YBindingPath = "Weight",
            };

            series1.SetBinding(ChartSeries.ItemsSourceProperty, new Binding("CatsOverall"));
            series1.StrokeColor       = Color.White;
            series1.StrokeWidth       = 0.3;
            series1.EnableAnimation   = true;
            series1.AnimationDuration = 0.8;
            series1.Color             = Color.Transparent;

            series1.ListenPropertyChange = true;
            series2.ListenPropertyChange = true;

            chart.Series.Add(series2);
            chart.Series.Add(series1);

            chart.PrimaryAxis.ShowMajorGridLines   = false;
            chart.SecondaryAxis.ShowMajorGridLines = false;
            chart.SecondaryAxis.ShowMinorGridLines = false;

            Holder.Children.Add(chart);
            CategoryHolder.Children.Add(Holder);
        }
コード例 #7
0
        private void InitilizeChart()
        {
            SfChart chart = new SfChart();

            ChartDataMarker chartDataMarker = new ChartDataMarker {
                LabelContent = LabelContent.Percentage,
                LabelStyle   = new DataMarkerLabelStyle {
                    BackgroundColor = Color.Transparent,
                    Margin          = new Thickness(5),
                    TextColor       = Color.FromHex("#B3B3B3"),
                    LabelPosition   = DataMarkerLabelPosition.Outer
                }
            };

            DoughnutSeries doughnutSeries = new DoughnutSeries()
            {
                ItemsSource         = _viewModel.ChartData,
                XBindingPath        = "Name",
                YBindingPath        = "Value",
                DoughnutCoefficient = 0.7,
                DataMarker          = chartDataMarker,
                DataMarkerPosition  = CircularSeriesDataMarkerPosition.Outside
            };

            List <Color> colors = GetColorPalette();

            doughnutSeries.ColorModel.Palette       = ChartColorPalette.Custom;
            doughnutSeries.ColorModel.CustomBrushes = colors;
            chart.Series.Add(doughnutSeries);

            chart.HorizontalOptions = LayoutOptions.Center;
            chart.VerticalOptions   = LayoutOptions.Center;

            ChartGrid.Children.Add(chart);

            StackLayout MiddleStack = new StackLayout()
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.White,
            };

            Label MiddleText0 = new Label()
            {
                Text              = "100%",
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.Center,
                FontAttributes    = FontAttributes.Bold,
                BackgroundColor   = Color.White
            };

            Label MiddleText1 = new Label()
            {
                Text              = "2,468.40",
                FontSize          = 25,
                HorizontalOptions = LayoutOptions.Center,
                FontAttributes    = FontAttributes.Bold
            };

            Label MiddleText2 = new Label()
            {
                Text              = "USD",
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.Center,
                FontAttributes    = FontAttributes.Bold
            };

            MiddleStack.Children.Add(MiddleText0);
            MiddleStack.Children.Add(MiddleText1);
            MiddleStack.Children.Add(MiddleText2);
            // MiddleStack.BackgroundColor = Color.Transparent;

            ChartGrid.Children.Add(MiddleStack);
        }
コード例 #8
0
		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;
		}
コード例 #9
0
		private async void GetChart()
		{

			SfChart chart = new SfChart(){ Legend = new ChartLegend(){
					DockPosition = LegendPlacement.Bottom
				} };
			chart.Legend.LabelStyle.Font = Font.SystemFontOfSize(GlobalParameters.LEGEND_TEXT_SIZE_SERIES_, FontAttributes.None);

			chart.PrimaryAxis = new CategoryAxis() { LabelPlacement = LabelPlacement.BetweenTicks };
			chart.SecondaryAxis = new NumericalAxis(){ LabelRotationAngle = 0, MaximumLabels =5  };

			ChartDataMarker dataMarker = new ChartDataMarker() { ShowLabel = true };
			dataMarker.LabelStyle.Font = Font.SystemFontOfSize(11);
			dataMarker.LabelStyle.BackgroundColor = Color.Transparent;
			dataMarker.LabelStyle.TextColor = Color.Black;
			dataMarker.LabelStyle.LabelPosition = DataMarkerLabelPosition.Auto;
			//dataMarker.LabelStyle.Angle = 90;
			chart.ChartBehaviors.Add(new ChartZoomPanBehavior(){ EnablePanning = true, EnableZooming = true}) ;

			chart.PrimaryAxis.LabelRotationAngle = 0;
			chart.PrimaryAxis.LabelStyle.Font = Font.SystemFontOfSize(7);
			row_bars_ = new BarSeries () {
				Label = "Descarga TM por grupos segùn % de avance",
				ItemsSource = GetEmptyData(),
				//DataMarkerPosition = Syncfusion.SfChart.XForms.DataMarkerPosition.Center,
			};

			//Appearance
			row_bars_.ColorModel.Palette = ChartColorPalette.Custom;
			row_bars_.ColorModel.CustomBrushes = GlobalParameters.COLORS_GRAPHIC08;

			row_bars_.DataMarker = dataMarker;
			row_bars_.EnableDataPointSelection = true;

			chart.Series.Add (row_bars_);

			chart.VerticalOptions = LayoutOptions.FillAndExpand;
			chart.HorizontalOptions = LayoutOptions.FillAndExpand;


			////////////// 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 rango
			p_list_rango_ = new Picker
			{
				Title = menu_labels_[3],
				VerticalOptions = LayoutOptions.StartAndExpand,
				Scale = GlobalParameters.SCALE_PICKER,
				WidthRequest = GlobalParameters.WIDTH_PICKER_RANGO
			};
			foreach (string rangoName in GlobalParameters.LIST_RANGO_PORCENTAGES)
			{
				p_list_rango_.Items.Add(rangoName);
			}
			p_list_rango_.SelectedIndex = -1;
			//////////


			p_list_year_.SelectedIndexChanged += (sender, args) =>
			{
				if (p_list_year_.SelectedIndex == -1){
					row_bars_.ItemsSource = GetEmptyData();
				}
				else
				{
					/*
					int num = p_list_year_.SelectedIndex;
					if (num == 0) row_bars_.ItemsSource = GetEmptyData()();
					else  row_bars_.ItemsSource = GetData2();
					*/
					if(first_time_loading_zones == false)  {
						LoadZones();
					}
					first_time_loading_zones = false;
				}
			};

			p_list_zone_.SelectedIndexChanged +=  (sender, args) => {
				if ( p_list_zone_.SelectedIndex == -1 ){
					row_bars_.ItemsSource = GetEmptyData();
				}else{
					if(first_time_loading_periods == false)  {
						LoadPeriodos( false );
					}
					first_time_loading_periods = false;
				}
			};

			p_list_period_.SelectedIndexChanged += ( sender, args) => {
				if (p_list_period_.SelectedIndex == -1) {
					row_bars_.ItemsSource = GetEmptyData();
				} else {
					if(first_time_loading_rangos == false)  {
						LoadAllGrafico08 (false);
					}
					first_time_loading_rangos = false;
				}
			};

			p_list_rango_.SelectedIndexChanged += ( sender, args) => {
				if (p_list_rango_.SelectedIndex == -1) {
					row_bars_.ItemsSource = GetEmptyData();
				} else {
					LoadAllGrafico08 (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 = 0,
						VerticalOptions = LayoutOptions.Start,
						HorizontalOptions = LayoutOptions.FillAndExpand,
						Orientation = StackOrientation.Horizontal,
						Children = {
							new Label(){
								FontSize = GlobalParameters.LABEL_TEXT_SIZE_15_,
								Text = menu_labels_[3],
								VerticalOptions = LayoutOptions.Center
							},
							p_list_rango_
						}
					},
					chart
				}
			};
			main_page_ = main_layout;

			if (first_time_loading_years == false) {
				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;
				p_list_rango_.SelectedIndex = 0;
			}
			first_time_loading_years = false;
		}
コード例 #10
0
		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;
		}