Пример #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            List <CompanyChart> companyData = (List <CompanyChart>)value;

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

            if (companyData == null)
            {
                return(entries);
            }

            int currentMonth = 0;

            foreach (CompanyChart data in companyData)
            {
                Microcharts.Entry entry = new Microcharts.Entry(data.Close);
                if (currentMonth != data.Date.Month)
                {
                    currentMonth     = data.Date.Month;
                    entry.ValueLabel = data.Date.ToString("MM.yy");
                }
                entries.Add(entry);
            }

            return(entries);
        }
Пример #2
0
 public List <Microcharts.Entry> Relatorio2()
 {
     try
     {
         Conexao       connection = new Conexao();
         NpgsqlCommand query      = new NpgsqlCommand("select quantidade, nome from produto order by quantidade asc limit 4");
         query.Connection = connection.Open();
         using (NpgsqlDataReader rs = query.ExecuteReader())
             if (rs.HasRows)
             {
                 List <Microcharts.Entry> relatorio = new List <Microcharts.Entry>();
                 Random rnd = new Random();
                 while (rs.Read())
                 {
                     Microcharts.Entry m = new Microcharts.Entry(rs.GetInt32(0));
                     m.ValueLabel = Convert.ToString(rs.GetInt32(0));
                     m.Label      = rs.GetString(1);
                     m.Color      = SkiaSharp.SKColor.Parse(String.Format("#{0:X6}", rnd.Next(0x1000000)));
                     relatorio.Add(m);
                 }
                 connection.Close();
                 return(relatorio);
             }
         connection.Close();
         return(null);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao carregar relatório: " + ex.Message);
     }
 }
Пример #3
0
        public void setChart()
        {
            List <Microcharts.Entry> entries = new List <Microcharts.Entry>();

            //var selectedDay = calendar.SelectedDate.Value;
            var  selectedDay  = datePicker.Date;
            bool stressedOnly = stressedOnlySwitch.IsToggled;

            filteredMeasurements = GetDailyMeasurements(selectedDay, stressedOnly);
            filteredMeasurements.ForEach(item =>
            {
                var entry = new Microcharts.Entry(item.StressIndex)
                {
                    Color      = item.IsStressed == 1 ? SKColor.Parse("#cc1b08") : SKColor.Parse("#08d854"),
                    Label      = item.Date.ToString("HH:mm"),
                    ValueLabel = item.StressIndex.ToString()
                };
                entries.Add(entry);
            });
            chart.Entries = entries;
            chart.ValueLabelOrientation = Microcharts.Orientation.Horizontal;
            model = ((MeasurementsPageViewModel)BindingContext);
            model.FilteredMeasurementsObj.Clear();
            model.ConcatFiltered(filteredMeasurements);
        }
Пример #4
0
        private void LoadBarraca()
        {
            //await navigationServices.SetLoginPage();
            var mainViewModel = MainViewModel.GetInstance();

            mainViewModel.LoadRank();
            var RankTable = dataService.GetRankNota();

            RankList.Clear();
            foreach (var x in RankTable)
            {
                var barraca = new Model.Rank()
                {
                    Nome = x.Nome,
                    Cor  = x.Cor,
                    Nota = x.Nota
                };
                RankList.Add(barraca);
            }
            entries.Clear();
            foreach (var x in RankList.Take(3))
            {
                var Entrada = new Microcharts.Entry((float)(x.Nota))
                {
                    Color      = SKColor.Parse(x.Cor),
                    ValueLabel = x.Nota.ToString("0.00"),
                    Label      = x.Nome
                };
                entries.Add(Entrada);
            }
        }
Пример #5
0
        /// <summary>
        /// Get Entry object for Microcharts graph, representing a watering tank level
        /// </summary>
        /// <param name="waterLevel">Watering tank level in liters as float</param>
        /// <returns>Microcharts Entry with watering tank level in liters</returns>
        public static Entry GetWaterTankLevelEntry(float waterLevel)
        {
            Entry waterLevelEntry = new Entry(waterLevel)
            {
                Label      = DateTime.Now.ToString("h:mm:ss tt"),
                ValueLabel = waterLevel.ToString() + " liters",
                Color      = SKColor.Parse("#1E75D6")
            };

            return(waterLevelEntry);
        }
        public static async Task <Entry[]> GetentrieNaz()
        {
            var lista = await App.Database.GetNazioneAsync();

            var entrys = new List <Entry>();

            foreach (var item in lista)
            {
                var ent = new Entry(item.nuovi_positivi);
                //ent.Label = item.data.ToString();
                //ent.ValueLabel = item.totale_casi.ToString();
                ent.Color = SKColor.Parse("#bb161d");
                entrys.Add(ent);
            }
            return(entrys.ToArray());
        }
        public static async Task <Entry[]> GetentriesPro(string nome)
        {
            var lista = await App.Database.GetProvincespecificheAsync(nome);

            var entrys = new List <Entry>();

            vecchitotali = 0;
            foreach (var item in lista)
            {
                int nuovipos = item.totale_casi - vecchitotali;
                vecchitotali = item.totale_casi;
                var ent = new Entry(nuovipos);
                //ent.Label = item.data.ToString();
                //ent.ValueLabel = item.totale_casi.ToString();
                ent.Color = SKColor.Parse("#bb161d");
                entrys.Add(ent);
            }
            return(entrys.ToArray());
        }
