public NationalityChartPage() { var natLabel = new Label() { Text = "Nationality Ranges:", TextColor = Color.LightGray }; var nationalityChart = new ChartView() { VerticalOptions = LayoutOptions.FillAndExpand, }; nationalityChart.SetBinding(ChartView.ChartProperty, "NationalitiesChart"); var natPointLabel = new Label() { Text = "Nationality Point Ranges:", TextColor = Color.LightGray }; var nationalityPointChart = new ChartView() { VerticalOptions = LayoutOptions.FillAndExpand, }; nationalityPointChart.SetBinding(ChartView.ChartProperty, "NationalitiesPointChart"); Content = new StackLayout() { Padding = 10, Children = { natLabel, nationalityChart, natPointLabel, nationalityPointChart } }; }
ChartView createChartView() { var radarChartView = new ChartView { HeightRequest = _chartHeight }; radarChartView.SetBinding( ChartView.ChartProperty, "ChartEntries", converter: new DoubleListToRadarChartConverter()); return(radarChartView); }
public ChartsPage() { this.Title = "Charts"; this.ToolbarItems.Add(new ToolbarItem("More", null, () => { Navigation.PushNonAwaited <NationalitySelectionPage>(); }) { AutomationId = "More" }); var ageLabel = new Label() { Text = "Age Ranges:", TextColor = Color.LightGray }; var ageChart = new ChartView() { VerticalOptions = LayoutOptions.FillAndExpand, Margin = 10 }; ageChart.SetBinding(ChartView.ChartProperty, "AgeChart"); var genderLabel = new Label() { Text = "Gender Ratio:", TextColor = Color.LightGray }; var genderChart = new ChartView() { VerticalOptions = LayoutOptions.FillAndExpand, Margin = 10 }; genderChart.SetBinding(ChartView.ChartProperty, "GenderChart"); var nationalitiesChart = new ChartView(); nationalitiesChart.SetBinding(ChartView.ChartProperty, "NationalitiesChart"); Content = new StackLayout() { Padding = 20, Children = { ageLabel, ageChart, genderLabel, genderChart } }; }
private void BuildPage() { #region absoluteLayout absoluteLayout = new AbsoluteLayout(); PageBuilder.BuildPageBasics(absoluteLayout, this); PageBuilder.AddHeaderImages(absoluteLayout); PageBuilder.AddLabel(absoluteLayout, "Sleep", 0.09, 0.10, Globals.LightTextColor, "", 0); PageBuilder.AddReturnButton(absoluteLayout); #endregion #region previousButton ImageButton previousBtn = new ImageButton { Source = "arrow_left.png", BackgroundColor = Color.Transparent }; AbsoluteLayout.SetLayoutFlags(previousBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(previousBtn, new Rectangle(0.3, 0.175, 0.1, 0.1)); previousBtn.Clicked += Globals.SleepPageViewModel.PreviousDayBtnClick; absoluteLayout.Children.Add(previousBtn); #endregion #region nextButton ImageButton nextBtn = new ImageButton { Source = "arrow_right.png", BackgroundColor = Color.Transparent }; nextBtn.Clicked += Globals.SleepPageViewModel.NextDayBtnClick; AbsoluteLayout.SetLayoutFlags(nextBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(nextBtn, new Rectangle(0.7, 0.175, 0.1, 0.1)); absoluteLayout.Children.Add(nextBtn); #endregion #region chart logic CurrentDayLabel = PageBuilder.AddLabel(absoluteLayout, "Today", 0.5, 0.19, Color.Black, "", 0); CurrentDayLabel.FontSize = 16; BoxView awakeRectangle = new BoxView { Color = Color.FromHex(Globals.SleepPageViewModel.AwakeColor) }; AbsoluteLayout.SetLayoutFlags(awakeRectangle, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(awakeRectangle, new Rectangle(0.1, 0.3, 20, 20)); absoluteLayout.Children.Add(awakeRectangle); PageBuilder.AddLabel(absoluteLayout, "Awake", 0.2, 0.3, Color.Black, "", 14); BoxView lightRectangle = new BoxView { Color = Color.FromHex(Globals.SleepPageViewModel.LightColor) }; AbsoluteLayout.SetLayoutFlags(lightRectangle, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(lightRectangle, new Rectangle(0.37, 0.3, 20, 20)); absoluteLayout.Children.Add(lightRectangle); PageBuilder.AddLabel(absoluteLayout, "Light sleep", 0.53, 0.3, Color.Black, "", 14); BoxView deepRectangle = new BoxView { Color = Color.FromHex(Globals.SleepPageViewModel.DeepColor) }; AbsoluteLayout.SetLayoutFlags(deepRectangle, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(deepRectangle, new Rectangle(0.7, 0.3, 20, 20)); absoluteLayout.Children.Add(deepRectangle); PageBuilder.AddLabel(absoluteLayout, "Deep sleep", 0.92, 0.3, Color.Black, "", 14); ChartView chart = new ChartView(); chart.SetBinding(ChartView.ChartProperty, "Chart"); AbsoluteLayout.SetLayoutFlags(chart, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(chart, new Rectangle(0.5, 0.48, 0.9, 0.26)); absoluteLayout.Children.Add(chart); #endregion PageBuilder.AddActivityIndicator(absoluteLayout, "IsLoading", 0.50, 0.51, 50, 50, AbsoluteLayoutFlags.PositionProportional, Globals.LightTextColor); #region dayButtons //Add hour labels int starthour = 20; for (int i = starthour; i <= 36; i += 2) { int hour = i; if (i > 24) { hour = i - 24; } PageBuilder.AddLabel(absoluteLayout, hour.ToString(), 0.022 + 0.059 * (i - starthour), 0.65, Color.Black, "", 17); } AddDayButtons(); #endregion #region RFbutton Grid grid = new Grid(); Frame frame = new Frame { CornerRadius = 10, BorderColor = Color.White, BackgroundColor = Globals.SecondaryColor, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HasShadow = true }; grid.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }) }); grid.Opacity = 20; AbsoluteLayout.SetLayoutBounds(grid, new Rectangle(0.15, 0.95, Globals.ScreenHeight / 100 * 10, Globals.ScreenHeight / 100 * 6)); AbsoluteLayout.SetLayoutFlags(grid, AbsoluteLayoutFlags.PositionProportional); ImageButton refreshButton = new ImageButton { Source = "Refresh.png", HorizontalOptions = LayoutOptions.Start, HeightRequest = Globals.ScreenHeight / 100 * 4.5, BackgroundColor = Color.Transparent, Margin = new Thickness(2, 0, 0, 0), }; refreshButton.Clicked += RefreshButtonClicked; grid.Children.Add(frame); grid.Children.Add(refreshButton); Label refreshLabel = new Label { Text = "Data", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End, FontSize = 15, FontAttributes = FontAttributes.Italic, Margin = new Thickness(0, 0, 2, 0) }; grid.Children.Add(refreshLabel); refreshLabel.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }), }); absoluteLayout.Children.Add(grid); #endregion }
private void BuildPage() { #region absoluteLayout absoluteLayout = new AbsoluteLayout(); PageBuilder.BuildPageBasics(absoluteLayout, this); PageBuilder.AddHeaderImages(absoluteLayout); PageBuilder.AddLabel(absoluteLayout, "Heartrate", 0.05, 0.10, Globals.LightTextColor, "", 0); PageBuilder.AddReturnButton(absoluteLayout); #endregion #region previousButton ImageButton previousBtn = new ImageButton { Source = "arrow_left.png", BackgroundColor = Color.Transparent }; AbsoluteLayout.SetLayoutFlags(previousBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(previousBtn, new Rectangle(0.3, 0.135, 0.1, 0.1)); previousBtn.SetBinding(Button.CommandProperty, new Binding() { Path = "PreviousDayBinding" }); previousBtn.Clicked += Globals.HeartratePageViewModel.PreviousDayBtnClick; absoluteLayout.Children.Add(previousBtn); #endregion #region nextButton ImageButton nextBtn = new ImageButton { Source = "arrow_right.png", BackgroundColor = Color.Transparent }; AbsoluteLayout.SetLayoutFlags(nextBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(nextBtn, new Rectangle(0.7, 0.135, 0.1, 0.1)); nextBtn.Clicked += Globals.HeartratePageViewModel.NextDayBtnClick; absoluteLayout.Children.Add(nextBtn); #endregion #region chart & labels PageBuilder.AddLabel(absoluteLayout, "", 0.5, 0.20, Color.Black, "DayLabelText", 12); ChartView chart = new ChartView { BackgroundColor = Globals.PrimaryColor }; //chart.Chart.BackgroundColor = Globals.PrimaryColor.ToSKColor(); chart.SetBinding(ChartView.ChartProperty, "Chart"); AbsoluteLayout.SetLayoutBounds(chart, new Rectangle(0.5, 0.4, 0.95, 0.35)); AbsoluteLayout.SetLayoutFlags(chart, AbsoluteLayoutFlags.All); absoluteLayout.Children.Add(chart); PageBuilder.AddLabel(absoluteLayout, "", 0.5, 0.65, Color.Black, "AverageLabelText", 16); PageBuilder.AddLabel(absoluteLayout, "", 0.5, 0.70, Color.Black, "PeakHeartrateText", 16); #endregion #region heartrateinterval selector Image heartonlyImage2 = new Image { Source = "HeartOnlyTransparent.png" }; AbsoluteLayout.SetLayoutFlags(heartonlyImage2, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(heartonlyImage2, new Rectangle(0.05, 0.85, 40, 40)); absoluteLayout.Children.Add(heartonlyImage2); PageBuilder.AddLabel(absoluteLayout, "Interval:", 0.22, 0.84, Color.Black, "", 13); _intervaldefaultButton = PageBuilder.AddButton(absoluteLayout, "1", OnIntervalLabelClicked, 0.50, 0.85, 40, 40, 25, 0, AbsoluteLayoutFlags.PositionProportional, Globals.SecondaryColor); _intervaldefaultButton.BorderWidth = 1; _intervaldefaultButton.BorderColor = Color.White; _interval5Button = PageBuilder.AddButton(absoluteLayout, "5", OnIntervalLabelClicked, 0.65, 0.85, 40, 40, 25, 0, AbsoluteLayoutFlags.PositionProportional, Globals.SecondaryColor); _interval5Button.BorderWidth = 1; _interval5Button.BorderColor = Color.Black; _interval10Button = PageBuilder.AddButton(absoluteLayout, "10", OnIntervalLabelClicked, 0.80, 0.85, 40, 40, 25, 0, AbsoluteLayoutFlags.PositionProportional, Globals.SecondaryColor); _interval10Button.BorderWidth = 1; _interval10Button.BorderColor = Color.White; _interval15Button = PageBuilder.AddButton(absoluteLayout, "15", OnIntervalLabelClicked, 0.95, 0.85, 40, 40, 25, 0, AbsoluteLayoutFlags.PositionProportional, Globals.SecondaryColor); _interval15Button.BorderWidth = 1; _interval15Button.BorderColor = Color.White; #endregion #region RFbutton Grid grid = new Grid(); Frame frame = new Frame { CornerRadius = 10, BorderColor = Color.White, BackgroundColor = Globals.SecondaryColor, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HasShadow = true }; grid.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }) }); grid.Opacity = 20; AbsoluteLayout.SetLayoutBounds(grid, new Rectangle(0.15, 0.95, Globals.ScreenHeight / 100 * 10, Globals.ScreenHeight / 100 * 6)); AbsoluteLayout.SetLayoutFlags(grid, AbsoluteLayoutFlags.PositionProportional); ImageButton refreshButton = new ImageButton { Source = "Refresh.png", HorizontalOptions = LayoutOptions.Start, HeightRequest = Globals.ScreenHeight / 100 * 4.5, BackgroundColor = Color.Transparent, Margin = new Thickness(2, 0, 0, 0), }; refreshButton.Clicked += RefreshButtonClicked; grid.Children.Add(frame); grid.Children.Add(refreshButton); var refreshLabel = new Label { Text = "Data", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End, FontSize = 15, FontAttributes = FontAttributes.Italic, Margin = new Thickness(0, 0, 2, 0) }; grid.Children.Add(refreshLabel); refreshLabel.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }), }); absoluteLayout.Children.Add(grid); #endregion }
private void BuildPage() { #region absoluteLayout absoluteLayout = new AbsoluteLayout(); PageBuilder.BuildPageBasics(absoluteLayout, this); PageBuilder.AddHeaderImages(absoluteLayout); PageBuilder.AddLabel(absoluteLayout, "Steps", 0.10, 0.10, Globals.LightTextColor, "", 0); PageBuilder.AddReturnButton(absoluteLayout); #endregion #region previousButton ImageButton previousBtn = new ImageButton { Source = "arrow_left.png", BackgroundColor = Color.Transparent }; AbsoluteLayout.SetLayoutFlags(previousBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(previousBtn, new Rectangle(0.3, 0.135, 0.1, 0.1)); previousBtn.Clicked += Globals.StepsPageViewModel.PreviousDayBtnClick; absoluteLayout.Children.Add(previousBtn); #endregion #region nextButton ImageButton nextBtn = new ImageButton { Source = "arrow_right.png", BackgroundColor = Color.Transparent }; AbsoluteLayout.SetLayoutFlags(nextBtn, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(nextBtn, new Rectangle(0.7, 0.135, 0.1, 0.1)); nextBtn.Clicked += Globals.StepsPageViewModel.NextDayBtnClick; absoluteLayout.Children.Add(nextBtn); #endregion #region default labels CurrentDayLabel = PageBuilder.AddLabel(absoluteLayout, "Today", 0.5, 0.16, Color.Black, "", 15); CurrentStepsLabel = PageBuilder.AddLabel(absoluteLayout, "0", 0.5, 0.37, Color.Black, "", 0); CurrentStepsLabel.SetBinding(Label.TextProperty, new Binding("StepsLabelText")); CurrentStepsLabel.FontSize = 40; var label = PageBuilder.AddLabel(absoluteLayout, "STEPS", 0.5, 0.45, Color.Black, "", 0); label.FontSize = 20; #endregion #region chart with labels ChartView chart = new ChartView { Rotation = 180 }; chart.SetBinding(ChartView.ChartProperty, "Chart"); AbsoluteLayout.SetLayoutFlags(chart, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(chart, new Rectangle(0.5, 0.25, 0.60, 0.60)); absoluteLayout.Children.Add(chart); CaloriesLabel = PageBuilder.AddLabel(absoluteLayout, "0 Calories", 0.5, 0.65, Color.Black, "", 0); CaloriesLabel.FontSize = 20; KilometersLabel = PageBuilder.AddLabel(absoluteLayout, "0 Kilometers", 0.5, 0.73, Color.Black, "", 0); KilometersLabel.FontSize = 20; AddDayButtons(); #endregion #region RFbutton Grid grid = new Grid(); Frame frame = new Frame { CornerRadius = 10, BorderColor = Color.White, BackgroundColor = Globals.SecondaryColor, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HasShadow = true }; grid.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }) }); grid.Opacity = 20; AbsoluteLayout.SetLayoutBounds(grid, new Rectangle(0.15, 0.95, Globals.ScreenHeight / 100 * 10, Globals.ScreenHeight / 100 * 6)); AbsoluteLayout.SetLayoutFlags(grid, AbsoluteLayoutFlags.PositionProportional); ImageButton refreshButton = new ImageButton { Source = "Refresh.png", HorizontalOptions = LayoutOptions.Start, HeightRequest = Globals.ScreenHeight / 100 * 4.5, BackgroundColor = Color.Transparent, Margin = new Thickness(2, 0, 0, 0), }; refreshButton.Clicked += RefreshButtonClicked; grid.Children.Add(frame); grid.Children.Add(refreshButton); Label refreshLabel = new Label { Text = "Data", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End, FontSize = 15, FontAttributes = FontAttributes.Italic, Margin = new Thickness(0, 0, 2, 0) }; grid.Children.Add(refreshLabel); refreshLabel.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(execute: () => { RefreshButtonClicked(this, EventArgs.Empty); }), }); absoluteLayout.Children.Add(grid); #endregion }
public HistoryPage() { BindingContext = new HistoryViewModel(Navigation); Title = "Audience History"; this.ToolbarItems.Add( new ToolbarItem("Settings", null, () => OpenSettings()) { Icon = "folder.png" } // TODO Change icon to show settings / config ); var filterSummary = new TextCell() { IsEnabled = false }; filterSummary.SetBinding(TextCell.TextProperty, new Binding("FilterSummary")); var genderChartView = new ChartView(); genderChartView.BackgroundColor = Color.Transparent; genderChartView.HeightRequest = 200; genderChartView.SetBinding(ChartView.ChartProperty, new Binding("GenderChart")); var agesChartView = new ChartView(); agesChartView.HeightRequest = 200; agesChartView.SetBinding(ChartView.ChartProperty, new Binding("AgeChart")); Content = new TableView { HasUnevenRows = true, Root = new TableRoot { new TableSection("Filter") { filterSummary }, new TableSection("Audience Makeup") { new CustomViewCell(genderChartView) { IsEnabled = false }, new LinkViewCell("Male Audience") { StyleId = DisclosureTypes.Disclosure }, new LinkViewCell("Female Audience") { StyleId = DisclosureTypes.Disclosure } }, new TableSection("Ages") { new CustomViewCell(agesChartView) { IsEnabled = false } } }, Intent = TableIntent.Settings }; }