ctkchart is a Python library for creating live updating line charts in customtkinter.
Project description
Features
- Live Update: Display live data with line charts.
- Multiple Lines: Support for plotting multiple lines on the same chart for easy comparison.
- Color Customization: Customize colors to match your application's design or data representation.
- Dynamic Color Change: Dynamic Color Change for Dark & Light.
- Font Customization: Adjust fonts for text elements to enhance readability.
- Dimension Customization: Customize chart dimensions to fit various display sizes and layouts.
Importing & Installation
-
Installation
pip install ctkchart
-
Importing
import ctkchart
Simple Guide
-
import package
import ctkchart
-
Create Line Chart and place 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)
-
Create Line
line = ctkchart.CTkLine(master=chart)
-
Display Data display data using a loop
def loop(): while True: random_data = random.choice(range(100, 900)) chart.show_data(line=line, data=[random_data]) time.sleep(1) #call the loop as thead theading.Thread(target=loop).start()
Full Code Example
import ctkchart # <- import the package
import tkinter
import random
import threading
import time
#create window
root = tkinter.Tk()
#create 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) #place chrt
#create line
line = ctkchart.CTkLine(master=chart)
def loop():
while True:
random_data = random.choice(range(100, 900)) #get random data
chart.show_data(line=line, data=[random_data]) # <- display data using chart
time.sleep(1) #wait 1 sec
#call the loop as thead
threading.Thread(target=loop).start()
root.mainloop()
Links
- Documentation
- GitHub Repository : ctkchart
Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ctkchart-2.1.4.tar.gz
(25.9 kB
view details)
Built Distribution
ctkchart-2.1.4-py3-none-any.whl
(25.5 kB
view details)
File details
Details for the file ctkchart-2.1.4.tar.gz
.
File metadata
- Download URL: ctkchart-2.1.4.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00d34973aa2a79b7f5f4fc2de02ae35da5694441872121273690b07f5505ab7 |
|
MD5 | 72586ab076ee5608d1358756e431ba12 |
|
BLAKE2b-256 | a36030814ec416e32fe378398cf1f0271ed59d3c3ebba51d4ab7e4ebf28304cd |
File details
Details for the file ctkchart-2.1.4-py3-none-any.whl
.
File metadata
- Download URL: ctkchart-2.1.4-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbebe4c5a9678e512a6428449350d90769caf785ae0502ff4e01dd492f597901 |
|
MD5 | f252d84a10d0bda84fda337621fd88c6 |
|
BLAKE2b-256 | df644e25600334d4649a23ceb0f83244b627af98064fd3d390c96974d043a0a7 |