public async void createEntries(object sender, EventArgs e)
        {
            string content = await _client.GetStringAsync(MainCarouselPage.Url);



            List <Post> posts = JsonConvert.DeserializeObject <List <Post> >(content);

            _posts            = new ObservableCollection <Post>(posts);
            maxTempLabel.Text = _posts[0].Week;
            Random rnd = new Random();

            for (int i = 0; i < _posts.Count; i++)
            {
                float value = rnd.Next(-10, 40);
                //  float value = float.Parse(_posts[i].Average, CultureInfo.InvariantCulture.NumberFormat);
                Entry tmp = new Entry(value)
                {
                    ValueLabel = value.ToString(),
                    Color      = MopApp.ChartPage.getColorFromValue(value),
                };

                // tmp.Label = _posts[i].Name;

                entries.Add(tmp);
            }
        }
        public ForecastChart(RootObjectForecast root)
        {
            InitializeComponent();
            Title = "Forecast Chart";

            List <Entry> entries = new List <Entry>();

            foreach (var element in root.list)
            {
                float temperature = (float)element.main.temp;

                var entry = new Entry(temperature)
                {
                    Color      = SKColor.Parse("#FF1493"),
                    Label      = element.Date,
                    ValueLabel = temperature.ToString() + " ÂșC"
                };
                entries.Add(entry);
            }

            ForecastChartView.Chart = new LineChart
            {
                Entries       = entries,
                LineMode      = LineMode.Straight,
                LabelTextSize = 30f,
            };
        }
Example #3
0
        private void LoadEntriesP()
        {
            Entry e1 = new Entry(70)
            {
                Label      = "A",
                ValueLabel = "70",
                Color      = SKColor.Parse("#00bcd4")
            };
            Entry e2 = new Entry(300)
            {
                Label      = "B",
                ValueLabel = "300",
                Color      = SKColor.Parse("#F44336")
            };
            Entry e3 = new Entry(50)
            {
                Label      = "C",
                ValueLabel = "50",
                Color      = SKColor.Parse("#43A047")
            };
            Entry e4 = new Entry(500)
            {
                Label      = "D",
                ValueLabel = "500",
                Color      = SKColor.Parse("#F9A825")
            };

            entryListP.Add(e1);
            entryListP.Add(e2);
            entryListP.Add(e3);
            entryListP.Add(e4);
        }
        public Inventory()
        {
            InitializeComponent();

            aVM            = Startup.ServiceProvider.GetService <AdministratorViewModel>();
            BindingContext = aVM;
            Data           = new List <Entry>();

            Entry TotalAvailable = new Entry(ItemsAvailble(aVM.StoreItems.ToList()))
            {
                Color = SkiaSharp.SKColor.Parse("#313d4e"),
                Label = "Available:" + ItemsAvailble(aVM.StoreItems.ToList()).ToString(),
            };

            Entry TotalItems = new Entry(aVM.StoreItems.Count)
            {
                Color = SkiaSharp.SKColor.Parse("#49D19D"),
                Label = "Total" + aVM.StoreItems.Count.ToString(),
            };

            Data.Add(TotalAvailable);
            Data.Add(TotalItems);
            InventoryChart.Chart = new DonutChart()
            {
                Entries       = Data,
                LabelTextSize = 50
            };
        }
