Metadata-Version: 2.4
Name: ctkchart
Version: 2.2.0
Summary: A lightweight Python library for creating animated, live-updating line charts natively in CustomTkinter — the modern dark-mode Tkinter framework.
Author: Thisal-D
License: Copyright (c) 2024 The Python Packaging Authority
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: homepage, https://github.com/Thisal-D/ctkchart
Project-URL: repository, https://github.com/Thisal-D/ctkchart
Project-URL: issues, https://github.com/Thisal-D/ctkchart/issues
Keywords: customtkinter,customtkinter-widget,ctkchart,line-chart,live-chart,real-time-plot,python-gui,data-visualization,desktop-dashboard,dark-mode-chart,animated-chart,ctk-component,python-chart,live-updating-chart,sensor-data-plot
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: customtkinter
Provides-Extra: dev
Dynamic: license-file

[![Chinese](https://img.shields.io/badge/Language-中文-red)](https://github.com/thisal-d/ctkchart/blob/main/README_zh.md)


<div align="center">

# ctkchart

**A Python library for creating live-updating line charts in CustomTkinter.**

[![PyPI version](https://badge.fury.io/py/ctkchart.svg)](https://pypi.org/project/ctkchart/)

[![Downloads](https://static.pepy.tech/badge/ctkchart)](https://pepy.tech/project/ctkchart)
![Downloads last 6 month](https://static.pepy.tech/personalized-badge/ctkchart?period=total&units=international_system&left_color=grey&right_color=BLUE&left_text=downloads%20last%206%20month)
[![Downloads/Month](https://static.pepy.tech/badge/ctkchart/month)](https://pepy.tech/project/ctkchart)
[![Downloads/Week](https://static.pepy.tech/badge/ctkchart/week)](https://pepy.tech/project/ctkchart)

[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/thisal-d/ctkchart/blob/main/LICENSE)


</div>

---

[🎥 **Watch the Main Demo Video on GitHub**](https://github.com/Thisal-D/tkchart/assets/93121062/6f1e844f-d51c-467a-a3dc-ee03fea78fc9)

---

## ✨ Features

| Feature                    | Description                                                |
| -------------------------- | ---------------------------------------------------------- |
| ⚡ **Live Updates**        | Stream and display real-time data continuously             |
| 📉 **Multiple Lines**      | Plot several lines on the same chart for easy comparison   |
| 🎨 **Color Customization** | Tailor colors to match your app's design                   |
| 🌓 **Dynamic Theme**       | Dynamic color change for dark & light themes               |
| 🔤 **Font Customization**  | Adjust text fonts for better readability                   |
| 📐 **Dimension Control**   | Resize charts to fit any layout                            |
| 🎛️ **Granular Config**     | Fine-grained control via `configure_*()` methods (v2.2.0+) |

> 📋 [**See what's new in the latest release →**](https://github.com/thisal-d/ctkchart/blob/main/CHANGES_en.md)

---

## 📦 Installation

```bash
pip install ctkchart
```

```python
import ctkchart
```

---

## 🚀 Quick Start

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()

# 1. Create the chart
chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("a", "b", "c", "d", "e", "f"),
    y_axis_values=(100, 900)
)
chart.place(x=10, y=10)

# 2. Create a line
line = ctkchart.CTkLine(master=chart)

# 3. Stream data in a background thread
def loop():
    while True:
        chart.show_data(line=line, data=[random.choice(range(100, 900))])
        time.sleep(1)

threading.Thread(target=loop, daemon=True).start()
root.mainloop()
```

---

## 🎬 Live Examples

### 1 — Simple

[▶️ **View Simple Demo Video on GitHub**](https://github.com/Thisal-D/ctkchart/assets/93121062/6f1e844f-d51c-467a-a3dc-ee03fea78fc9)

<details>
<summary>View code</summary>

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()
root.configure(fg_color="#0d1117")
root.geometry("720x430+200+200")

line_chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
    y_axis_values=(0, 1000)
)
line_chart.pack(pady=15)

line = ctkchart.CTkLine(master=line_chart)

def display_data():
    while True:
        line_chart.show_data(line=line, data=[random.choice(range(0, 1000))])
        time.sleep(0.5)

threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
```

</details>

---

### 2 — Styled & Filled Line

[▶️ **View Styled & Filled Line Demo Video on GitHub**](https://github.com/Thisal-D/ctkchart/assets/93121062/afe56452-68c3-44f0-9c67-2ab6f6910f6e)

<details>
<summary>View code</summary>

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()
root.configure(fg_color="#0d1117")
root.geometry("720x430+200+200")

line_chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
    y_axis_values=(0, 1000),
    y_axis_label_count=10,
)
line_chart.pack(pady=15)

line = ctkchart.CTkLine(
    master=line_chart,
    size=2,
    fill="enabled"
)

def display_data():
    while True:
        line_chart.show_data(line=line, data=[random.choice(range(0, 1000))])
        time.sleep(0.5)

threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
```

</details>

---

### 3 — 2 Lines with Different Styles

[▶️ **View 2 Lines Demo Video on GitHub**](https://github.com/Thisal-D/ctkchart/assets/93121062/9bc35a39-a8ca-4942-9fc7-a1c89d1bd1bc)

<details>
<summary>View code</summary>

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()
root.configure(fg_color=("#ffffff", "#0d1117"))
root.geometry("720x430+200+200")

line_chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
    y_axis_values=(0, 1000),
    y_axis_label_count=10,
)
line_chart.pack(pady=15)

line1 = ctkchart.CTkLine(
    master=line_chart,
    color=("#5dffb6", "#5dffb6"),
    size=2,
    style="dashed",
    style_type=(10, 5),
)

line2 = ctkchart.CTkLine(
    master=line_chart,
    color=("#FFBAD2", "#FFBAD2"),
    size=2,
    point_highlight="enabled",
    point_highlight_color=("#FFBAD2", "#FFBAD2"),
)

def display_data():
    while True:
        line_chart.show_data(line=line1, data=[random.choice(range(0, 1000))])
        line_chart.show_data(line=line2, data=[random.choice(range(0, 1000))])
        time.sleep(0.5)

threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
```

</details>

---

### 4 — 3 Lines with Different Styles

[▶️ **View 3 Lines Demo Video on GitHub**](https://github.com/Thisal-D/ctkchart/assets/93121062/6d568b70-2ceb-42d0-b93c-0096f2745134)

<details>
<summary>View code</summary>

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()
root.configure(fg_color=("#ffffff", "#0d1117"))
root.geometry("720x430+200+200")

line_chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
    y_axis_values=(0, 1000),
    y_axis_label_count=10,
)
line_chart.pack(pady=15)

line1 = ctkchart.CTkLine(master=line_chart, size=2, fill="enabled")

line2 = ctkchart.CTkLine(
    master=line_chart,
    color=("#5dffb6", "#5dffb6"),
    size=2,
    style="dashed",
    style_type=(10, 5),
)

line3 = ctkchart.CTkLine(
    master=line_chart,
    color=("#FFBAD2", "#FFBAD2"),
    size=2,
    point_highlight="enabled",
    point_highlight_color=("#FFBAD2", "#FFBAD2"),
)

def display_data():
    while True:
        line_chart.show_data(line=line1, data=random.choices(range(0, 1000), k=1))
        line_chart.show_data(line=line2, data=random.choices(range(0, 1000), k=1))
        line_chart.show_data(line=line3, data=random.choices(range(0, 1000), k=1))
        time.sleep(0.5)

threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
```

</details>

---

### 5 — With Grid Sections

[▶️ **View Grid Sections Demo Video on GitHub**](https://github.com/Thisal-D/ctkchart/assets/93121062/c2838fd6-3a0f-45be-bb39-9953d007067d)

<details>
<summary>View code</summary>

```python
import customtkinter as ctk
import ctkchart
import random
import threading
import time

root = ctk.CTk()
root.configure(fg_color=("#ffffff", "#0d1117"))
root.geometry("720x430+200+200")

line_chart = ctkchart.CTkLineChart(
    master=root,
    x_axis_values=("01-01", "01-02", "01-03", "01-04", "01-05", "01-06", "01-07", "01-08", "01-09", "01-10"),
    y_axis_values=(0, 1000),
    y_axis_label_count=10,
    y_axis_section_count=10,
    x_axis_section_count=10,
)
line_chart.pack(pady=15)

line1 = ctkchart.CTkLine(
    master=line_chart,
    color=("#5dffb6", "#5dffb6"),
    size=2,
    style="dashed",
    style_type=(10, 5),
)

line2 = ctkchart.CTkLine(
    master=line_chart,
    color=("#FFBAD2", "#FFBAD2"),
    size=2,
    point_highlight="enabled",
    point_highlight_color=("#FFBAD2", "#FFBAD2"),
)

def display_data():
    while True:
        line_chart.show_data(line=line1, data=[random.choice(range(0, 1000))])
        line_chart.show_data(line=line2, data=[random.choice(range(0, 1000))])
        time.sleep(0.5)

threading.Thread(target=display_data, daemon=True).start()
root.mainloop()
```

</details>

---

### 6 — Light and Dark theme

**For every parameter that involves color in ctkchart, you can provide either**:
- A single string representing the color.
- A tuple of two strings where the first string represents the color for the light theme and the second string represents the color for the dark theme.

[▶️ **View Dynamic Theme Demo Video on GitHub**](https://github.com/user-attachments/assets/9fed4b83-5b03-4ea0-82a0-36029dfc93dd)

---

## 📚 Documentation

Explore all parameters, configuration methods, and advanced usage:

- 📖 [**English Documentation**](https://github.com/thisal-d/ctkchart/blob/main/documentation/DOCUMENTATION_en.md)
- 🇨🇳 [**Chinese Documentation**](https://github.com/thisal-d/ctkchart/blob/main/documentation/DOCUMENTATION_zh.md)
- 🐍 [**PyPI Package**](https://pypi.org/project/ctkchart/)

---

## 👥 Contributors

- [<img src="https://github.com/childeyouyu.png?size=25" width="25">](https://github.com/childeyouyu) [youyu](https://github.com/childeyouyu)
