File tree Expand file tree Collapse file tree 3 files changed +58
-251
lines changed
Expand file tree Collapse file tree 3 files changed +58
-251
lines changed Original file line number Diff line number Diff line change 11<template >
22 <h1 id =" app" >
3- <NdviGraph />
3+ <TestComponent />
4+ <MedianTempGraph />
45 </h1 >
56</template >
67
78<script >
8- import NdviGraph from " ./components/NdviGraph .vue"
9- import MedianTempGraph from " ./components/TestGraphOne.vue"
9+ import TestComponent from " ./components/TestComponent .vue"
10+ // import MedianTempGraph from "./components/TestGraphOne.vue"
1011
1112 export default {
1213 name: ' App' ,
1314 components: {
14- NdviGraph ,
15- MedianTempGraph
15+ TestComponent ,
16+ // MedianTempGraph
1617 }
1718 };
1819 </script >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <h3 >Temperature Data:</h3 >
4+ <ul v-if =" temperatureData" >
5+ <li v-for =" (data, index) in temperatureData.data" :key =" index" >
6+ Timestamp: {{ data.timestamp }} - Value: {{ data.value }} °C
7+ </li >
8+ </ul >
9+ </div >
10+ </template >
11+
12+ <script >
13+ import { ref , onMounted } from ' vue'
14+ import axios from ' axios'
15+
16+ export default {
17+ name: ' FetchTemperatureData' ,
18+ setup () {
19+ const temperatureData = ref (null )
20+
21+ const fetchTemperatureData = async () => {
22+ const apiUrl = ' http://localhost:8000/weather/index'
23+
24+ const params = {
25+ weatherVariable: " temperature_2m" ,
26+ startDate: 1672527600 ,
27+ endDate: 1675119600 ,
28+ location: " TEMPELHOFER_FELD" ,
29+ temporalResolution: " DAILY" ,
30+ aggregation: " MEAN" ,
31+ }
32+
33+ try {
34+ const response = await axios .get (apiUrl, { params })
35+ temperatureData .value = response .data
36+ } catch (error) {
37+ console .error (" Error fetching temperature data:" , error)
38+ }
39+ }
40+
41+ onMounted (() => {
42+ fetchTemperatureData ()
43+ })
44+
45+ return {
46+ temperatureData
47+ }
48+ }
49+ }
50+ </script >
51+
52+ <style scoped></style >
You can’t perform that action at this time.
0 commit comments