Example #5
0
        public async void CreateGraphic()
        {
            BpmManager manager = new BpmManager();
            IEnumerable <UserBpmResponse> response = await manager.SendBPM(App._id);

            List <Entry> entries = new List <Entry>();
            BpmManager   bpms    = new BpmManager();
            List <BPM>   lista;

            lista = new List <BPM>(await bpms.GetBPM());

            foreach (BPM a in lista)
            {
                Entry no = new Entry(a.VALUE_BPM);
                no.ValueLabel = a.VALUE_BPM.ToString();
                no.Color      = SKColor.Parse("#FF1943");
                no.Label      = a.DATE_BPM.ToString();
                entries.Add(no);
            }


            Grafico_BPM.Chart = new LineChart()
            {
                LabelTextSize = 15f, Entries = entries
            };
            Grafico_BPM.WidthRequest  = Application.Current.MainPage.Width;
            Grafico_BPM.HeightRequest = 200;
            Grafico_BPM.TranslationY  = Grafico_BPM.TranslationY + 220;
        }
        public void DisplayChart(int daycount, List <Entry> listEntry, int lable_index)
        {
            for (int i = 0; i < daycount; i++)
            {
                //capture the stock price in a temporary variable
                float price = float.Parse(GetData.dailyStockList[i].The2High);

                //print the ValueLable for chart just a few times
                if (i % lable_index == 0)
                {
                    e = new Entry(price)
                    {
                        Color      = SKColor.Parse("#3498db"),
                        Label      = "",
                        ValueLabel = GetData.dailyStockList[i].The2High,
                    };
                }
                else
                {
                    e = new Entry(price)
                    {
                        Color = SKColor.Parse("#3498db"),
                    };
                }
                listEntry.Add(e);
            }
        }
        private void RefreshRecordChart()
        {
            var entries = new List <Entry>();

            for (int i = 0; i < DayRecords.Count; i++)
            {
                var dayRecord = DayRecords[i];
                var date      = dayRecord.Date;

                var entry = new Entry((float)dayRecord.SuccessRate)
                {
                    Label      = $"{date.Month}/{date.Day},({CreateDateString.ConvertDayOfWeekToKorDayOfWeek(dayRecord.Date)})",
                    Color      = SkiaSharp.SKColor.Parse("#1565c0"),
                    ValueLabel = $"{string.Format("{0:0.##}", Math.Round(dayRecord.SuccessRate * 100))}%"
                };
                entries.Add(entry);
            }

            SuccessChart = new LineChart()
            {
                Entries               = entries,
                LabelTextSize         = DependencyService.Get <INativeFont>().GetNativeSize(LabelFontSize),
                LabelOrientation      = Orientation.Horizontal,
                ValueLabelOrientation = Orientation.Horizontal,
                LineMode              = LineMode.Spline,
                LineAreaAlpha         = 64,
                AnimationProgress     = 3f,
                AnimationDuration     = TimeSpan.FromSeconds(AnimationSec)
            };
        }
        public void DoInzynierki()
        {
            var          list         = new List <int>();
            var          DbProperties = (_connection.QueryAsync <int>("SELECT Value FROM Glukoza LIMIT 10", list).ConfigureAwait(false));
            List <Entry> entries      = new List <Entry>();

            foreach (var number in list)
            {
                string color;
                if (number < 99)
                {
                    color = "#1faece";
                }
                else
                {
                    color = "#F17A0A";
                }

                var newEntries = new Entry(number)
                {
                    Color      = SKColor.Parse(color),
                    ValueLabel = Convert.ToString(number),
                };
                entries.Add(newEntries);
            }

            myChart.Chart = new LineChart()
            {
                Entries           = entries,
                PointMode         = PointMode.Square,
                AnimationDuration = TimeSpan.FromSeconds(5)
            };
        }
Example #9
0
        void SearchItemPicker_SelectedIndexChanged(object sender, EventArgs e)
        {
            ToggleSearchBtn();
            SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext;
            // change colour of old entry
            Entry oldEntry = CurrentEntriesOnGraph.Where(p => p.Value == SGObj.SearchItemValue)
                             .FirstOrDefault();

            if (!(oldEntry is null))
            {
                oldEntry.Color = SKColor.Parse("#FF1493");
            }

            SGObj.SearchItemValue = searchItemPicker.SelectedIndex;
            Entry searchItemEntry = CurrentEntriesOnGraph.Where(p => p.Value == SGObj.SearchItemValue)
                                    .FirstOrDefault();

            int index = CurrentEntriesOnGraph.ToList().IndexOf(searchItemEntry);

            if (SGObj.SearchItemValue > 0)
            {
                CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse("#0000FF");
            }
            DisplayGraph(CurrentEntriesOnGraph);
        }
Example #10
0
        private void mostrarGrafico(List<modelos_aux.GraficaProductos> productos, List<modelos_aux.GraficaClientes> clientes)
        {
            _entriesProducto = null;
            _entriesProducto = new List<Microcharts.Entry>();
            foreach (var i in productos)
            {
                var pro = new Microcharts.Entry(i.Cantidad)
                {
                    Label = i.Producto,
                    ValueLabel = i.Cantidad.ToString(),
                    Color = SKColor.Parse("#00CC00")
                };
                _entriesProducto.Add(pro);
            }

            _entriesCliente = null;
            _entriesCliente = new List<Microcharts.Entry>();

            foreach (var j in clientes)
            {
                var clie = new Microcharts.Entry(j.Cantidad)
                {
                    Label = j.Cliente,
                    ValueLabel = j.Cantidad.ToString(),
                    Color = SKColor.Parse("#3399FF")
                };
                _entriesCliente.Add(clie);
            }

            GraficoProducto.Chart = new BarChart { Entries = _entriesProducto };
            GraficoCliente.Chart = new BarChart { Entries = _entriesCliente };
        }
Example #11
0
        ObservableCollection <Entry> GetSalesData()
        {
            ObservableCollection <Entry> entries = new ObservableCollection <Entry>();



            var d = new Entry(200)
            {
                Color      = SkiaSharp.SKColor.Parse("#313d4e"),
                Label      = DateTime.Today.ToString(),
                ValueLabel = "200"
            };
            var d1 = new Entry(500)
            {
                Color      = SkiaSharp.SKColor.Parse("#313d4e"),
                Label      = DateTime.Today.ToString(),
                ValueLabel = "500"
            };
            var d2 = new Entry(100)
            {
                Color      = SkiaSharp.SKColor.Parse("#313d4e"),
                Label      = DateTime.Today.ToString(),
                ValueLabel = "100"
            };

            entries.Add(d);
            entries.Add(d1);
            entries.Add(d2);
            return(entries);
        }
Example #12
0
        void AddChartData()
        {
            var data = ((DeviceDetailViewModel)this.BindingContext)?.Data;

            int count   = 0;
            var entries = new List <Microcharts.Entry>();

            foreach (var d in data)
            {
                var entry = new Microcharts.Entry((float)d.Acceleration)
                {
                    Color = SKColor.Parse("#266489") //0078D7
                };

                entries.Add(entry);
                if (count++ > 20)
                {
                    break;
                }
            }

            chartView.Chart = new LineChart()
            {
                Entries = entries
            };
        }
        async Task <Entry[]> GetCategoriesEntriesAsync(BudgetCategoriesViewModel vm, bool fullSize)
        {
            var context = vm.BudgetCategories;

            List <Entry> entries = new List <Entry>();

            var fltCatExpenseSum = (float)context.Where(c => c.CategoryType == BudgetCategoryType.Expense).Sum(c => c.Amount);
            var fltCatIncomeSum  = (float)context.Where(c => c.CategoryType == BudgetCategoryType.Income).Sum(c => c.Amount);

            Entry[] _entryArray;
            if (fullSize)
            {
                _entryArray = new Entry[]
                {
                    EntryUtility.GetEntry(fltCatExpenseSum, SKColors.Red, "Expenses", fltCatExpenseSum.ToString("C")),
                    EntryUtility.GetEntry(fltCatIncomeSum, SKColors.Green, "Income", fltCatIncomeSum.ToString("C"))
                };
            }
            else
            {
                _entryArray = new Entry[]
                {
                    EntryUtility.GetEntry(fltCatExpenseSum, SKColors.Red, "Expenses"),
                    EntryUtility.GetEntry(fltCatIncomeSum, SKColors.Green, "Income")
                };
            }

            var _entries = await BuildEntryCollectionAsync(_entryArray);

            entries.AddRange(_entries.ToList());

            return(entries.ToArray());
        }
        public async Task StartUpdateAsync()
        {
            List <Entry> temperatureEntries = new List <Entry>();

            List <Entry> waterLevelEntries = new List <Entry>();
            Entry        initialWaterLevel = ClimateMetricService.GetWaterTankLevelEntry(_cooltainerId);

            waterLevelEntries.Add(initialWaterLevel);

            var temperatureChartView = FindViewById <ChartView>(Resource.Id.temperatureChartView1);
            var humidityChartView    = FindViewById <ChartView>(Resource.Id.humidityChartView1);
            var co2ChartView         = FindViewById <ChartView>(Resource.Id.co2ChartView1);
            var pressureChartView    = FindViewById <ChartView>(Resource.Id.pressureChartView1);
            var waterLevelChartView  = FindViewById <ChartView>(Resource.Id.waterLevelChartView1);

            while (true)
            {
                UpdateTemperature(temperatureEntries, temperatureChartView);
                UpdateHumidity(humidityChartView);
                UpdateCo2(co2ChartView);
                UpdatePressure(pressureChartView);
                UpdateWaterLevel(waterLevelEntries, waterLevelChartView);

                await Task.Delay(1000);
            }
        }
        protected override async void OnAppearing()
        {
            string content = await _client.GetStringAsync(Url);

            List <Post> posts = JsonConvert.DeserializeObject <List <Post> >(content);

            _posts            = new ObservableCollection <Post>(posts);
            maxTempLabel.Text = _posts[0].AvgResult;
            Random rnd = new Random();

            // for (int i = 0; i < _posts.Count; i++)
            //{
            float value = rnd.Next(-10, 40);
            // float value = float.Parse(_posts[0].Average, CultureInfo.InvariantCulture.NumberFormat);
            Entry tmp = new Entry(value)
            {
                ValueLabel = value.ToString(),
                Color      = MopApp.ChartPage.getColorFromValue(value),
            };

            // tmp.Label = _posts[0].Name;

            entries.Add(tmp);
            // }
        }
Example #16
0
        public void MonthlyHiringsChartBuild()
        {
            var length       = 5;
            var res          = _container.GetProcesses();//.Where(r => r.Status == Domain.Model.Enum.ProcessStatus.Hired);
            var chartEntries = new List <Microcharts.Entry>();

            for (int i = length; i >= 0; i--)
            {
                var proc  = res.Count(r => r.HireDate.Year == DateTime.Now.AddMonths(-i).Year&& r.HireDate.Month == DateTime.Now.AddMonths(-i).Month);
                var entry = new Microcharts.Entry(proc)
                {
                    Label      = DateTime.Now.AddMonths(-i).ToString("MMMM", CultureInfo.CreateSpecificCulture("en")),
                    ValueLabel = proc.ToString(),
                    Color      = SKColor.Parse("#ff6666")
                };
                chartEntries.Add(entry);
            }

            var chart3 = new LineChart()
            {
                Entries = chartEntries.ToArray(), LabelTextSize = 35
            };

            this.chart3.Chart = chart3;
        }
Example #17
0
        public void GetDataChart()
        {
            List <Item>   ListItem  = Item.GetAll();
            List <string> ListColor = listHexColor();
            int           i         = 0;
            int           NumColor  = ListColor.Count;

            foreach (var item in ListItem)
            {
                int Percent = item.TotalImport - item.Remain;
                //Console.WriteLine("Name: " + item.Name);
                //Console.WriteLine("Import: " + item.TotalImport);
                //Console.WriteLine("Remain: " + item.Remain);
                //Console.WriteLine("Percen-------: {0}", x);
                //Console.WriteLine("Percen-------: {0}", x/y);
                //Console.WriteLine("Name: " + item.Name);
                string color = (i < NumColor) ? ListColor[i] : ListColor[0];
                i = (i < NumColor) ? i + 1 : 0;
                Entry et = new Entry(Percent)
                {
                    //Color = SKColor.Parse("#FF1493"),
                    Color      = SKColor.Parse(color),
                    ValueLabel = Percent.ToString(),
                    Label      = item.Name,
                };
                entries.Add(et);
            }
        }
Example #18
0
        public void DisplayChart(ObservableCollection <TemperatureData> Data, List <Entry> listEntry)
        {
            var count             = Data.Count;
            int label_value_index = count / 10;

            if (label_value_index <= 0)
            {
                label_value_index = 1;
            }
            for (int i = 0; i < count; i++)
            {
                float val = float.Parse(Data[i].Temperature.ToString());
                if (i % 6 == 0)
                {
                    e = new Entry(val)
                    {
                        Color      = SKColor.Parse("#3498db"),
                        Label      = "",
                        ValueLabel = val.ToString()
                    };
                }
                else
                {
                    e = new Entry(val)
                    {
                        Color = SKColor.Parse("#3498db")
                    };
                }
                listEntry.Add(e);
            }
        }
        private void DrawPointChart(List <TaskStatistic> Statistic)
        {
            var entries  = new List <Microcharts.Entry>();
            var DayGroup = Statistic.GroupBy(u => u.FinishedTime.Day).ToDictionary(x => x.Key, x => x.ToList());

            foreach (var group in DayGroup)
            {
                var value = group.Value.Count;
                var day   = group.Value[0].FinishedTime.Day;
                var entry = new Microcharts.Entry(value)
                {
                    Label      = group.Key.ToString(),
                    ValueLabel = value.ToString(),
                    Color      = SKColor.Parse(ColorPickService.NextReverse())
                };
                entries.Add(entry);
            }

            WeeklyPointChart = new Microcharts.PointChart()
            {
                IsAnimated            = false,
                LabelTextSize         = 25,
                LabelOrientation      = Orientation.Horizontal,
                ValueLabelOrientation = Orientation.Horizontal,
                PointSize             = 25,
                Entries         = entries,
                BackgroundColor = SkiaSharp.SKColors.Transparent,
                Margin          = 15,
            };
        }
Example #20
0
        private void RefreshRecordChart()
        {
            var entries = new List <Entry>();

            for (int i = 0; i < WeekRecords.Count; i++)
            {
                var weekRecord = WeekRecords[i];

                var startDate = weekRecord.StartDateOfWeek;
                var endDate   = startDate.AddDays(6);

                var entry = new Entry((float)weekRecord.SuccessRate)
                {
                    Label      = $"{startDate.Month}.{startDate.Day} ~ {endDate.Month}.{endDate.Day}",
                    Color      = SkiaSharp.SKColor.Parse("#1565c0"),
                    ValueLabel = $"{string.Format("{0:0.##}", Math.Round(weekRecord.SuccessRate * 100))}%"
                };
                entries.Add(entry);
            }

            SuccessChart = new BarChart()
            {
                Entries               = entries,
                LabelTextSize         = DependencyService.Get <INativeFont>().GetNativeSize(LabelFontSize),
                LabelOrientation      = Orientation.Horizontal,
                ValueLabelOrientation = Orientation.Horizontal,
                AnimationDuration     = TimeSpan.FromSeconds(AnimationSec)
            };
        }
        async Task <Entry[]> GetEntriesAsync(BankAccountViewModel vm, bool fullSize)
        {
            Entry[] _entries = new Entry[] { };

            _entries = await GetBankAccountEntriesAsync(vm, fullSize);

            return(await GetBankAccountEntriesAsync(vm, fullSize));
        }
Example #22
0
        private async void DisplayPricingData(string ticker)
        {
            List <double> priceslastyear = new List <double>();
            List <string> dateslastyear  = new List <string>();
            // Creating the connection object
            IAvapiConnection connection = AvapiConnection.Instance;
            IAvapiResponse_TIME_SERIES_MONTHLY_ADJUSTED m_time_series_monthly_adjustedResponse;

            // Set up the connection and pass the API_KEY provided by alphavantage.co
            connection.Connect("7NIMRBR8G8UB7P8C");

            // Get the TIME_SERIES_MONTHLY_ADJUSTED query object
            Int_TIME_SERIES_MONTHLY_ADJUSTED time_series_monthly_adjusted =
                connection.GetQueryObject_TIME_SERIES_MONTHLY_ADJUSTED();

            // Perform the TIME_SERIES_MONTHLY_ADJUSTED request and get the result
            m_time_series_monthly_adjustedResponse = await time_series_monthly_adjusted.QueryPrimitiveAsync(
                ticker);

            var data = m_time_series_monthly_adjustedResponse.Data;

            if (data.Error)
            {
                Console.WriteLine(data.ErrorMessage);
            }
            else
            {
                int counter = 0;
                foreach (var timeseries in data.TimeSeries)
                {
                    //Grab 1 year worth of months data
                    if (counter < 12)
                    {
                        //add raw prices and dates to arrays
                        priceslastyear.Add(double.Parse(timeseries.adjustedclose, CultureInfo.InvariantCulture.NumberFormat));
                        Debug.WriteLine(float.Parse(timeseries.adjustedclose, CultureInfo.InvariantCulture.NumberFormat));
                        Debug.WriteLine(timeseries.DateTime);
                        Microcharts.Entry tempEntry = new Microcharts.Entry(float.Parse(timeseries.adjustedclose, CultureInfo.InvariantCulture.NumberFormat))
                        {
                            Label      = timeseries.DateTime,
                            ValueLabel = timeseries.adjustedclose//Color = investmentList[i].color.ToSKColor()
                        };
                        entries.Add(tempEntry);
                    }
                    counter = counter + 1;
                }
            }
            var chart = new LineChart()
            {
                Entries = entries, LineMode = LineMode.Straight, LineSize = 8, PointSize = 18, LabelTextSize = 25
            };

            this.chartView.Chart = chart;
        }
        List <Entry> Inventory()
        {
            List <Analityc> dashboardData = new List <Analityc>()
            {
                new Analityc()
                {
                    Date  = DateTime.Now.AddDays(1),
                    Total = 20,
                },
                new Analityc()
                {
                    Date  = DateTime.Now.AddDays(2),
                    Total = 25,
                },
                new Analityc()
                {
                    Date  = DateTime.Now.AddDays(3),
                    Total = 50,
                },
                new Analityc()
                {
                    Date  = DateTime.Now.AddDays(4),
                    Total = 60,
                },
            };

            List <Entry> dataentries = new List <Entry>();



            float totalItems = dashboardData.Count;

            float totalavailable = (totalItems - 2) / totalItems;


            Entry Total = new Entry(totalItems)
            {
                Color      = SkiaSharp.SKColor.Parse("#313d4e"),
                Label      = "Total:" + totalItems.ToString(),
                ValueLabel = totalItems.ToString()
            };

            Entry Available = new Entry(totalavailable)
            {
                Color      = SkiaSharp.SKColor.Parse("#49D19D"),
                Label      = "Total Available:" + totalavailable.ToString(),
                ValueLabel = totalavailable.ToString()
            };

            dataentries.Add(Total);
            dataentries.Add(Available);

            return(dataentries);
        }
        private void UpdateTemperature(List <Entry> temperatureEntries, ChartView temperatureChartView)
        {
            Entry latestTemp = ClimateMetricService.GetTemperatureEntry(_cooltainerId);

            temperatureEntries.Add(latestTemp);

            TrimGraphToTimespan(temperatureEntries);
            temperatureChartView.Chart = new LineChart()
            {
                Entries = temperatureEntries
            };
        }
        //Entry[] GetEntries(EasyBudgetStatusViewModel vm, bool fullSize)
        //{
        //    Entry[] IncomeEntries = GetIncomeEntries(vm, fullSize);
        //    Entry[] ExpensesEntries = GetExpensesEntries(vm, fullSize);
        //    Entry[] _Entries = new Entry[IncomeEntries.Length + ExpensesEntries.Length];
        //    Array.Copy(IncomeEntries, _Entries, IncomeEntries.Length);
        //    Array.Copy(ExpensesEntries, 0, _Entries, IncomeEntries.Length, ExpensesEntries.Length);
        //    return _Entries;
        //}

        //Entry[] GetIncomeEntries(EasyBudgetStatusViewModel vm, bool fullSize)
        //{
        //    var context = vm;
        //    List<Entry> entries = new List<Entry>();
        //    var fltIncome = (float)context.vmCategories.BudgetCategories
        //                                  .Where(c => c.CategoryType == BudgetCategoryType.Income)
        //                                  .Sum(c => c.Amount);
        //    var fltIncomeActual = (float)context.vmAccounts.BankAccounts
        //                                        .Sum(bk => bk.AccountRegister
        //                                             .Where(ar => ar.ItemType == AccountRegisterItemViewModel.AccountItemType.Deposits)
        //                                             .Sum(d => d.ItemAmount));
        //    if (fullSize)
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltIncome, SKColors.LightGreen, "Budgeted", fltIncome.ToString("C")));
        //        entries.Add(EntryUtility.GetEntry(fltIncomeActual, SKColors.Green, "Actual", fltIncomeActual.ToString("C")));
        //    }
        //    else
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltIncome, SKColors.LightGreen, "Budgeted"));
        //        entries.Add(EntryUtility.GetEntry(fltIncomeActual, SKColors.Green, "Actual"));
        //    }
        //    return entries.ToArray();
        //}

        //Entry[] GetExpensesEntries(EasyBudgetStatusViewModel vm, bool fullSize)
        //{
        //    var context = vm;
        //    List<Entry> entries = new List<Entry>();
        //    var fltExpenses = (float)context.vmCategories.BudgetCategories
        //                                    .Where(c => c.CategoryType == Models.BudgetCategoryType.Expense)
        //                                    .Sum(c => c.Amount);
        //    var fltExpenseActual = (float)context.vmAccounts.BankAccounts
        //                                         .Sum(bk => bk.AccountRegister
        //                                              .Where(ar => ar.ItemType == AccountRegisterItemViewModel.AccountItemType.Withdrawals)
        //                                              .Sum(d => d.ItemAmount));
        //    if (fullSize)
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltExpenses, SKColors.Pink, "Budgeted", fltExpenses.ToString("C")));
        //        entries.Add(EntryUtility.GetEntry(fltExpenseActual, SKColors.Red, "Actual", fltExpenseActual.ToString("C")));
        //    }
        //    else
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltExpenses, SKColors.Pink, "Budgeted"));
        //        entries.Add(EntryUtility.GetEntry(fltExpenseActual, SKColors.Red, "Actual"));
        //    }
        //    return entries.ToArray();
        //}

        //Entry[] GetEntries(BudgetCategoriesViewModel vm, bool fullSize)
        //{
        //    return GetCategoriesEntries(vm, fullSize);
        //}

        //Entry[] GetCategoriesEntries(BudgetCategoriesViewModel vm, bool fullSize)
        //{
        //    var context = vm.BudgetCategories;
        //    List<Entry> entries = new List<Entry>();
        //    var fltCatExpenseSum = (float)context.Where(c => c.CategoryType == BudgetCategoryType.Expense).Sum(c => c.Amount);
        //    var fltCatIncomeSum = (float)context.Where(c => c.CategoryType == BudgetCategoryType.Income).Sum(c => c.Amount);
        //    if (fullSize)
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltCatExpenseSum, SKColors.Red, "Expenses", fltCatExpenseSum.ToString("C")));
        //        entries.Add(EntryUtility.GetEntry(fltCatIncomeSum, SKColors.Green, "Income", fltCatIncomeSum.ToString("C")));
        //    }
        //    else
        //    {
        //        entries.Add(EntryUtility.GetEntry(fltCatExpenseSum, SKColors.Red, "Expenses"));
        //        entries.Add(EntryUtility.GetEntry(fltCatIncomeSum, SKColors.Green, "Income"));
        //    }
        //    return entries.ToArray();
        //}

        //Entry[] GetEntries(BudgetCategoryViewModel vm, bool fullSize)
        //{
        //    return GetCategoryEntries(vm, fullSize);
        //}

        //Entry[] GetCategoryEntries(BudgetCategoryViewModel vm, bool fullSize)
        //{
        //    var context = vm.BudgetItems;
        //    List<Entry> entries = new List<Entry>();
        //    foreach (var itm in context)
        //    {
        //        if (fullSize)
        //        {
        //            entries.Add(EntryUtility.GetEntry((float)itm.BudgetedAmount, GetColor(), itm.ItemDescription, itm.BudgetedAmount.ToString("C")));
        //        }
        //        else
        //        {
        //            entries.Add(EntryUtility.GetEntry((float)itm.BudgetedAmount));
        //        }
        //    }
        //    return entries.ToArray();
        //}

        //Entry[] GetEntries(BudgetCategoryViewModel vm, CategoryChartType chartType, bool fullSize)
        //{
        //    return GetCategoryEntries(vm, chartType, fullSize);
        //}

        //Entry[] GetCategoryEntries(BudgetCategoryViewModel vm, CategoryChartType chartType, bool fullSize)
        //{
        //    var context = vm.BudgetItems;
        //    List<Entry> entries = new List<Entry>();
        //    foreach (var itm in context)
        //    {
        //        if (fullSize)
        //        {
        //            entries.Add(EntryUtility.GetEntry((float)itm.BudgetedAmount, GetColor(), itm.ItemDescription, itm.BudgetedAmount.ToString("C")));
        //        }
        //        else
        //        {
        //            entries.Add(EntryUtility.GetEntry((float)itm.BudgetedAmount));
        //        }
        //    }
        //    return entries.ToArray();
        //}

        async Task <Entry[]> GetEntriesAsync(EasyBudgetStatusViewModel vm, bool fullSize)
        {
            Entry[] IncomeEntries = await GetIncomeEntriesAsync(vm, fullSize);

            Entry[] ExpensesEntries = await GetExpensesEntriesAsync(vm, fullSize);

            Entry[] _Entries = new Entry[IncomeEntries.Length + ExpensesEntries.Length];
            Array.Copy(IncomeEntries, _Entries, IncomeEntries.Length);
            Array.Copy(ExpensesEntries, 0, _Entries, IncomeEntries.Length, ExpensesEntries.Length);

            return(_Entries);
        }
