Skip to content

arifislamz/data-visualization-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dynamic Data Visualization Dashboard

A modern, interactive web application for visualizing dynamic spatial and temporal data. Built with Next.js, TypeScript, and modern React patterns to provide an intuitive dashboard for data analysis and visualization.

Dashboard Preview

✨ Features

Core Functionality

  • Interactive Map Component: Leaflet-based mapping with polygon drawing capabilities
  • Timeline Slider: 30-day window with hourly resolution, supporting both single-point and range selection
  • Dynamic Polygon Coloring: Real-time color updates based on data and user-defined rules
  • Data Integration: Open-Meteo API integration for weather data visualization
  • State Persistence: Automatic saving/loading of dashboard state using localStorage

Advanced Features

  • Responsive Design: Fully responsive layout that works on desktop, tablet, and mobile
  • Interactive Tooltips: Hover tooltips showing detailed polygon information
  • Smooth Animations: Polished UI with smooth transitions and hover effects
  • Mobile-First Sidebar: Collapsible sidebar with overlay for mobile devices
  • Real-time Updates: Automatic data refresh when timeline changes

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn package manager

Installation

  1. Clone the repository

    git clone <repository-url>
    cd data-dashboard
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev
  4. Open in browser Navigate to http://localhost:3000

πŸ“– Usage Guide

Drawing Polygons

  1. Click the "Draw Polygon" button in the top-right corner of the map
  2. Click on the map to add points (minimum 3, maximum 12 points)
  3. Double-click to finish drawing
  4. The polygon will appear in the sidebar for configuration

Timeline Control

  • Toggle between modes: Use the "Point" and "Range" buttons to switch between single-time and time-range selection
  • Single mode: Drag the handle to select a specific time
  • Range mode: Drag either handle to define a time window
  • Click to jump: Click anywhere on the timeline to quickly jump to that time

Color Rules Configuration

  1. Select a polygon from the sidebar
  2. Choose a data field (Temperature, Humidity, Precipitation, Wind Speed)
  3. Add color rules by setting:
    • Operator: <, ≀, >, β‰₯
    • Threshold value: Numerical threshold
    • Color: Color to apply when condition is met
  4. Rules are applied in order - first matching rule determines polygon color

Map Interaction

  • Pan: Drag to move around the map
  • Reset View: Click "Reset View" to return to default position
  • Polygon Tooltips: Hover over polygons to see detailed information
  • Fixed Zoom: Zoom is locked to ~2 sq km resolution for consistent data analysis

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js app router
β”‚   β”œβ”€β”€ layout.tsx         # Root layout component
β”‚   β”œβ”€β”€ page.tsx           # Main dashboard page
β”‚   └── globals.css        # Global styles
β”œβ”€β”€ components/            # React components
β”‚   β”œβ”€β”€ layout/            # Layout components
β”‚   β”œβ”€β”€ map/               # Map-related components
β”‚   β”œβ”€β”€ timeline/          # Timeline slider components
β”‚   β”œβ”€β”€ sidebar/           # Sidebar and control components
β”‚   └── ui/                # Reusable UI components (shadcn/ui)
β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”œβ”€β”€ usePolygonData.ts  # Data fetching and polygon management
β”‚   └── useStatePersistence.ts # State persistence logic
β”œβ”€β”€ services/              # API services
β”‚   └── openMeteoApi.ts    # Open-Meteo API integration
β”œβ”€β”€ stores/                # State management
β”‚   └── useStore.ts        # Zustand store configuration
β”œβ”€β”€ types/                 # TypeScript type definitions
β”‚   └── index.ts           # Application types
└── utils/                 # Utility functions
    └── polygonColoring.ts # Color rule application logic

πŸ› οΈ Tech Stack

Required Technologies

Additional Libraries

  • Date Handling: date-fns
  • Icons: Lucide React
  • API Integration: Native fetch with custom service layer

🌐 API Integration

Open-Meteo Archive API

The application integrates with the Open-Meteo Archive API to fetch historical weather data.

Available Data Fields:

  • Temperature (Β°C)
  • Relative Humidity (%)
  • Precipitation (mm)
  • Wind Speed (m/s)

API Configuration:

  • No API key required
  • Automatic timezone detection
  • Hourly resolution data
  • Historical data archive access

🎨 Design Decisions

Architecture Choices

  1. Component-Based Architecture: Modular design with clear separation of concerns
  2. Custom Hooks: Business logic separated into reusable hooks
  3. Type Safety: Full TypeScript coverage for robust development
  4. Performance: Optimized rendering with proper dependency management

UI/UX Decisions

  1. Mobile-First: Responsive design starting from mobile viewport
  2. Accessibility: Semantic HTML and proper ARIA labels
  3. Visual Hierarchy: Clear information architecture with consistent spacing
  4. Interactive Feedback: Hover states, transitions, and loading indicators

State Management

  • Zustand Store: Lightweight, performant state management
  • Local Storage: Persistent state across browser sessions
  • Reactive Updates: Automatic data refresh on timeline changes

πŸš€ Deployment

Build for Production

npm run build
npm start

Deploy to Vercel (Recommended)

  1. Push code to GitHub repository
  2. Connect repository to Vercel
  3. Automatic deployment on each push to main branch

Deploy to Netlify

  1. Build the application: npm run build
  2. Deploy the out folder to Netlify

πŸ”§ Configuration

Environment Variables

No environment variables are required for basic functionality. All API calls use public endpoints.

Customization

  • Map Center: Modify default coordinates in src/stores/useStore.ts
  • Time Window: Adjust timeline window in store configuration
  • API Endpoints: Extend API services in src/services/
  • Color Schemes: Customize default color rules in src/utils/polygonColoring.ts

πŸ› Troubleshooting

Common Issues

Map not loading:

  • Check internet connection for tile server access
  • Verify Leaflet CSS is properly imported

API errors:

  • Open-Meteo API requires internet connection
  • Check browser console for detailed error messages

State not persisting:

  • Ensure localStorage is available in browser
  • Check for storage quota limitations

πŸ“ Development Notes

Code Quality

  • ESLint configuration for code consistency
  • TypeScript strict mode enabled
  • Component-level error boundaries
  • Comprehensive type coverage

Performance Optimizations

  • React.memo for expensive components
  • Debounced API calls
  • Efficient re-rendering with Zustand
  • Lazy loading for large datasets

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

This project is created for educational purposes as part of the Mind Webs Ventures Software Development Engineering Internship assignment.

πŸ™ Acknowledgments

  • Open-Meteo: Free weather API service
  • shadcn/ui: Beautiful, accessible UI components
  • Leaflet: Open-source mapping library
  • Next.js Team: Outstanding React framework

Built with ❀️ using modern web technologies