Charts Visualization
This project provides a web-based service for generating and visualizing bar and pie charts from structured data using FastAPI and Altair. Charts are generated as PNG images and served via a REST API.
Features
Generate bar and pie charts from input data
Save charts as PNG images in a static directory
Access generated charts via unique URLs
Extensible with new chart types
Related MCP server: MCP Chart Server
Project Structure
Setup
Clone the repository:
git clone <repo-url> cd charts_visualizationCreate a virtual environment and install dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Running the Server
Start the FastAPI server (from the project root):
Or with Uvicorn:
for inspection :
Usage
Use the provided client (
src/client.py) or send requests to the/mcpendpoint to generate charts.Generated charts are saved in
static/charts/and accessible via URLs likehttp://localhost:8000/static/charts/<chart_id>.png.
Requirements
Python 3.9+
FastAPI
Uvicorn
Altair
(See
requirements.txtfor full list)
Extending
To add new chart types, implement a new function in src/charts/, register it as an MCP tool in src/server.py, and update the client as needed.
License
MIT License