Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisal-D authored Jan 28, 2024
1 parent f6246c2 commit a53038c
Show file tree
Hide file tree
Showing 14 changed files with 726 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/test1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import tkinter
import tkchart as tkchart
import random #for get random value

#create root
root = tkinter.Tk()
root.minsize(1200,500)

#create LineChart
linechart = tkchart.LineChart(master=root,
width=1000,
height=400,
bar_size=5,

y_sections_count=5,
x_sections_count=5,
y_labels_count=5,
x_labels_count=5,

y_data="GB",
x_data="S",

x_data_min_max=(10,60),

y_data_max=1000,
x_values_decimals=4,
y_values_decimals=5,

sections_color="#707070",
y_values_color="#bbbbbb",
x_values_color="#bbbbbb",
x_data_color="#00ff00",
y_data_color="#00ff00",
bg_color="#202020",
chart_color="#101010",
bar_color="#cccccc",

x_y_data_font = ("Arial", 15,"bold"),
x_y_values_font = ("Arial", 10,"bold"),

)
#place LineChart
linechart.place(x=50 ,y=50)


#Create Line
line = tkchart.Line(master=linechart,
color="#cccccc",
size=3)

displayed = 0
max_support = 50 #60-50
data = [0,100,200,300,400,500,600,700,800,900,1000]
start = (10,60)
def loop():
global displayed
global start
linechart.show_data(data=[random.choice(data)], line=line)
displayed+=1
if displayed>50:
start = (start[0]+1,start[1]+1)
linechart.configure(x_data_min_max=((start[0],start[1])))
root.after(250,loop)
#calling to loop
loop()

root.mainloop()
26 changes: 26 additions & 0 deletions tests/test10-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import customtkinter as ctk
import tkchart
import random

root=ctk.CTk()
root.geometry("1048x599+442+239")

root.configure(fg_color="#100e17")


chart = tkchart.LineChart(master=root,
bg_color="#100e17", chart_color="#100e17",
width=900, height=400,
x_data_min_max=(0,10), y_data_max=100)
chart.pack(pady=100)

line = tkchart.Line(master=chart, size=2, mode='dash', mode_style=(5,10), color="lightblue",)


data = [x for x in range(0,101)]
def loop():
chart.show_data(line=line, data=[random.choice(data)])
root.after(500,loop)
loop()

root.mainloop()
27 changes: 27 additions & 0 deletions tests/test10-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import customtkinter as ctk
import tkchart
import random

root=ctk.CTk()
root.geometry("1048x599+442+239")

root.configure(fg_color="#ffffff")


chart = tkchart.LineChart(master=root,
bar_color="#202020", x_values_color="#202020", y_values_color="#202020",
bg_color="#ffffff", chart_color="#ffffff",
width=900, height=400,
x_data_min_max=(0,10), y_data_max=100)
chart.pack(pady=100)

line = tkchart.Line(master=chart, size=2, mode='dash', mode_style=(5,10), color="blue",)


data = [x for x in range(0,101)]
def loop():
chart.show_data(line=line, data=[random.choice(data)])
root.after(500,loop)
loop()

root.mainloop()
30 changes: 30 additions & 0 deletions tests/test11-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import customtkinter as ctk
import tkchart
import random

root=ctk.CTk()
root.geometry("1048x599+442+239")

root.configure(fg_color="#100e17")


chart = tkchart.LineChart(master=root,
bg_color="#100e17", chart_color="#100e17",
width=900, height=400,
x_data_min_max=(0,10), y_data_max=100,
x_sections_count=10, y_sections_count=10,
)
chart.pack(pady=100)

line = tkchart.Line(master=chart, size=3, mode='dash', mode_style=(10,10), color="lightblue",)
line2 = tkchart.Line(master=chart, size=3, mode='circle', mode_style=(10,10), color="lightgreen",)


data = [x for x in range(0,101)]
def loop():
chart.show_data(line=line, data=[random.choice(data)])
chart.show_data(line=line2, data=[random.choice(data)])
root.after(500,loop)
loop()

root.mainloop()
31 changes: 31 additions & 0 deletions tests/test11-2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import customtkinter as ctk
import tkchart
import random

root=ctk.CTk()
root.geometry("1048x599+442+239")

root.configure(fg_color="#ffffff")


chart = tkchart.LineChart(master=root,
bar_color="#202020", x_values_color="#202020", y_values_color="#202020",
bg_color="#ffffff", chart_color="#ffffff",
width=900, height=400,
x_data_min_max=(0,10), y_data_max=100,
x_sections_count=10, y_sections_count=10,
)
chart.pack(pady=100)

line = tkchart.Line(master=chart, size=3, mode='dash', mode_style=(10,10), color="lightblue",)
line2 = tkchart.Line(master=chart, size=3, mode='circle', mode_style=(10,10), color="lightgreen",)


data = [x for x in range(0,101)]
def loop():
chart.show_data(line=line, data=[random.choice(data)])
chart.show_data(line=line2, data=[random.choice(data)])
root.after(500,loop)
loop()

