// Loads the daily wind speed chart /// <summary> /// Loads the daily wind speed chart. /// </summary> private async void LoadDayilyWindSpeedChart() { try { dailyWeather = await DailyWeatherInfoProcessor.LoadDailyWeather(currentWeather.Coord.Lon, currentWeather.Coord.Lat); } catch (Exception) { Console.WriteLine("Exception occurred"); } WeatherChart.Series.Clear(); WeatherChart.Header = "Wind Speed"; // Adding horizontal axis to chart primaryAxis.Header = "Date"; // Adding vertical axis to chart secondaryAxis.Header = "Speed [m/s]"; // Preparing data for Chart DailyWeatherForecast dailyData = new DailyWeatherForecast(dailyWeather); // Creating AdornmentInfo ChartAdornmentInfo adornmentInfo = new ChartAdornmentInfo() { ShowMarker = true, Symbol = ChartSymbol.Diamond, SymbolHeight = 5, SymbolWidth = 5, SymbolInterior = new SolidColorBrush(Colors.Black), ShowLabel = true, LabelPosition = AdornmentsLabelPosition.Inner, Foreground = new SolidColorBrush(Colors.White), BorderBrush = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1), Margin = new Thickness(1), FontStyle = FontStyles.Italic, FontFamily = new FontFamily("Calibri"), FontSize = 11 }; //Initialize needed Line Series LineSeries seriesWindSpeed = new LineSeries() { ItemsSource = dailyData.windSpeed, XBindingPath = "Date", YBindingPath = "WindSpeed", Label = "Wind Speed", LegendIcon = ChartLegendIcon.Circle, AdornmentsInfo = adornmentInfo }; //Adding Series to Chart WeatherChart.Series.Add(seriesWindSpeed); }
// Loads the daily apparent temperature chart /// <summary> /// Loads the daily apparent temperature chart. /// </summary> private async void LoadDayilyApparentTemperatureChart() { try { dailyWeather = await DailyWeatherInfoProcessor.LoadDailyWeather(currentWeather.Coord.Lon, currentWeather.Coord.Lat); } catch (Exception) { Console.WriteLine("Exception occurred"); } WeatherChart.Series.Clear(); WeatherChart.Header = "Apparent Temperature"; // Adding horizontal axis to chart primaryAxis.Header = "Date"; // Adding vertical axis to chart secondaryAxis.Header = "Temperature [°C]"; // Preparing data for Chart DailyWeatherForecast dailyData = new DailyWeatherForecast(dailyWeather); // Creating AdornmentInfo List <ChartAdornmentInfo> adornmentInfoList = new List <ChartAdornmentInfo>(); for (int i = 0; i < 4; i++) { ChartAdornmentInfo adornmentInfo = new ChartAdornmentInfo() { ShowMarker = true, Symbol = ChartSymbol.Diamond, SymbolHeight = 5, SymbolWidth = 5, SymbolInterior = new SolidColorBrush(Colors.Black), ShowLabel = true, LabelPosition = AdornmentsLabelPosition.Inner, Foreground = new SolidColorBrush(Colors.White), BorderBrush = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1), Margin = new Thickness(1), FontStyle = FontStyles.Italic, FontFamily = new FontFamily("Calibri"), FontSize = 11 }; adornmentInfoList.Add(adornmentInfo); } //Initialize needed Line Series LineSeries seriesMorning = new LineSeries() { ItemsSource = dailyData.dailyApparentTemperatureForecast.MorningApparentTemperature, XBindingPath = "Date", YBindingPath = "Temperature", Label = "Morning", LegendIcon = ChartLegendIcon.Circle, AdornmentsInfo = adornmentInfoList[0] }; LineSeries seriesDay = new LineSeries() { ItemsSource = dailyData.dailyApparentTemperatureForecast.DayApparentTemperature, XBindingPath = "Date", YBindingPath = "Temperature", Label = "Day", LegendIcon = ChartLegendIcon.Circle, AdornmentsInfo = adornmentInfoList[1] }; LineSeries seriesEvening = new LineSeries() { ItemsSource = dailyData.dailyApparentTemperatureForecast.EveningApparentTemperature, XBindingPath = "Date", YBindingPath = "Temperature", Label = "Evening", LegendIcon = ChartLegendIcon.Circle, AdornmentsInfo = adornmentInfoList[2] }; LineSeries seriesNight = new LineSeries() { ItemsSource = dailyData.dailyApparentTemperatureForecast.NightApparentTemperature, XBindingPath = "Date", YBindingPath = "Temperature", Label = "Night", LegendIcon = ChartLegendIcon.Circle, AdornmentsInfo = adornmentInfoList[3] }; //Adding Series to Chart WeatherChart.Series.Add(seriesMorning); WeatherChart.Series.Add(seriesDay); WeatherChart.Series.Add(seriesEvening); WeatherChart.Series.Add(seriesNight); }