-
Notifications
You must be signed in to change notification settings - Fork 3
Home
import tkchart
- LineChart
- Line
- Create LineChart
- Create Line
- Display data
Create a LineChart
-
master
: tkinter.widget (Frame, Canvas, Tk)
width
: int
height
: int
bar_size
: inty_sections_count
: int
x_sections_count
: int
y_labels_count
: int
x_labels_count
: inty_data
: str ,int, float
x_data
: str ,int, float
y_data_max
: int ,float
x_data_min_max
: touple(min:int ,max:int)
y_values_decimals
: int
x_values_decimals
: intsections_color
: str
y_values_color
: str
x_values_color
: str
y_data_text_color
: str
x_data_text_color
: str
bg_color
: str
chart_color
: str
bar_color
: strx_y_data_font
: tuple
x_y_values_font
: tuple
line_width_auto
: bool
line_width
: int -
support **kwargs
width height bar_size y_sections_count x_sections_count y_labels_count x_labels_count y_data x_data y_data_max x_data_min_max y_values_decimals x_values_decimals sections_color y_values_color x_values_color y_data_text_color x_data_text_color bg_color chart_color bar_color x_y_data_font x_y_values_font line_width_auto line_width
support **kwargs
data line
support **kwargs
x y rely relx anchor
support **kwargs
pady padx before after side ipadx ipady ancho
support **kwargs
column columnspan ipadx ipady padx pady row rowspan sticky
support **kwargs
state: Bool
support **kwargs
line: tkchart.Line state: bool
linechart = tkchart.LineChart(master=root,
width=1000,
height=600,
bar_size=5
)
linechart = tkchart.LineChart(master=root,
width=1000,
height=600,
bar_size=5,
y_sections_count=5,
x_sections_count=5,
y_labels_count=5,
x_labels_count=5
)
linechart = tkchart.LineChart(master=root, width=1000,
height=600,
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=(20,60),
y_data_max=1000,
x_values_decimals=4,
y_values_decimals=5,
)
linechart = tkchart.LineChart(master=root, width=1000,
height=600,
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=(20,60),
y_data_max=1000,
x_values_decimals=4,
y_values_decimals=5,
sections_color="#ffffff",
y_values_color="#ffffff",
x_values_color="#ffffff",
x_data_text_color="#00ffff",
y_data_text_color="#ff00ff",
bg_color="#202020",
chart_color="#101010",
bar_color="#909090"
)
linechart = tkchart.LineChart(master=root,
width=1000,
height=600,
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=(20,60),
y_data_max=1000,
x_values_decimals=4,
y_values_decimals=5,
sections_color="#505050",
y_values_color="#bbbbbb",
x_values_color="#bbbbbb",
x_data_color="#00ffff",
y_data_color="#ff00ff",
bg_color="#202020",
chart_color="#101010",
bar_color="#cccccc",
x_y_data_font = ("Arial", 15,"bold"),
x_y_values_font = ("Arial", 10,"bold")
)
Create a Line
-
master
: tkchart.LineChart
color
: str
size
: int -
size color
line = tkchart.Line(master=linechart,
color="#ffff00",
size=5)
line_width
is not a attributes of Line. Its a attribute of LineChart object..!
import tkinter
import tkchart
import random #for get random value
#create root
root = tkinter.Tk()
root.minsize(1200,800)
#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=(20,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=150)
#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 = (20,60)
def loop():
global displayed
global start
linechart.show_data(data=[random.choice(data)], line=line)
displayed+=1
if displayed>40:
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()
output: