Beautiful interactive charts for mobile using Flutter with D3.js integration. This project demonstrates how to embed D3.js visualizations in Flutter web applications using iframes.
- Streamgraph Chart: Interactive flowing data visualization with hover effects and smooth animations
- Zoomable Circle Packing: Hierarchical circle visualization with zoom and pan interactions
- Responsive Design: Charts adapt to different screen sizes
- Web Optimized: Uses iframe integration for seamless D3.js embedding
flutter-d3/
├── lib/
│ ├── main.dart # Flutter app entry point
│ └── simple_chart.dart # Chart widget with iframe integration
├── public/
│ ├── example-1.html # Streamgraph D3.js implementation
│ └── example-2.html # Zoomable circles D3.js implementation
├── server.js # Node.js server for serving D3.js charts
└── package.json # Server dependencies
- Flutter SDK
- Node.js (for serving D3.js charts)
- Chrome or any modern web browser
-
Clone the repository
git clone <your-repo-url> cd flutter-d3
-
Install Flutter dependencies
flutter pub get
You need to run both the D3.js server and the Flutter web app:
In the project root directory:
node server.js
You should see:
Server running on http://localhost:3000
Verify server is working:
- Visit
http://localhost:3000/example-1
to see the Streamgraph - Visit
http://localhost:3000/example-2
to see the Zoomable Circles
In a new terminal window, from the project root:
flutter run -d web-server --web-port 8080
Wait for the compilation to complete. You should see:
lib/main.dart is being served at http://localhost:8080
Open your web browser and navigate to:
http://localhost:8080
You should see both D3.js charts integrated within the Flutter app interface.
While the Flutter app is running, you can make changes to the Dart code and press r
in the terminal to hot reload.
- Edit
public/example-1.html
for the Streamgraph - Edit
public/example-2.html
for the Zoomable Circles - Refresh the browser to see D3.js changes
- Web: Full D3.js chart integration
- Mobile: Shows placeholder (charts are web-only in this implementation)
- Ensure port 3000 is not in use by other applications
- Check that all HTML files exist in the
public/
directory
- Run
flutter clean
thenflutter pub get
- Ensure you're using a recent version of Flutter
- Check that the web platform is enabled:
flutter config --enable-web
- Verify both servers are running (ports 3000 and 8080)
- Check browser console for CORS or network errors
- Ensure D3.js CDN is accessible
- Flutter: UI framework for web application
- D3.js: Data visualization library
- Node.js: Server for serving D3.js charts
- HTML/CSS/JavaScript: Chart implementations
- Add more D3.js chart types
- Implement mobile-native chart alternatives
- Add data binding between Flutter and D3.js
- Deploy to production with proper CORS configuration
This project is open source and available under the MIT License.