Example #26
0
        private void OnMonthChanged(object sender, EventArgs e)
        {
            int selectedMonth = pickerMonth.SelectedIndex + 1;
            int totalCost     = GetTotalCost(selectedMonth);
            int totalIncome   = GetTotalIncome(selectedMonth);

            if (totalCost > totalIncome)
            {
                frTotal.BackgroundColor = Color.FromHex("#f6d2ce");
            }
            else
            {
                frTotal.BackgroundColor = Color.FromHex("#d0f6ce");
            }
            lbTotalCost.Text   = $"{LangSettings.InstanceOf.TOTAL_COST}: {totalCost}";
            lbTotalIncome.Text = $"{LangSettings.InstanceOf.TOTAL_INCOME}: {totalIncome}";
            btDatails.Text     = LangSettings.InstanceOf.DETAILS;

            // Cost Entries

            var costEnties = new List <Entry>();

            monthlyNotes = GetNotesPerMonth(selectedMonth);

            foreach (Group anyGroup in App.MoneyGroups.GroupList)
            {
                if (anyGroup.isCost)
                {
                    int totalAmount = 0;
                    foreach (Note anyNote in monthlyNotes)
                    {
                        if (anyNote.MoneyGroup != null && anyNote.MoneyGroup.Name.Equals(anyGroup.Name))
                        {
                            totalAmount += anyNote.Amount;
                        }
                    }
                    Entry newEntry = new Entry(totalAmount)
                    {
                        Color      = SKColor.Parse("#FF1943"),
                        Label      = anyGroup.Name,
                        ValueLabel = totalAmount.ToString()
                    };
                    costEnties.Add(newEntry);
                }
            }

            ChartBar.Chart = new BarChart()
            {
                Entries = costEnties
            };
            pickerMode.SelectedIndex = 0;
            btDatails.IsVisible      = true;
        }
        private void UpdateWaterLevel(List <Entry> waterLevelEntries, ChartView waterLevelChartView)
        {
            var   latestWaterLevel      = waterLevelEntries.Last().Value > 0 ? waterLevelEntries.Last().Value - 1 : 0;
            Entry latestWaterLevelEntry = ClimateMetricService.GetWaterTankLevelEntry(latestWaterLevel);

            waterLevelEntries.Add(latestWaterLevelEntry);
            TrimGraphToTimespan(waterLevelEntries);
            waterLevelChartView.Chart = new LineChart()
            {
                Entries = waterLevelEntries
            };
        }
