This project is a React application that visualizes sensor data using Ant Design components and Recharts.
This application fetches sensor data from a ThingSpeak API and displays it using line charts. It includes:
- A responsive layout with a navbar, workspace, and footer
- Dynamic chart generation based on fetched sensor data
- Error handling for data fetching and display
- GPS data visualization
- React 18.3.1
- TypeScript 4.9.5
- Ant Design 5.21.2
- Recharts 2.12.7
- Styled Components 5.3.10
- Leaflet 1.9.4 (for map visualization)
Before you begin, ensure you have met the following requirements:
- Node.js: This project requires Node.js version 14.0 or higher. You can download it from nodejs.org.
- Yarn: We use Yarn as our package manager. If you don't have Yarn installed, you can install it after installing Node.js by running:
npm install -g yarn
To verify your installations, run:
- Clone the repository
- Install dependencies:
yarn install
- Create a
.env
file in the root directory and add your ThingSpeak API key:REACT_APP_THINGSPEAK_API_KEY=your_api_key_here
- Start the development server:
yarn start
In the project directory, you can run:
Runs the app in development mode. Open http://localhost:3000 to view it in the browser.
Launches the test runner in interactive watch mode.
Builds the app for production to the build
folder.
Builds the app and deploys it to GitHub Pages.
Runs ESLint to check for code style issues.
Formats the code using Prettier.
Runs linting, formatting, and type-checking.
App.tsx
: Main application layoutWorkspace.tsx
: Manages sensor data and renders chartsChart.tsx
: Renders individual charts for each sensorChartSummary.tsx
: Displays summary information for each chartGpsMap.tsx
: Renders a map with GPS coordinates
- Prettier: For code formatting
- ESLint: For code linting (extends React App ESLint configuration)
- TypeScript: For static type checking
This project is set up to deploy to GitHub Pages using the gh-pages
package. To deploy, run: