Viewing a saved revision (read-only)
c3d5ba0d579e479884ebe9ac91a3ec75
Team 3 - Tankvergleich
An interactive SVG map of Europe visualizes average fuel prices per country, with a hover tooltip showing the country name and price, and a click-to-edit feature that allows users to adjust values in a pinned info box. Built with Svelte and D3.js, the map uses a D3 Geo Mercator projection and `d3.geoPath` for rendering, while a custom color scale (`d3.scaleLinear`) maps price ranges from green to red. Fuel type can be switched between Euro 95, Diesel, and LPG, with prices stored in a data store and persisted to localStorage.
AI-generated descriptionEurope Gasoline Prices
An interactive map of Europe built with Svelte and D3.js, allowing you to:
- Hover over countries to see their name and average gasoline price
- Click to pin a country and edit its price
- Edit prices inline with an input field
- All data persists in memory during the session
Features
- Interactive SVG map of Europe with responsive sizing
- Real-time hover tooltips following the cursor
- Clickable, pinnable info boxes for price editing
- Clean, minimal UI with modern styling
- D3-powered geo projection and path generation
- Graceful handling of missing data ("Keine Daten")
Project Structure
App.svelte- Main application entry pointsrc/lib/EuropeMap.svelte- Map component with D3 geo renderingsrc/lib/CountryInfo.svelte- Hover/pinned info box componentsrc/lib/data/prices.js- Price data store and utilitiesindex.js- VizHub entry point
How to Use
- Paste all files into your VizHub project
- The map loads automatically from the remote GeoJSON source
- Hover over any country to see its current price
- Click a country to pin the info box and edit its price
- Click outside or click another country to unpin
Data
Prices are stored in memory using a Svelte store with initial values for:
- Germany, France, Italy, Spain, Poland, Netherlands
Add more countries by editing src/lib/data/prices.js.
Tech Stack
- Svelte – UI rendering and state management
- D3.js – Geo projection, paths, and bounds calculations
- GeoJSON – Remote Europe map data