root.mainloop()
52 changes: 52 additions & 0 deletions tests/test2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import tkinter
import customtkinter
import tkchart

import os
import time

root = customtkinter.CTk()
root.configure(bg="#202020")

root.minsize(1000,900)

chart = tkchart.LineChart(root, width=950, height=250,y_data_max=1000,x_data_min_max=(50,100),x_values_decimals=5 ,y_data="GB" ,x_data="S" ,y_values_decimals=5)


chart.place(x=0, y=0)

chart.configure(x_data_color="#000000", y_data_color="#ff00ff",
x_values_color="#00ffff", y_values_color="#ff00ff",
y_labels_count=10, x_labels_count=10)



line = tkchart.Line(master=chart, color="#ff0000", size=1)

line2 = tkchart.Line(master=chart, color="#00ff00", size=1)

import random
data=[x for x in range(1,1001)]
datas = [0,1000,0,1000,0,1000,0,1000,0,1000]

index = 0
def display():
global index
chart.show_data(line=line, data=[datas[index]])
index+=1
if index>= len(datas):
index =0
root.after(500, display)
display()

i = 1
def display2():
global speed
global i
chart.show_data(line=line2, data=random.choices(data,k=1))
i = i+1
root.after(500, display2)

display2()

root.mainloop()
114 changes: 114 additions & 0 deletions tests/test3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import tkinter as tk
import tkchart as tkc


root = tk.Tk()
root.minsize(1920,1000)

def width1400():
chart.configure(width=1400)
def width700():
chart.configure(width=700)

def height900():
chart.configure(height=900)
def height500():
chart.configure(height=500)

def barsize10():
chart.configure(bar_size=10)
def barsize5():
chart.configure(bar_size=5)

def ylabelcount20():
chart.configure(y_labels_count=20)
def ylabelcount10():
chart.configure(y_labels_count=10)

def xlabelcount20():
chart.configure(x_labels_count=20)
def xlabelcount10():
chart.configure(x_labels_count=10)

def ysectionscount20():
chart.configure(y_sections_count=20)
def ysectionscount10():
chart.configure(y_sections_count=10)

def xsectionscount10():
chart.configure(x_sections_count=10)
def xsectionscount20():
chart.configure(x_sections_count=20)

def ydecimals4():
chart.configure(y_values_decimals=4)
def ydecimals0():
chart.configure(y_values_decimals=0)

def xdecimals4():
chart.configure(x_values_decimals=4)
def xdecimals0():
chart.configure(x_values_decimals=0)

def linewidth50():
chart.configure(line_width=50)
def linewidth100():
chart.configure(line_width=100)


tk.Button(text="Width to 1400", command=width1400).place(x=1)
tk.Button(text="Width to 700", command=width700).place(x=150)

tk.Button(text="height to 1000", command=height900).place(x=1, y=30)
tk.Button(text="height to 500",command=height500).place(x=150, y=30)

tk.Button(text="bar size to 10",command=barsize10).place(x=1, y=60)
tk.Button(text="bar size to 5",command=barsize5).place(x=150, y=60)

tk.Button(text="y_labels to 10",command=ylabelcount10).place(x=1, y=90)
tk.Button(text="y_labels to 20",command=ylabelcount20).place(x=150, y=90)

tk.Button(text="x_labels to 10",command=xlabelcount10).place(x=1, y=120)
tk.Button(text="x_labels to 20",command=xlabelcount20).place(x=150, y=120)

tk.Button(text="y_sections to 10",command=ysectionscount10).place(x=1, y=150)
tk.Button(text="y_sections to 20",command=ysectionscount20).place(x=150, y=150)

tk.Button(text="x_sections to 10",command=xsectionscount10).place(x=1, y=180)
tk.Button(text="x_sections to 20",command=xsectionscount20).place(x=150, y=180)

tk.Button(text="y decimals to 4",command=ydecimals4).place(x=1, y=210)
tk.Button(text="y decimals to 0",command=ydecimals0).place(x=150, y=210)

tk.Button(text="x decimals to 4",command=xdecimals4).place(x=1, y=240)
tk.Button(text="x decimals to 0",command=xdecimals0).place(x=150, y=240)

tk.Button(text="line width to 50",command=linewidth50).place(x=1, y=270)
tk.Button(text="line width to 100",command=linewidth100).place(x=150, y=270)


## check this out this
chart = tkc.LineChart(root ,x_data_min_max=(0,50))
chart.place(x=400, y=0)


line = tkc.Line(master=chart)

line2 = tkc.Line(master=chart)


data=[x for x in range(1,1001)]
datas = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
index = 0
import random
def display():
global index
chart.show_data(line=line, data=random.choices(datas,k=1))
index+=1
if index>= len(datas):
index =0
root.after(100, display)
display()


root.mainloop()
Loading

0 comments on commit a53038c

Please sign in to comment.