Skip to main content

A Streamlit component for rendering donut metrics/visuals

Project description

streamlit-donut is a Streamlit component for rendering customizable donut charts/metrics. This package allows you to easily create visually appealing donut charts/metrics 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
st_donut(
    label="Project Completion",
    value=89,
    outOf=100,
    units="days",
    size=150,
    value_text_color="purple",
    text_size=24,
    background_stroke_width=10,
    arc_stroke_width=20,
    direction="clockwise",
    delta="90%",
    rounded=True,
    label_visibility=True,
    hide_background=True,
)

Parameters

  • label (str): The label for the donut chart/metric.
  • value (float): The current value to be displayed on the donut chart/metric.
  • outOf (float, optional): The maximum value of the donut chart/metric. Default is 100.
  • units (str, optional): The units to be displayed next to the value. Default is an empty string.
  • delta (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.(px)
  • size (int, optional): The size of the donut chart/metric. Default is 180. (px).
  • direction (Literal["clockwise", "anticlockwise"], optional): The direction of the donut chart/metric. Default is "clockwise".
  • text_size (int, optional): The font size of the main value. Default is 50.(px)
  • delta_text_size (int, optional): The font size of the delta value. Default is 18.(px)
  • value_text_color (str, optional): The color of the main value text. Default is None.
  • arc_bg_color (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 (int, optional): The stroke width of the arc. Default is None but falls back to background_stroke_width.
  • 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-benjaminlry & st.metric().

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.6.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.6-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: streamlit_donut-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 c6a5d3ba9fa777f1ccdb6f6340d3d60161a5f20d72257e68aacf012c6087535a
MD5 58ac926281b2f9b0b1ada63fc65b0597
BLAKE2b-256 60bd19a94c61c6d5e277ea8132bb81f745b639bd737adf144ba19335ca397a42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_donut-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 13619a347337b6856ea8155a20e9cd632f0eb8feae85e0684cd53790fed59f1a
MD5 62654adcd7ceb5fd785fe2566e23e9e8
BLAKE2b-256 d7eefb82ca0fda3837ed024fce94cbb950a8f1c37f995a1b7c7ac76cd11f5cc4

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