Skip to main content

A Streamlit component for rendering donut metrics/visuals

Project description

Streamlit Donut

streamlit-donut is a Streamlit component for rendering customizable donut charts. This package allows you to easily create visually appealing donut charts in your Streamlit applications.

Installation

You can install the package using pip:

pip install streamlit-donut

Usage

Here is an example of how to use the st_donut function in your Streamlit application:

import streamlit as st
from streamlit_donut import st_donut

# Example usage
progress = st.slider("Progress", -100, 100, 10)
size = 200
text_size = 24

st_donut(
    label="Site Completion",
    value=progress,
    outOf=100,
    units="%",
    size=size,
    value_text_color="purple",
    text_size=text_size,
    background_stroke_width=30,
    arc_stroke_width=40,
    direction="clockwise",
    delta="-10%",
    rounded=True,
    label_visibility=True,
    hide_background=True,
)

Parameters

  • label (str): The label for the donut chart.
  • value (float): The current value to be displayed on the donut chart.
  • outOf (float, optional): The maximum value of the donut chart. Default is 100.
  • units (str, optional): The units to be displayed next to the value. Default is an empty string.
  • delta (Optional[str], optional): The delta value to be displayed below the main value. Default is None.
  • space (int, optional): The vertical space between the main value and the delta value. Default is 30.
  • size (int, optional): The size of the donut chart. Default is 180.
  • direction (Literal["clockwise", "anticlockwise"], optional): The direction of the donut chart. Default is "clockwise".
  • text_size (int, optional): The font size of the main value. Default is 50.
  • delta_text_size (int, optional): The font size of the delta value. Default is 18.
  • value_text_color (Optional[str], optional): The color of the main value text. Default is None.
  • arc_bg_color (Optional[str], optional): The background color of the arc. Default is None.
  • background_stroke_width (int, optional): The stroke width of the background circle. Default is 19.
  • arc_stroke_width (Optional[int], optional): The stroke width of the arc. Default is None.
  • rounded (bool, optional): Whether the arc should have rounded edges. Default is True.
  • label_visibility (bool, optional): Whether the label should be visible. Default is True.
  • hide_background (bool, optional): Whether the background circle should be hidden. Default is False.

License

This project is licensed under the Apache License 2.0.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Acknowledgements

Inspired by this CodePen example.

Author Benson Nderitu (bent25066@gmail.com)

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

streamlit_donut-0.1.3.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_donut-0.1.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_donut-0.1.3.tar.gz.

File metadata

  • Download URL: streamlit_donut-0.1.3.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for streamlit_donut-0.1.3.tar.gz
Algorithm Hash digest
SHA256 415e3468c69cc019da64c2c8ffd1da4ccde5e525324eabab9cc65d9390b36a58
MD5 d07a6dbe334e21951acc57f0c9a388a3
BLAKE2b-256 63fcd33adce339912d1479a475fd36528a6b64ef055fda94fc263d9e96df0a86

See more details on using hashes here.

File details

Details for the file streamlit_donut-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_donut-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f61c6e16acfc7b8ab46f4ec7c8dda357b8f39013f2d0d82f6a03412e320d4226
MD5 1527f093a881df39b3b01c767a7869e2
BLAKE2b-256 c9db977ba66d4d3e6d45d7536579f9e95ca80b448d9064e9cef7b7ad2ad15a77

See more details on using hashes here.

Supported by

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