Exemplo n.º 1
0
        /// <summary>
        /// Shows the Line3D Chart from Minimum Temperature forecast.
        /// </summary>
        /// <param name="weather"> Weather info</param>
        private void MinTemperatureForecast(ActualWeather weather)
        {
            var tChart1 = new Chart();

            tChart1.Header.Text                       = "Min Temperature of " + App.Weather.Name;
            tChart1.Legend.Visible                    = true;
            tChart1.Legend.Alignment                  = LegendAlignments.Bottom;
            tChart1.Legend.LegendStyle                = LegendStyles.Series;
            tChart1.Legend.Transparent                = true;
            tChart1.Aspect.View3D                     = false;
            tChart1.Axes.Bottom.Labels.Angle          = 90;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";

            var minTemp = new Line(tChart1.Chart);

            minTemp.Marks.Visible = false;
            double max = App.getDegScaleTemp(weather.LstWeather[0].MinTemperature);
            double min = App.getDegScaleTemp(weather.LstWeather[0].MinTemperature);

            minTemp.LinePen.Width       = 3;
            minTemp.Pointer.Visible     = true;
            minTemp.Pointer.HorizSize   = 3;
            minTemp.Pointer.VertSize    = 3;
            minTemp.Pointer.Style       = PointerStyles.Sphere;
            minTemp.Pointer.Pen.Visible = false;
            minTemp.LinePen.Color       = Color.FromRgb(27, 177, 255);
            minTemp.Color           = Color.FromRgb(27, 177, 255);
            minTemp.Title           = "Min Temperature";
            minTemp.Marks.Visible   = true;
            minTemp.Marks.DrawEvery = 4;

            AxisSettings(tChart1);
            TitleSettings(tChart1);
            //SeriesMarksSettings(minTemp);

            foreach (var item in weather.LstWeather)
            {
                if (App.getDegScaleTemp(item.MinTemperature) > max)
                {
                    max = App.getDegScaleTemp(item.MinTemperature);
                }
                if (App.getDegScaleTemp(item.MinTemperature) < min)
                {
                    min = App.getDegScaleTemp(item.MinTemperature);
                }
                minTemp.Add(item.Date, App.getDegScaleTemp(item.MinTemperature));
            }

            //tChart1.Axes.Left.SetMinMax((int)min - 5, (int)max + 5);
            tChart1.Axes.Bottom.Increment    = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
            tChart1.Axes.Bottom.Grid.Visible = false;
            tChart1.Axes.Left.Increment      = 4;
            tChart1.Legend.Font.Color        = Color.FromRgb(100, 100, 100);

            ShowChart(tChart1);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Shows the Line Chart from Temperature forecast.
        /// </summary>
        /// <param name="weather"> Weather info</param>
        private void TemperatureForecast(ActualWeather weather)
        {
            try
            {
                var tChart1 = new Chart();

                tChart1.Axes.Bottom.Labels.Angle          = 90;
                tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";
                tChart1.Axes.Bottom.Increment             = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
                tChart1.Axes.Left.Title.Text = "Temperature (" + (App.DegTempScale == TempScale.celsius ? "ºC" : "ºF") + ")";

                tChart1.Header.Text      = "Average temperature of " + App.Weather.Name;
                tChart1.Header.Alignment = TextAlignment.Center;
                tChart1.Header.TextAlign = TextAlignment.Center;

                double min = App.getDegScaleTemp(weather.LstWeather[0].MinTemperature);
                double max = App.getDegScaleTemp(weather.LstWeather[0].MaxTemperature);

                var avTemp = new Line(tChart1);
                foreach (var item in weather.LstWeather)
                {
                    if (App.getDegScaleTemp(item.MaxTemperature) > max)
                    {
                        max = App.getDegScaleTemp(item.MaxTemperature);
                    }
                    if (App.getDegScaleTemp(item.MinTemperature) < min)
                    {
                        min = App.getDegScaleTemp(item.MinTemperature);
                    }
                    avTemp.Add(item.Date, App.getDegScaleTemp(item.Temperature));
                }

                tChart1.Axes.Left.SetMinMax((int)min - 3, (int)max + 3);
                tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.MinXValue + 0.5, tChart1.Axes.Bottom.MaxXValue - 0.5);

                AxisSettings(tChart1);
                TitleSettings(tChart1);
                //SeriesMarksSettings(avTemp);

                ShowChart(tChart1);

                avTemp.Legend.Visible  = false;
                avTemp.LinePen.Width   = 3;
                avTemp.LinePen.EndCap  = Steema.TeeChart.Drawing.PenLineCap.Round;
                avTemp.Color           = Color.FromRgb(27, 177, 255);
                avTemp.Marks.Visible   = true;
                avTemp.Marks.DrawEvery = 4;
                tChart1.Series.Add(avTemp);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }
 /// <summary>
 /// This function gets all the info from the App.Weather (attribute), gives it the format that we want, and shows it on the screen.
 /// </summary>
 private void FillInfo()
 {
     BackgroundImage   = "Images.cloudy_background.jpg";
     grdMain.IsVisible = true;
     lblLocale.Text    = App.Weather.Name + ", " + App.Weather.Country;
     lblWeather.Text   = App.Weather.LstWeather[0].Visibility + ", " + App.Weather.LstWeather[0].Description;
     imgLogo.Source    = App.Weather.LstWeather[0].Icon;
     lblTemp.Text      = App.getDegScaleTemp(App.Weather.LstWeather[0].Temperature) + (App.DegTempScale == TempScale.celsius ? " ºC" : " ºF");;
     lblHumidity.Text  = App.Weather.LstWeather[0].Humidity + " %";
     lblPressure.Text  = App.Weather.LstWeather[0].Pressure + " hPa";
     lblSea.Text       = App.Weather.LstWeather[0].SeaLevel + " hPa";
     lblGround.Text    = App.Weather.LstWeather[0].GroundLevel + " hPa";
     CityChanged       = true;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Shows the Historigram Chart from Maximum Temperature forecast.
        /// </summary>
        /// <param name="weather"> Weather info</param>
        private void MaxTemperatureForecast(ActualWeather weather)
        {
            var tChart1 = new Chart();

            tChart1.Aspect.View3D                     = false;
            tChart1.Legend.Visible                    = false;
            tChart1.Axes.Bottom.Labels.Angle          = 90;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";
            tChart1.Header.Text = "Min/Max Temperature of " + App.Weather.Name;
            var maxTemp = new Histogram(tChart1.Chart);
            var highlow = new HighLow(tChart1.Chart);

            //maxTemp.LinesPen.Visible = false;
            maxTemp.Color                   = Color.FromRgb(27, 177, 255);
            maxTemp.LinePen.Color           = Color.FromRgb(27, 177, 255);
            maxTemp.LinePen.Width           = 20;
            maxTemp.LinesPen.Width          = 20;
            maxTemp.LinesPen.Visible        = true;
            maxTemp.LinePen.Visible         = true;
            maxTemp.LinesPen.Color          = Color.FromRgb(27, 177, 255);
            highlow.HighPen.Width           = 4;
            highlow.LowPen.Width            = 4;
            highlow.HighPen.DashCap         = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.HighPen.EndCap          = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.HighPen.Style           = Steema.TeeChart.Drawing.DashStyle.Solid;
            highlow.LowPen.DashCap          = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.LowPen.EndCap           = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.LowPen.Style            = Steema.TeeChart.Drawing.DashStyle.Solid;
            highlow.Marks.Visible           = true;
            highlow.Marks.DrawEvery         = 3;
            highlow.Marks.FollowSeriesColor = true;
            highlow.HighPen.Color           = Color.FromRgb(223, 5, 0);
            highlow.LowPen.Color            = Color.FromRgb(240, 186, 0);
            highlow.Pen.Visible             = false;

            double max = App.getDegScaleTemp(weather.LstWeather[0].MaxTemperature);
            double min = App.getDegScaleTemp(weather.LstWeather[0].MaxTemperature);

            foreach (var item in weather.LstWeather)
            {
                if (App.getDegScaleTemp(item.MaxTemperature) > max)
                {
                    max = App.getDegScaleTemp(item.MaxTemperature);
                }
                if (App.getDegScaleTemp(item.MaxTemperature) < min)
                {
                    min = App.getDegScaleTemp(item.MinTemperature);
                }
                maxTemp.Add(item.Date, App.getDegScaleTemp(item.MaxTemperature));
                highlow.Add(maxTemp.XValues.Last, item.MaxTemperature, item.MinTemperature);
            }
            maxTemp.Marks.AutoPosition = true;
            maxTemp.Marks.Transparent  = true;
            tChart1.Axes.Left.SetMinMax((int)min - 3, (int)max + 4);

            tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.MinXValue + 0.5, tChart1.Axes.Bottom.MaxXValue - 0.5);
            AxisSettings(tChart1);
            TitleSettings(tChart1);
            //SeriesMarksSettings(maxTemp);
            tChart1.Axes.Left.Increment = 4;

            ShowChart(tChart1);
        }