← Back to all products
$29
Data Visualizer
Pure Python SVG chart generator for line, bar, pie, and scatter charts from JSON/CSV data.
PythonMarkdownJSON
Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
Interactive Reader (Free Preview) ⚙ Try Demo Tools Download Free SampleFile Structure 15 files
data-visualizer/
├── LICENSE
├── README.md
├── examples/
│ └── sample_chart_data.csv
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_input-format.md
│ └── 04_faq.md
├── index.html
├── interactive.html
├── src/
│ ├── __pycache__/
│ │ └── data_visualizer.cpython-312.pyc
│ └── data_visualizer.py
└── tests/
├── __pycache__/
│ └── test_data_visualizer.cpython-312-pytest-9.0.2.pyc
└── test_data_visualizer.py
Documentation Preview README excerpt
Data Visualizer
Pure Python SVG chart generator: create publication-ready line, bar, pie, and scatter charts from JSON/CSV data. Zero external dependencies.
Features
- Four chart types — Bar, line, pie, and scatter plots
- Pure SVG output — Scalable vector graphics, works in any browser or image viewer
- Auto-detection — Picks sensible column defaults from your data
- Nice axis ticks — Automatically rounds tick values for clean labels (100, 200, 300 not 97, 194, 291)
- Dark theme — Designed for dark backgrounds with high-contrast colors
- Multi-series line charts — Compare multiple data series on one chart
- Smart number formatting — 1,500,000 becomes 1.5M, 2,300 becomes 2.3K
- 10-color palette — Accessibility-tested colors with enough contrast
- CLI-friendly — One command to generate a chart
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Bar chart from CSV
python src/data_visualizer.py --data examples/sample_chart_data.csv --chart bar --x month --y revenue
# Line chart
python src/data_visualizer.py --data examples/sample_chart_data.csv --chart line --x month --y revenue
# Pie chart
python src/data_visualizer.py --data examples/sample_chart_data.csv --chart pie --label month --value revenue
# Scatter plot
python src/data_visualizer.py --data data.csv --chart scatter --x users --y revenue --title "Users vs Revenue"
# Custom output and color
python src/data_visualizer.py --data data.json --chart bar --output dashboard_chart.svg --color "#FF3366"
Chart Types
| Type | Best For | Required Columns |
|---|---|---|
bar | Categorical comparisons (revenue by month) | x (labels), y (values) |
line | Time series trends (growth over time) | x (labels), y (values) |
pie | Part-of-whole (market share, budget) | label, value |
scatter | Correlation analysis (users vs revenue) | x (numeric), y (numeric) |
Input Format
Any JSON array or CSV with at least 2 columns:
month,revenue,users
Jan,42500,185
Feb,45800,201
Mar,48200,218
... continues with setup instructions, usage examples, and more.
Code Sample .py preview
src/data_visualizer.py
#!/usr/bin/env python3
"""
Data Visualizer — Analytics Hub (DataNest)
Pure Python SVG chart generator: line, bar, pie, and scatter charts from
JSON/CSV data. Publication-ready graphics with no external dependencies.
Usage:
python data_visualizer.py --data sales.csv --chart bar --x month --y revenue
python data_visualizer.py --data metrics.json --chart line --output chart.svg
python data_visualizer.py --data survey.csv --chart pie --label category --value count
Dependencies: Python 3.10+ stdlib only (no pip packages)
License: MIT
"""
from __future__ import annotations
import argparse
import csv
import html
import json
import logging
import math
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
logger = logging.getLogger("data_visualizer")
# ---------------------------------------------------------------------------
# Configuration — chart dimensions and styling
# ---------------------------------------------------------------------------
# Default chart dimensions (SVG viewBox units, not pixels)
DEFAULT_WIDTH = 800
DEFAULT_HEIGHT = 500
PADDING = 60
# Color palette — carefully chosen for accessibility and dark backgrounds.
# Each color has enough contrast against both dark (#0A0E1A) and light (#FFF).
COLORS = [
"#00E5FF", # Cyan (brand)
"#FF3366", # Pink
"#FFD600", # Yellow
"#00E676", # Green
"#7C4DFF", # Purple
"#FF6D00", # Orange
"#448AFF", # Blue
"#FF4081", # Hot pink
# ... 578 more lines ...