Пример #8
0
        private IEnumerable <Entry> ShuffleList(Entry[] entries)
        {
            RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
            int n = entries.Length;

            while (n > 1)
            {
                byte[] box = new byte[1];
                do
                {
                    provider.GetBytes(box);
                }while (!(box[0] < n * (byte.MaxValue / n)));
                int k = box[0] % n;
                n--;
                Entry value = entries[k];
                entries[k] = entries[n];
                entries[n] = value;
            }
            return(entries);
        }
Пример #9
0
        /// <summary>
        /// Get mist head pressure for Microcharts graph
        /// </summary>
        /// <param name="cooltainerId">Id of Cooltainer of interest</param>
        /// <returns>List of Microcharts Entries with mist head pressure + rest value</returns>
        public static List <Entry> GetPressureEntryList(int cooltainerId)
        {
            List <Entry> entries = new List <Entry>();

            var pressure = GetPressure(cooltainerId);

            Entry pressureEntry = new Entry(pressure)
            {
                Label      = pressure.ToString(),
                ValueLabel = "kPa",
                Color      = SKColor.Parse("#D61E3D")
            };

            Entry restValue = new Entry(700 - pressure)
            {
                Color = SKColor.Parse("#D6D6D6")
            };

            entries.Add(pressureEntry);
            entries.Add(restValue);

            return(entries);
        }
Пример #10
0
        /// <summary>
        /// Get Cooltainer CO2 concentration at rhizosphere (root zone) for Microcharts graph
        /// </summary>
        /// <param name="cooltainerId">Id of Cooltainer of interest</param>
        /// <returns>List of Microcharts Entries with current CO2 concentration + rest value</returns>
        public static List <Entry> GetCo2LevelEntryList(int cooltainerId)
        {
            List <Entry> entries = new List <Entry>();

            var co2Level = GetCo2Level(cooltainerId);

            Entry co2LevelEntry = new Entry(co2Level)
            {
                Label      = co2Level.ToString(),
                ValueLabel = "ppm",
                Color      = SKColor.Parse("#1ED1D6")
            };

            Entry restValue = new Entry(780 - co2Level)
            {
                Color = SKColor.Parse("#D6D6D6")
            };

            entries.Add(co2LevelEntry);
            entries.Add(restValue);

            return(entries);
        }
Пример #11
0
        /// <summary>
        /// Get Cooltainer humidity for Microcharts graph
        /// </summary>
        /// <param name="cooltainerId">Id of Cooltainer of interest</param>
        /// <returns>List of Microcharts Entries with current humidity of Cooltainer + rest value</returns>
        public static List <Entry> GetHumidityEntryList(int cooltainerId)
        {
            List <Entry> entries = new List <Entry>();

            var humidity = GetHumidity(cooltainerId);

            Entry humidityEntry = new Entry(humidity)
            {
                Label      = humidity.ToString(),
                ValueLabel = "%",
                Color      = SKColor.Parse("#1E75D6")
            };

            Entry restValue = new Entry(100 - humidity)
            {
                Color = SKColor.Parse("#D6D6D6")
            };

            entries.Add(humidityEntry);
            entries.Add(restValue);

            return(entries);
        }
Пример #12
0
        public static async Task <Entry[]> GetentriesReg(string nome)
        {
            if (nome != "trentino-alto adige")
            {
                var lista = await App.Database.GetRegionispecificheAsync(nome);

                var entrys = new List <Entry>();
                foreach (var item in lista)
                {
                    var ent = new Entry(item.nuovi_positivi);
                    //ent.Label = item.data.ToString();
                    //ent.ValueLabel = item.totale_casi.ToString();
                    ent.Color = SKColor.Parse("#bb161d");
                    entrys.Add(ent);
                }
                return(entrys.ToArray());
            }
            else
            {
                var lista1 = await App.Database.GetRegionispecificheAsync("P.A.Trento");

                var lista2 = await App.Database.GetRegionispecificheAsync("P.A. Bolzano");

                var entrys = new List <Entry>();
                var ar1    = lista1.ToArray();
                var ar2    = lista2.ToArray();
                for (int i = 0; i < ar1.Length; i++)
                {
                    var ent = new Entry(ar1[i].nuovi_positivi + ar2[i].nuovi_positivi);
                    //ent.Label = ar1[i].data.ToString();
                    //ent.ValueLabel = (ar1[i].totale_casi+ar2[i].totale_casi).ToString();
                    ent.Color = SKColor.Parse("#bb161d");
                    entrys.Add(ent);
                }
                return(entrys.ToArray());
            }
        }
