-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphContent.tsx
81 lines (67 loc) · 2.45 KB
/
GraphContent.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// import React, { useEffect, useState } from 'react';
// import { View, ActivityIndicator } from 'react-native';
// import { LineChart, Grid } from 'react-native-svg-charts';
// import StackedBarChart from 'react-native-svg-charts'; // Ensure the path is correct
// const GraphContent = () => {
// const [sensorData, setSensorData] = useState<Array<{ time: string; co2: number; temperature: number; humidity: number; ec: number; ph: number; wt: number; }>>([]);
// const [loading, setLoading] = useState(true);
// useEffect(() => {
// // Fetch sensor data from your API endpoint (replace 'YOUR_API_ENDPOINT' with your actual endpoint)
// fetch('http://121.78.116.56/mini-farm/Mini-Farm-web/minifarm.php')
// .then((response) => response.json())
// .then((data) => {
// setSensorData(data);
// setLoading(false);
// })
// .catch((error) => {
// console.error(error);
// setLoading(false);
// });
// }, []);
// if (loading) {
// return (
// <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
// <ActivityIndicator size="large" />
// </View>
// );
// }
// // Extracting data for x-axis (time) and y-axis (sensor values)
// const xAxisData = sensorData.map((item) => item.time);
// const co2Data = sensorData.map((item) => item.co2);
// const temperatureData = sensorData.map((item) => item.temperature);
// // Add more sensor data points in a similar manner
// // Combine data for plotting multiple lines on the graph
// const data = [
// {
// data: co2Data,
// svg: { stroke: 'red' }, // Customize line color for CO2 data
// },
// {
// data: temperatureData,
// svg: { stroke: 'blue' }, // Customize line color for temperature data
// },
// // Add more objects for additional sensor data
// ];
// return (
// <View style={{ flex: 1, padding: 16 }}>
// <LineChart
// style={{ flex: 1 }}
// data={data}
// contentInset={{ top: 20, bottom: 20 }}
// >
// <Grid />
// </LineChart>
// </View>
// );
// };
// export default GraphContent;
import { StyleSheet, Text, View } from 'react-native'
import React from 'react'
export default function GraphContent() {
return (
<View>
<Text>GraphContent</Text>
</View>
)
}
const styles = StyleSheet.create({})