ICM

ICM: /week8/ Weather of next 16 days

I used the data resource of OpenWeatherMap¬†to call 16 day / daily forecast data, in which the “q=Beijing” can be changed to any city.

This is the final sketch(click submit):

In this sketch, the curve graph shows the variation tendency of next 16 days’ evening temperatures basing on today’s evening temperature.

And if it has a rainy day in the next 16 days, there will be rain drops in the background. But there are some problems with the conditional expression of the code.

//I finally solved the problem: instead of using “weather.list[0].weather.main”, I should use¬†weather.list[0].weather[0].main. Because by using “console.log(weather.list[i].weather.main);” , there is no data coming in. So I came back to the JASON data, I found that the weather is also an array, which only has one element in it. It’s kind of weird.

The code can be seen here.

In the future, I can complete this sketch to make it more like a beautiful weather APP.

One thought on “ICM: /week8/ Weather of next 16 days

Leave a Reply

Your email address will not be published. Required fields are marked *