Пример #13
0
        /*
         *  private Microcharts.Entry Values()
         *  {
         *      var r = new Random();
         *      Microcharts.Entry newValue = null;
         *
         *      var numberRandom = r.Next(1, 20);
         *
         *  newValue = new Microcharts.Entry(numberRandom)
         *      {
         *          Label = $"Value number {numberRandom}",
         *          Color = Color.Yellow.ToSKColor(),
         *          ValueLabel = numberRandom.ToString(),
         *          TextColor = Color.Red.ToSKColor()
         *      };
         *
         *  return newValue;
         *  }
         */
        protected override void OnAppearing()
        {
            base.OnAppearing();

            IList <Microcharts.Entry> firstSerie  = new List <Microcharts.Entry>();
            IList <Microcharts.Entry> secondSerie = new List <Microcharts.Entry>();
            IList <Microcharts.Entry> thirdSerie  = new List <Microcharts.Entry>();
            IList <Microcharts.Entry> fourthSerie = new List <Microcharts.Entry>();
            IList <Microcharts.Entry> fifthSerie  = new List <Microcharts.Entry>();


            var r = new Random();

            for (var i = 1; i < 10; i++)
            {
                var numberRandom = r.Next(1, 20);

                var newValue = new Microcharts.Entry(numberRandom)
                {
                    Label      = $"Value number {numberRandom}",
                    Color      = Color.DeepSkyBlue.ToSKColor(),
                    ValueLabel = numberRandom.ToString(),
                    TextColor  = Color.Black.ToSKColor()
                };

                firstSerie.Add(newValue);
                thirdSerie.Add(newValue);
                fifthSerie.Add(newValue);
            }

            var Audi = new Microcharts.Entry(10)
            {
                Label      = $"Value number {10}",
                Color      = Color.Red.ToSKColor(),
                ValueLabel = "Audi",
                TextColor  = Color.Red.ToSKColor()
            };

            secondSerie.Add(Audi);

            var BMW = new Microcharts.Entry(15)
            {
                Label      = $"Value number {15}",
                Color      = Color.Gold.ToSKColor(),
                ValueLabel = "BMW",
                TextColor  = Color.Gold.ToSKColor()
            };

            secondSerie.Add(BMW);

            var Porche = new Microcharts.Entry(33)
            {
                Label      = $"Value number {33}",
                Color      = Color.LightSkyBlue.ToSKColor(),
                ValueLabel = "Porche",
                TextColor  = Color.LightSkyBlue.ToSKColor()
            };

            secondSerie.Add(Porche);

            for (var i = 1; i < 10; i++)
            {
                var numberRandom = r.Next(1, 20);

                var newValue = new Microcharts.Entry(numberRandom)
                {
                    Label      = $"Value number {numberRandom}",
                    Color      = Color.Red.ToSKColor(),
                    ValueLabel = numberRandom.ToString(),
                    TextColor  = Color.Black.ToSKColor()
                };

                fourthSerie.Add(newValue);
            }

            ChartViewFirst.Chart = new Microcharts.BarChart()
            {
                Entries       = firstSerie,
                LabelTextSize = 20,
                Margin        = 15
            };

            ChartViewSecond.Chart = new Microcharts.DonutChart()
            {
                Entries       = secondSerie,
                LabelTextSize = 20,
                HoleRadius    = 0.1f,
                Margin        = 15
            };

            ChartViewThird.Chart = new Microcharts.LineChart()
            {
                Entries       = thirdSerie,
                LabelTextSize = 20,
                Margin        = 15
            };

            ChartViewFourth.Chart = new Microcharts.PointChart()
            {
                Entries       = fourthSerie,
                LabelTextSize = 20,
                Margin        = 15
            };

            ChartViewFifth.Chart = new Microcharts.RadarChart()
            {
                Entries       = fifthSerie,
                LabelTextSize = 20,
                Margin        = 15
            };

            ChartViewSixth.Chart = new Microcharts.RadialGaugeChart()
            {
                Entries       = secondSerie,
                StartAngle    = 0.5f,
                LabelTextSize = 20,
                Margin        = 15
            };
        }