A comprehensive collection of interactive data visualizations built with D3.js v7, showcasing various charting techniques and data manipulation methods.
- Interactive Visualizations: Multiple examples demonstrating D3.js capabilities
- Vancouver Trails Visualization: Geographic data visualization of hiking trails
- Scalable Architecture: Modular JavaScript structure for easy extension
- Responsive Design: CSS styling for optimal viewing across devices
βββ index.html # Main landing page
βββ vancouver_trails_viz.html # Vancouver trails visualization
βββ without_js.html # Static version without JavaScript
βββ css/
β βββ style.css # Styling for visualizations
βββ js/
β βββ d3.v7.min.js # D3.js library
β βββ main.js # Main application logic
β βββ scale.js # Scaling utilities
β βββ trails_viz.js # Trails visualization logic
βββ data/
βββ vancouver_trails.csv # Trail data for visualizations
- Modern web browser with JavaScript enabled
- Local web server (required for data loading)
To avoid CORS errors when loading data files, you MUST serve this project through a local web server instead of opening HTML files directly in the browser.
Opening HTML files statically (e.g., double-clicking or file:// protocol) will result in data loading failures due to browser security restrictions.
-
Clone the repository:
git clone https://github.com/emadof85/D3-Data-Visualization-Examples.git cd D3-Data-Visualization-Examples -
Start a local web server:
Choose one of the following methods:
Using Python 3:
python -m http.server 8000
Then navigate to:
http://localhost:8000Using Python 2:
python -m SimpleHTTPServer 8000
Then navigate to:
http://localhost:8000Using Node.js (if you have http-server installed):
npx http-server -p 8000
Then navigate to:
http://localhost:8000Using PHP:
php -S localhost:8000
Then navigate to:
http://localhost:8000Using Ruby:
ruby -run -e httpd . -p 8000Then navigate to:
http://localhost:8000 -
Open your browser and navigate to the served URL to view the visualizations.
- Main Dashboard (
index.html): Overview of available visualizations - Vancouver Trails (
vancouver_trails_viz.html): Interactive map showing hiking trails with difficulty ratings and elevation data - Static Version (
without_js.html): Non-interactive version for comparison
The project follows a modular structure:
- HTML files provide the structure and entry points
- JavaScript modules handle data processing and visualization logic
- CSS provides responsive styling and visual enhancements
- CSV data contains the raw trail information for visualizations
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-visualization) - Commit your changes (
git commit -m 'Add amazing visualization') - Push to the branch (
git push origin feature/amazing-visualization) - Open a Pull Request
This project is open source and available under the MIT License.
For questions or suggestions, please open an issue on GitHub.
Note: Ensure your local server is running before attempting to view any visualizations to prevent data loading errors.