Skip to main content

Pychartjs

Pychartjs is a Python library for generating dynamic charts using Chart.js and integrating them into web applications. The library is built on top of the Trunco framework, which provides a component-based architecture to make it easy to create and manage various chart types.

Features

  • Support for all major chart types: Line, Bar, Pie, Doughnut, Radar, PolarArea, Bubble, and Scatter.
  • Integration with various web frameworks including Robyn, Django, FastAPI, and other Python web frameworks.
  • Dynamic chart rendering with context variables.
  • Flexible and customizable chart options.

Project Structure

pychartjs/
├── pychartjs/
│   ├── __init__.py
│   ├── charts.py
│   ├── datasets.py
│   ├── enums.py
│   ├── options.py
│   ├── scales.py
│   ├── plugins.py
│   ├── colors.py
├── tests/
│   ├── test_charts.py
│   ├── test_datasets.py
│   ├── test_options.py
│   ├── test_scales.py
│   ├── test_plugins.py
│   ├── test_colors.py
├── integration_tests/
│   ├── app.py
│   └── templates/
│       └── index.html
├── LICENSE
├── README.md
├── poetry.lock
└── pyproject.toml
  • pychartjs/: Contains the core library code, including charts, datasets, enums, options, and scales.
  • tests/: Unit tests for the various components of the library.
  • integration_tests/: A sample application that demonstrates how to integrate pychartjs with a web framework like Robyn.

Installation

  1. Install with Poetry:

    If you are using Poetry for dependency management, you can add pychartjs to your project with:

    poetry add pychartjs
    
  2. Alternatively, install with pip:

    If you're using pip, you can install pychartjs with:

    pip install pychartjs
    

Usage

Running the Integration Tests

The project includes an integration test that sets up a simple web server with Robyn to display all chart types.

  1. Navigate to the integration_tests directory:

    cd integration_tests
    
  2. Run the Application:

    Start the web server:

    python app.py
    
  3. View in Browser:

    Open your browser and go to http://localhost:8080. You should see a page displaying all the supported chart types.

Adding New Charts

To add a new chart type or customize an existing one, modify the app.py file and create new chart instances there.

Context Variables

The charts can be dynamically generated with context variables. For example, you can pass a year or month variable to customize the labels and datasets.

Integration with Other Web Frameworks

Pychartjs is flexible and can be integrated with other popular Python web frameworks such as:

  • Django: Easily render charts within Django views and templates.
  • FastAPI: Use Pychartjs to generate charts in FastAPI routes.
  • Flask: Integrate with Flask to display dynamic charts.
  • Any other WSGI/ASGI framework: Pychartjs can be adapted to work with any Python web framework that supports WSGI or ASGI.

Metadata

Release files for pychartjs 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pychartjs 1.0.0
File Size Uploaded
pychartjs-1.0.0.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pychartjs 1.0.0
File Interpreter ABI Platform
pychartjs-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / pychartjs-1.0.0.tar.gz

Download URL pychartjs-1.0.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e797607db47ddf983a5b19b510d39c10bef376dfa0dac5332dfe1c4c2112176e
BLAKE2b-256 checksum
How to use checksums
132787d0f9d362cd346f1676b2f15d4aee4c6a146474d3c94c5091b3505180eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

Release files / pychartjs-1.0.0-py3-none-any.whl

Download URL pychartjs-1.0.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e2e6395fb9973bbacade9cc6b9d3fe4377f3731a331962683690b3f04bb3fd
BLAKE2b-256 checksum
How to use checksums
8a6755480ad73ebfd5e7441e1eb737902884ab27fb3c49a04576b4b698885fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.9.2

1 release file

0.9.0

1 release file

0.8.9

1 release file

0.8.7

1 release file

0.8.4

1 release file

0.8.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page