Example #28
0
        public void Grafico(int dias)
        {
            try
            {
                dia = bd.Prom(idUS, dias);


                entries = new List <Microcharts.Entry> {
                };



                for (int i = dia.Count - 1; i >= 0; i--)
                {
                    var random = new Random();
                    var color  = String.Format("#{0:X6}", random.Next(0x1000000));
                    var x      = new Microcharts.Entry(dia[i].Promedio)
                    {
                        Label      = dia[i].Fecha.ToString("dd/MM"),
                        ValueLabel = dia[i].Promedio.ToString(),
                        Color      = SKColor.Parse(color)
                    };
                    entries.Add(x);
                }



                chartView.Chart = new Microcharts.BarChart {
                    Entries = entries
                };
                chartView.Chart.LabelTextSize = 30;

                chartViewC.Chart = new Microcharts.LineChart()
                {
                    Entries = entries
                };
                chartViewC.Chart.LabelTextSize = 30;

                chartViewP.Chart = new Microcharts.PointChart()
                {
                    Entries = entries
                };
            }
            catch (Exception ex)
            {
                AlertDialog alerta = new AlertDialog.Builder(Context).Create();
                alerta.SetTitle("Error ");
                alerta.SetMessage(ex.Message + "'asdasd'");
                alerta.SetButton("Aceptar", (a, b) => { });
                alerta.Show();
            }
        }
        private void LectureHistoriqueMatin()
        {
            string data = DependencyService.Get <Class.IFileReadWrite>().ReadData(PrefsApp.fileMatinGlycemie);

            Console.WriteLine("Data = " + data);
            //infosHistoriqueMatin.Text = data;

            var list = JsonConvert.DeserializeObject <List <Matin> >(data);

            List <Entry> ChartsListGlycemieMatin = new List <Entry> {
            };
            List <Entry> ChartsListInsulineMatin = new List <Entry> {
            };

            foreach (var item in list)
            {
                /*
                 * Modifier cette line en prod
                 */
                string GlycChiffre     = Regex.Replace(item.Glycemie, "[^0-9.]", "");
                Entry  NewItemGlycemie = new Entry(Single.Parse(GlycChiffre))
                {
                    Label      = item.DatePriseMesure,
                    ValueLabel = item.Glycemie,
                    Color      = SKColor.Parse("#68B9C0"),
                };
                ChartsListGlycemieMatin.Add(NewItemGlycemie);

                /*
                 * Modifier cette line en prod
                 */
                string insuChiffre     = Regex.Replace(item.Insuline, "[^0-9.]", "");
                Entry  NewItemInsuline = new Entry(Single.Parse(insuChiffre))
                {
                    Label      = item.Insuline,
                    ValueLabel = item.Insuline,
                    Color      = SKColor.Parse("#266489")
                };
                ChartsListInsulineMatin.Add(NewItemInsuline);
            }
            // Microcharts.Forms.ChartView
            //Microcharts.Chart;
            //   Microcharts.Forms.ChartView.Chart {get; set;}
            MatinGlycmieCharts.Chart = new LineChart()
            {
                Entries = ChartsListGlycemieMatin
            };
            MatinInsulineCharts.Chart = new LineChart()
            {
                Entries = ChartsListInsulineMatin
            };
        }
Example #30
0
        private void ChangeEntries(ref List <Entry> entries)
        {
            var newEntries = entries;
            var maxEntry   = newEntries.Where(x => x.Value == newEntries.Select(y => y.Value).Max()).First();

            var maxIndex = newEntries.FindIndex(0, newEntries.Count, x => x.Value == maxEntry.Value);

            entries[maxIndex] = new Entry(maxEntry.Value)
            {
                Color      = SKColor.Parse("#ff19ae"),
                ValueLabel = "Personal best at " + Math.Round(maxEntry.Value, 2),
                Label      = maxEntry.Label
            };
        }