Shivansh7102003 commited on
Commit
76ad817
·
verified ·
1 Parent(s): 1ffbf7a

use indian citiy jaipur

Browse files
Files changed (1) hide show
  1. index.html +18 -18
index.html CHANGED
@@ -206,20 +206,19 @@
206
 
207
  document.getElementById('today-date').textContent = today.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
208
  document.getElementById('tomorrow-date').textContent = tomorrow.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
209
-
210
- // Mock data for demonstration
211
  const mockWeatherData = {
212
- cityName: "New York, US",
213
- temperature: 24,
214
- description: "Sunny",
215
- humidity: 65,
216
- windSpeed: 12,
217
- pressure: 1013,
218
- feelsLike: 26,
219
- todayRainChance: 75,
220
- todayPrecipitation: 5.2,
221
- tomorrowRainChance: 30,
222
- tomorrowPrecipitation: 0.5
223
  };
224
 
225
  // Update UI with mock data
@@ -236,8 +235,7 @@
236
  document.getElementById('tomorrow-precipitation').textContent = `${mockWeatherData.tomorrowPrecipitation}mm`;
237
  document.getElementById('today-rain-bar').style.width = `${mockWeatherData.todayRainChance}%`;
238
  document.getElementById('tomorrow-rain-bar').style.width = `${mockWeatherData.tomorrowRainChance}%`;
239
-
240
- // 7-day forecast chart
241
  const ctx = document.getElementById('forecast-chart').getContext('2d');
242
  const forecastChart = new Chart(ctx, {
243
  type: 'bar',
@@ -245,7 +243,7 @@
245
  labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
246
  datasets: [{
247
  label: 'Rain Chance %',
248
- data: [75, 30, 10, 5, 20, 60, 80],
249
  backgroundColor: [
250
  'rgba(59, 130, 246, 0.7)',
251
  'rgba(59, 130, 246, 0.7)',
@@ -266,7 +264,7 @@
266
  ],
267
  borderWidth: 1
268
  }]
269
- },
270
  options: {
271
  responsive: true,
272
  plugins: {
@@ -322,10 +320,12 @@
322
  if (city) {
323
  // In a real app, this would fetch data from OpenWeatherMap API
324
  console.log(`Searching for weather in ${city}`);
 
 
325
  cityInput.value = '';
326
  }
327
  }
328
  });
329
- </script>
330
  </body>
331
  </html>
 
206
 
207
  document.getElementById('today-date').textContent = today.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
208
  document.getElementById('tomorrow-date').textContent = tomorrow.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
209
+ // Mock data for Jaipur
 
210
  const mockWeatherData = {
211
+ cityName: "Jaipur, India",
212
+ temperature: 38,
213
+ description: "Clear Sky",
214
+ humidity: 25,
215
+ windSpeed: 8,
216
+ pressure: 1005,
217
+ feelsLike: 41,
218
+ todayRainChance: 5,
219
+ todayPrecipitation: 0.0,
220
+ tomorrowRainChance: 10,
221
+ tomorrowPrecipitation: 0.2
222
  };
223
 
224
  // Update UI with mock data
 
235
  document.getElementById('tomorrow-precipitation').textContent = `${mockWeatherData.tomorrowPrecipitation}mm`;
236
  document.getElementById('today-rain-bar').style.width = `${mockWeatherData.todayRainChance}%`;
237
  document.getElementById('tomorrow-rain-bar').style.width = `${mockWeatherData.tomorrowRainChance}%`;
238
+ // 7-day forecast chart
 
239
  const ctx = document.getElementById('forecast-chart').getContext('2d');
240
  const forecastChart = new Chart(ctx, {
241
  type: 'bar',
 
243
  labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
244
  datasets: [{
245
  label: 'Rain Chance %',
246
+ data: [5, 10, 15, 5, 10, 20, 25],
247
  backgroundColor: [
248
  'rgba(59, 130, 246, 0.7)',
249
  'rgba(59, 130, 246, 0.7)',
 
264
  ],
265
  borderWidth: 1
266
  }]
267
+ },
268
  options: {
269
  responsive: true,
270
  plugins: {
 
320
  if (city) {
321
  // In a real app, this would fetch data from OpenWeatherMap API
322
  console.log(`Searching for weather in ${city}`);
323
+ // Update the city name in the UI
324
+ document.getElementById('city-name').textContent = city + ", India";
325
  cityInput.value = '';
326
  }
327
  }
328
  });
329
+ </script>
330
  </body>
331
  </html>