public DiaryPart(List <FoodBundle> bundles) { if (bundles == null) { throw new NullReferenceException("List FoodBundle is null"); } if (bundles.Count == 0) { throw new Exception("List FoodBundle is count equal 0"); } var entries = new Entry[bundles.Count]; int i = 0; foreach (var item in bundles) { entries[i] = new Entry(item.Value) { Color = item.Color, }; i++; } Chart = new DonutChart() { Entries = entries, BackgroundColor = new SkiaSharp.SKColor(0, 0, 0, 1) }; }
protected virtual void BuildChart(List <Coin> assets) { var whiteColor = SKColor.Parse("#ffffff"); List <ChartEntry> entries = new List <ChartEntry>(); var colors = Coin.GetAvailableAssets(); foreach (var item in assets) { entries.Add(new ChartEntry((float)item.DollarValue) { TextColor = whiteColor, ValueLabel = item.Name, Color = SKColor.Parse(colors.First(x => x.Symbol == item.Symbol).HexColor), //assign color to this property ValueLabelColor = SKColor.Parse(colors.First(x => x.Symbol == item.Symbol).HexColor) }); } var chart = new DonutChart { Entries = entries }; chart.BackgroundColor = whiteColor; chart.HoleRadius = 0.65f; PortfolioView = chart; }
public ChartingViewModel(List <TaskStatistic> statistics, DateTime startTime, DateTime finishtime) { StartDay = startTime; FinishDay = finishtime; _statistics = statistics; WeeklyPointChart = new PointChart() { IsAnimated = true, BackgroundColor = SkiaSharp.SKColors.Transparent, Margin = 0, }; TaskDonutChart = new DonutChart() { IsAnimated = true, BackgroundColor = SkiaSharp.SKColors.Transparent, Margin = 0, }; //Previous = new Command( // execute: async () => // { // PreviousTimeInterval(); // }); //Next = new Command( // execute: async () => // { // NextTimeInterval(); // }); UpdateCharts(); }
private void SetChart() { cellClicked.HoldStrength = GameModel.CellsInView[cellClicked.ID].HoldStrength; List <Entry> entries = new List <Entry> { new Entry(GameModel.maxHoldStrength - cellClicked.HoldStrength) { Color = SKColor.Parse("#ffffff"), Label = "Remaining", ValueLabel = (GameModel.maxHoldStrength - cellClicked.HoldStrength).ToString() }, new Entry(cellClicked.HoldStrength) { Color = SKColor.Parse(ColorCode.BrightHexColorCode(cellClicked.TeamID)), Label = "Hold Strength", ValueLabel = cellClicked.HoldStrength.ToString() }, }; DonutChart chart = new DonutChart() { Entries = entries, HoleRadius = 0.6f, BackgroundColor = SKColor.Parse("#202020") }; donutChart.Chart = chart; }
private void LoadResources() { this.LoadingMessageHUD = "Loading..."; this.IsLoadingHUD = true; this.AppLogic.LoadRandomUsers().ContinueWith((result) => { this.IsLoadingHUD = false; var response = result.Result; if (response.Error == null) { Users = AppLogic.ObservableRandomUsers; GenderChart = new DonutChart() { Entries = AppLogic.GetUsersByGender() }; AgeChart = new BarChart() { Entries = AppLogic.GetUsersByAgeGroup() }; Nationalities = AppLogic.GetUniqueNationalities().ToObservableCollection(); } else { DialogPrompt.ShowMessage(new Prompt() { Title = "Error", Message = response.Error.Message }); } }); }
/// <summary> /// When overridden, allows application developers to customize behavior immediately prior to the /// <see cref="T:Xamarin.Forms.Page" /> becoming visible. /// </summary> /// <remarks>To be added.</remarks> protected override void OnAppearing() { base.OnAppearing(); var entries = new[] { new Entry(80) { Color = SKColor.Parse("#482d86") }, new Entry(8) { Color = SKColor.Parse("#cc2084") }, new Entry(8) { Color = SKColor.Parse("#f28f25") }, new Entry(4) { Color = SKColor.Parse("#26921d") } }; var donutView = new DonutChart { MaxValue = 100f, MinValue = 0f, Entries = entries, HoleRadius = 0.3f, BackgroundColor = SKColor.Empty }; }
private void SetupChart() { var entries = new[] { new Entry(60) { Label = "Done", ValueLabel = "60", Color = SKColor.Parse("#005800"), }, new Entry(40) { Label = "Lost", ValueLabel = "40", Color = SKColor.Parse("#8B0000") } }; var chart = new DonutChart() { Entries = entries, BackgroundColor = SKColors.Transparent, LabelTextSize = 50 }; _chartView.Chart = chart; }
private async Task PollValuesAsync() { await Task.Delay(500); try { List <Consume> cosumes = cosumeService.GetConsumes(); var entries = cosumes.Select(x => new Microcharts.Entry((float)x.Amount) { Label = ChartHelper.ToWord(x.DataType), ValueLabel = x.Amount.ToString(), Color = ChartHelper.GetRandomColor(), //TODO 隨機顏色或 改成指定顏色 } ); var _chart = new DonutChart(); _chart.Entries = entries; _chart.LabelTextSize = 40; //文字大小 this.Chart = _chart; OnPropertyChanged(nameof(Chart)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private async Task PollValuesAsync() { await Task.Delay(500); try { List <Consume> cosumes = cosumeService.GetConsumes(); var entries = cosumes.Select(x => new Microcharts.Entry((float)x.Amount) { Label = ChartHelper.ToWord(x.DataType), ValueLabel = x.Amount.ToString(), Color = ChartHelper.GetRandomColor(), //TODO 隨機顏色或 改成指定顏色 Icon = deviceService.GetImgFromFile(x.DataType) // } ); var _chart = new DonutChart(); _chart.Entries = entries; _chart.LabelTextSize = 40; //文字大小 this.Chart = _chart; var list = cosumes.Select(x => new ConsumViewModel() { Id = x.Id, DataType = x.DataType, Amount = x.Amount }).ToList(); this.DataList = new ObservableCollection <ConsumViewModel>(list); OnPropertyChanged(nameof(Chart)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void ShowCharts() { Chart chart = null; foreach (var item in Dashboards) { switch (item.Type) { case EChartType.BarChart: chart = new BarChart { Entries = GetEntries(item) }; break; case EChartType.PointChart: chart = new PointChart { Entries = GetEntries(item) }; break; case EChartType.LineChart: chart = new LineChart { Entries = GetEntries(item) }; break; case EChartType.DonutChart: chart = new DonutChart { Entries = GetEntries(item) }; break; case EChartType.RadialGaugeChart: chart = new RadialGaugeChart { Entries = GetEntries(item) }; break; case EChartType.RadarChart: chart = new RadarChart { Entries = GetEntries(item) }; break; default: break; } if (chart == null) { continue; } var chartView = new Microcharts.Forms.ChartView { HeightRequest = 140, BackgroundColor = Color.White }; chartView.Chart = chart; lsCharts.Children.Add(chartView); } }
public TextAnalyticsDTO() { CreateDate = DateTime.Now; CreateDateString = DateTime.Now.ToString(); Color = "#FF6119"; DataChart = new DonutChart(); }
protected override void OnAppearing() { var Taken_Nos = db.GetTracksTakenNos(); var Missed_Nos = db.GetTracksMissedNo(); //var myObservableCollectiontaken = new ObservableCollection<Track>(Taken); var entries = new[] { new Microcharts.Entry(Taken_Nos) { Label = "Taken", ValueLabel = "" + Taken_Nos, Color = SKColor.Parse("#266489") }, new Microcharts.Entry(Missed_Nos) { Label = "Missed", ValueLabel = "" + Missed_Nos, Color = SKColor.Parse("#FF1493") } }; var chart = new DonutChart() { Entries = entries }; chartView.Chart = chart; }
public async void ChartAbsBySex() { ApiService apiService = new ApiService(); var Sex1 = await apiService.GetAbsBySexAsync(1); var Sex2 = await apiService.GetAbsBySexAsync(2); var entries1 = new[] { new Entry(Sex1.Taux) { Label = Sex1.Sex, ValueLabel = $"{Sex1.Taux.ToString()} %", Color = SKColor.Parse("#2c3e50") }, new Entry(Sex2.Taux) { Label = Sex2.Sex, ValueLabel = $"{Sex2.Taux.ToString()} %", Color = SKColor.Parse("#77d065") } }; var chart1 = new DonutChart() { Entries = entries1, LabelTextSize = 35, HoleRadius = 0.5f }; chartView1.Chart = chart1; }
protected override void OnAppearing() { base.OnAppearing(); var client = new RestClient("https://covid-19-data.p.rapidapi.com/totals?format=undefined"); var request = new RestRequest(Method.GET); request.AddHeader("x-rapidapi-host", "covid-19-data.p.rapidapi.com"); request.AddHeader("x-rapidapi-key", "54c7eaa2camsh3bfb99864b4ad3ep111186jsn385646837c47"); IRestResponse response = client.Execute(request); var cData = JsonConvert.DeserializeObject <System.Collections.Generic.List <CoronavirusInfoData> >(response.Content); CoronavirusInfoData coronavirusDataInfoData = new CoronavirusInfoData(cData[0].confirmed, cData[0].recovered, cData[0].deaths); coronavirusDataWorldWide.Add(coronavirusDataInfoData); var entries = new[] { new Microcharts.Entry(float.Parse(cData[0].confirmed.ToString())) { Label = "Confirmed", ValueLabel = cData[0].confirmed.ToString(), Color = SKColor.Parse("#FFFF00") }, new Microcharts.Entry(float.Parse(cData[0].recovered.ToString())) { Label = "Recovered", ValueLabel = cData[0].recovered.ToString(), Color = SKColor.Parse("#7cfc00") }, new Microcharts.Entry(float.Parse(cData[0].deaths.ToString())) { Label = "Deaths", ValueLabel = cData[0].deaths.ToString(), Color = SKColor.Parse("#FF0000") } }; var chart = new DonutChart() { Entries = entries }; chartView.Chart = chart; chartView.Chart.BackgroundColor = SKColor.Parse("#00FFFFFF"); //confirmedLabel.Text = cData[0].confirmed; //recoveredLabel.Text = cData[0].recovered; //deathsLabel.Text = cData[0].deaths; confirmedLabel.Text = Convert.ToDouble(cData[0].confirmed).ToString("N0"); recoveredLabel.Text = Convert.ToDouble(cData[0].recovered).ToString("N0"); deathsLabel.Text = Convert.ToDouble(cData[0].deaths).ToString("N0"); }
private async void spinner_ItemSelectedAsync(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; period = spinner.GetItemAtPosition(e.Position).ToString(); var allData = await DataService.GetMoneyCommon(period); textall.Text = allData.Money_paid.ToString(); textlo.Text = allData.Money_lost.ToString(); var listDrink = await DataService.GetMoneyDrink(period); var entries = new List <Entry>(); var entries2 = new List <Entry>(); var Colors = new List <string>(); Colors.Add("#266489"); Colors.Add("#68B9C0"); Colors.Add("#F80202"); Colors.Add("#FAD101"); Colors.Add("#BEF781"); Colors.Add("#848484"); Colors.Add("#0174DF"); Colors.Add("#B45F04"); int a = 0; foreach (Moneys r in listDrink) { Entry es = new Entry((float)r.Money_paid) { Label = r.Drink, ValueLabel = Math.Round(r.Money_paid, 2).ToString() + " EUR", Color = SKColor.Parse(Colors.ElementAt(a)) }; entries.Add(es); Entry es2 = new Entry((float)r.Money_lost) { Label = r.Drink, ValueLabel = Math.Round(r.Money_lost, 2).ToString() + " EUR", Color = SKColor.Parse(Colors.ElementAt(a)) }; a++; entries2.Add(es2); } var chart = new DonutChart() { Entries = entries }; var chart2 = new DonutChart() { Entries = entries2 }; var chartView3 = FindViewById <ChartView>(Resource.Id.chartView3); var chartView4 = FindViewById <ChartView>(Resource.Id.chartView4); chartView3.Chart = chart; chartView4.Chart = chart2; }
private void Generate() { List <Microcharts.Entry> entries = new List <Microcharts.Entry>(); for (int i = 0; i < rand.Next(3, 8); i++) { var res = rand.Next(10, 401); entries.Add(new Microcharts.Entry(res) { Label = i.ToString(), ValueLabel = res.ToString(), Color = SkiaSharp.SKColor.Parse(GetRandomColour()) }); } int choice = rand.Next(5); switch (choice) { case 0: ChartView = new PointChart() { Entries = entries }; break; case 1: ChartView = new BarChart() { Entries = entries }; break; case 2: ChartView = new DonutChart() { Entries = entries }; break; case 3: ChartView = new RadialGaugeChart() { Entries = entries }; break; case 4: ChartView = new LineChart() { Entries = entries }; break; } MessagingCenter.Send(ChartView, "NewChartAvaliable"); }
public CastDetailsViewModel() { BarChart = new BarChart(); CircleChart = new DonutChart() { LabelTextSize = 14 }; GoToProfileCommand = new Xamarin.Forms.Command(async() => await GoToImdbProfile()); GoHomePageCommand = new Xamarin.Forms.Command(async() => await GoToMainPage()); }
public async void reportYear() { DateTime dates = DateTime.Now.Date; var lista = await App.Database.GetUserAsync(); int fi = lista.Where(x => x.Rate == 5 && x.date.Year == dates.Year).Count(); int fo = lista.Where(x => x.Rate == 4 && x.date.Year == dates.Year).Count(); int thr = lista.Where(x => x.Rate == 3 && x.date.Year == dates.Year).Count(); int tw = lista.Where(x => x.Rate == 2 && x.date.Year == dates.Year).Count(); int one = lista.Where(x => x.Rate == 1 && x.date.Year == dates.Year).Count(); var entries = new[] { new Entry(one) { Label = "1", ValueLabel = one.ToString(), Color = SKColor.Parse("#B22222") }, new Entry(tw) { Label = "2", ValueLabel = tw.ToString(), Color = SKColor.Parse("#FFA500") }, new Entry(thr) { Label = "3", ValueLabel = thr.ToString(), Color = SKColor.Parse("#FF4500") }, new Entry(fo) { Label = "4", ValueLabel = fo.ToString(), Color = SKColor.Parse("#A5B358") }, new Entry(fi) { Label = "5", ValueLabel = fi.ToString(), Color = SKColor.Parse("#008000") } }; var chart = new DonutChart() { Entries = entries }; this.ychart.Chart = chart; this.ychart.Chart.LabelTextSize = 30; }
private Task GenerateChartActivitiesImputationVsDeviation(Models.Timesheet timesheet) { return(Task.Run(() => { var entries = _dashBoardModule.ChartService.GenerateChartActivitiesImputationVsDeviation(timesheet); ChartImputedVsDeviation = new DonutChart() { LabelTextSize = Device.Idiom == TargetIdiom.Tablet? 30:25, Entries = entries }; ChartImputedVsDeviationIsVisible = entries != null && entries.Sum(x => x.Value) > 0 ? true : false; })); }
private void SetDonutChart() { Device.BeginInvokeOnMainThread(() => { ChartData = new DonutChart() { Entries = Entries, AnimationDuration = AnimationTime, IsAnimated = true, BackgroundColor = ChartBackgroundColor }; }); }
protected override void OnAppearing() { base.OnAppearing(); var chart = new DonutChart() { Entries = entries }; chart.LabelTextSize = diagramTextSize; chart.HoleRadius = 0.4f; this.chartView.Chart = chart; }
public AdministratorViewModel(IProductItemDataStore productItemDataStore) { _ProductDataStore = productItemDataStore; //GetPhotoCommand = new Command() NewItem = new ProductItem(); Data = new List <Entry>(); StoreItems = new ObservableCollection <ProductItem>(); StoreItems = GetData(); Entry TotalAvailable = new Entry(ItemsAvailble(StoreItems)) { Color = SkiaSharp.SKColor.Parse("#313d4e"), Label = "Available:" + ItemsAvailble(StoreItems).ToString(), }; Data.Add(TotalAvailable); Entry TotalItems = new Entry(StoreItems.Count) { Color = SkiaSharp.SKColor.Parse("#49D19D"), Label = "Total" + StoreItems.Count.ToString(), }; Data.Add(TotalItems); InventoryChart = new DonutChart() { Entries = Data, LabelTextSize = 50 }; SalesData = GetSalesData(); SalesChart = new PointChart() { Entries = SalesData, }; OrdersItems = new ObservableCollection <Order>(); OrdersItems = GetOrders(); DoneCommand = new Command(async() => await GoAdminHome()); AddCommand = new Command(async() => await AddItem()); UpdateCommand = new Command(async() => await UpdateItem()); }
public Datachart() { InitializeComponent(); var entries = new[] { new Entry(212) { Label = "Azzouz", ValueLabel = "212", Color = SKColor.Parse("#2c3e50") }, new Entry(248) { Label = "Achraf", ValueLabel = "248", Color = SKColor.Parse("#77d065") }, new Entry(514) { Label = "Daly", ValueLabel = "514", Color = SKColor.Parse("#3498db") } }; var chart1 = new BarChart() { Entries = entries }; this.chart.Chart = chart1; //this.chartView.Chart = chart; var chart12 = new RadialGaugeChart() { Entries = entries }; this.chart1.Chart = chart12; var chart13 = new DonutChart() { Entries = entries }; this.chart2.Chart = chart13; }
public AssetsAndLiabilities() { InitializeComponent(); var chart = new DonutChart() { //LabelMode = LabelMode.LeftAndRight, LabelTextSize = 50f, // here Entries = entries }; this.chartView.Chart = chart; this.chartView.HeightRequest = Application.Current.MainPage.Height * 0.4; this.chartView.WidthRequest = Application.Current.MainPage.Width * 0.9; }
private void CreateStatusBarIcon() { var grip = (Control)FindControl(Application.Current.MainWindow, o => (o as Control)?.Name == "ResizeGripControl"); var statusbar = (DockPanel)VisualTreeHelper.GetParent(grip); List <ChartConfig> chartConfigs = CreateChartConfigs(); chart = new DonutChart(); chart.Name = "TimeTrackerStatusBarChart"; chart.Padding = new Thickness(0, 2.5, 0, 1); chart.Stroke = new SolidColorBrush(Color.FromRgb(40, 40, 40)); chart.StrokeThickness = 1; chart.InnerRadiusPercentage = 0.4; chart.MinWidth = chart.MinHeight = statusbar.ActualHeight; chart.MaxWidth = chart.MaxHeight = statusbar.ActualHeight; chart.Width = chart.Height = statusbar.ActualHeight; chart.SnapsToDevicePixels = true; chart.Series = CreateChartSeries(chartConfigs); UpdateChartColors(chartConfigs); UpdateChartValues(chartConfigs); DockPanel.SetDock(chart, Dock.Right); statusbar.Children.Insert(1, chart); var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(5); timer.Tick += (s, a) => { VSStateTimes times = UpdateChartValues(chartConfigs); long total = (times?.ElapsedMs.Sum(e => e.Value) ?? 0) / 1000; total = Math.Min(Math.Max(total / 30, 3), 60 * 5); timer.Interval = TimeSpan.FromSeconds(total); }; timer.Start(); timers.Add(timer); //Debug.WriteLine("*************"); //DebugElement(statusbar, ""); //Debug.WriteLine("*************"); //DebugElement(Application.Current.MainWindow, ""); }
public ActionResult SchedulesCircle() { List <Gallery> galleires = caller.ListOfAllGalleries(); foreach (var item in galleires) { item.schedule = caller.ListOfAllSchedules(item.id); } List <schedule> schedules = new List <schedule>(); List <DonutChart> stat = new List <DonutChart>(); DonutChart donut = new DonutChart(); DonutChart donut2 = new DonutChart(); DonutChart donut3 = new DonutChart(); foreach (var item in galleires) { foreach (var tmp in item.schedule) { schedules.Add(tmp); } } //Holiday,Event,Renovations,Other donut.value = schedules.Count(s => s.type == "Holiday"); donut.label = "Holiday"; donut2.value = schedules.Count(s => s.type == "Event"); donut2.label = "Event"; donut3.value = schedules.Count(s => s.type == "Renovations"); donut3.label = "Renovations"; donut3.value = schedules.Count(s => s.type == "Other"); donut3.label = "Other"; stat.Add(donut); stat.Add(donut2); stat.Add(donut3); JavaScriptSerializer jss = new JavaScriptSerializer(); string output = jss.Serialize(stat); string demo = output.Replace("\"", ""); ViewBag.dot = demo; return(View(stat)); }
private async void spinner_ItemSelectedAsync(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; period = spinner.GetItemAtPosition(e.Position).ToString(); var listDrinks = await DataService.GetTopDrinks(period); var listDrinks2 = await DataService.GetTopDrinks2(period); var entries = new List <Entry>(); listDrink.Adapter = new TopDrinksAdapter(this, listDrinks2); var Colors = new List <string>(); Colors.Add("#266489"); Colors.Add("#68B9C0"); Colors.Add("#F80202"); Colors.Add("#FAD101"); Colors.Add("#BEF781"); Colors.Add("#848484"); Colors.Add("#0174DF"); Colors.Add("#B45F04"); int a = 0; foreach (Restaurant r in listDrinks) { Entry es = new Entry((float)r.Sum) { Label = r.Drink, ValueLabel = r.Sum.ToString() + " ml", Color = SKColor.Parse(Colors.ElementAt(a)) }; a++; entries.Add(es); } var chart = new DonutChart() { Entries = entries }; var chartView = FindViewById <ChartView>(Resource.Id.chartView); chartView.Chart = chart; }
private void CreateCharts() { var entries = new List <McEntry>() { new McEntry(17) { Label = "MH: World Small Monsters", Color = SKColor.Parse("#008e34"), }, new McEntry(34) { Label = "MH: World Large Monsters", Color = SKColor.Parse("#003489"), }, new McEntry(34) { Label = "MH: Generations Small Monsters", Color = SKColor.Parse("#e004a5"), }, new McEntry(74) { Label = "MH: Generations Large Monsters", Color = SKColor.Parse("#04e0b4"), } }; var barChart = new BarChart() { Entries = entries }; var donutChart = new DonutChart() { Entries = entries }; var radialChart = new RadialGaugeChart() { Entries = entries }; BarChart.Chart = barChart; DonutChart.Chart = donutChart; RadialChart.Chart = radialChart; }
public MainPageViewModel() { PredictedLabel = "Init."; mMedia = new MediaPlayerElement(); var entries = new[] { new ChartEntry(212) { Label = "What will it be? :(", ValueLabel = "212", Color = SKColor.Parse("#2c3e50") } }; AggChart = new DonutChart() { Entries = entries, IsAnimated = true, AnimationDuration = TimeSpan.FromSeconds(2) }; }
public Chart GetChart(T viewModel, int chartIndex, bool fullSize = false) { Chart _chart = null; List <Entry> entries = new List <Entry>(); List <ChartDataGroup> _chartGroups = new List <ChartDataGroup>(); foreach (var _group in viewModel.ChartDataPack.Charts) { _chartGroups.Add(_group); } ChartDataGroup _selectedGroup = _chartGroups[chartIndex]; switch (_selectedGroup.ChartDisplayType) { case ChartType.Bar: _chart = new BarChart(); break; case ChartType.Line: _chart = new LineChart(); break; case ChartType.Pie: _chart = new DonutChart(); break; } foreach (var item in _selectedGroup.ChartDataItems) { // For now, we'll use a random color SKColor color = ChartUtility.Instance.GetColor(); if (fullSize) { entries.Add(EntryUtility.GetEntry(item.FltValue, color, item.Label, item.ValueLabel)); } else { entries.Add(EntryUtility.GetEntry(item.FltValue, color)); } } _chart.Entries = entries.ToArray(); return(_chart); }