Skip to main content

git@github.com:tavallaie/pychartjs.git

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pychartjs-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

pychartjs-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pychartjs-1.0.0.tar.gz.

File metadata

  • Download URL: pychartjs-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for pychartjs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e797607db47ddf983a5b19b510d39c10bef376dfa0dac5332dfe1c4c2112176e
MD5 189675938e9aecde1a6507334111dcfe
BLAKE2b-256 132787d0f9d362cd346f1676b2f15d4aee4c6a146474d3c94c5091b3505180eb

See more details on using hashes here.

File details

Details for the file pychartjs-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pychartjs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for pychartjs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70e2e6395fb9973bbacade9cc6b9d3fe4377f3731a331962683690b3f04bb3fd
MD5 41c59e6107e792e6020b0b5df0872a7f
BLAKE2b-256 8a6755480ad73ebfd5e7441e1eb737902884ab27fb3c49a04576b4b698885fa9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page