Skip to content

Commit 19cb4b2

Browse files
committed
version 2.0.0
1 parent 9382958 commit 19cb4b2

File tree

6 files changed

+39
-54
lines changed

6 files changed

+39
-54
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
[![Downloads](https://static.pepy.tech/badge/tkchart)](https://pepy.tech/project/tkchart) [![Downloads](https://static.pepy.tech/badge/tkchart/month)](https://pepy.tech/project/tkchart) [![Downloads](https://static.pepy.tech/badge/tkchart/week)](https://pepy.tech/project/tkchart)
2222

23-
<img src="https://drive.google.com/thumbnail?id=1asMd-U3BmmVEl8YpdRssj679n6jRdflC&sz=w180">
23+
<img src="https://drive.google.com/thumbnail?id=1rMILz6ODw-1UY4YhlYAFiRCFUluNcVpI&sz=w180">
2424

2525
</div>
2626

@@ -172,16 +172,16 @@ line = tkchart.Line()
172172
173173
| Parameter Name | Required / Optional | Description | Types | Example Value(s) |
174174
|-------------------------|---------------------|--------------------------------|------------------------------------|-------------------|
175-
| master | Required | Master of the line | ``tkchart.Line`` | LineChart obj |
176-
| <a href="#line_color_size">color</a> | Optional | Color of the line | ``str`` | "#768df1" |
177-
| <a href="#line_color_size">size</a> | Optional | Size of the line | ``int`` | 1<= |
178-
| <a href="#line_style">style</a> | Optional | Style of the line | ``str`` ("normal", "dashed", "dotted") | "normal" |
179-
| <a href="#line_style_type">style_type</a> | Optional | Style type for the line | ``tuple[int, int]`` | (10, 5),... |
180-
| <a href="#point_highlight">point_highlight</a> | Optional | State of point highlighting | ``str`` ("enabled", "disabled") | "disabled" |
181-
| <a href="#point_highlight">point_highlight_size</a> | Optional | Size of the highlighted point | ``int`` | 1<= |
182-
| <a href="#point_highlight">point_highlight_color</a> | Optional | Color of the highlighted point | ``str`` | "#768df1" |
183-
| <a href="#fill">fill</a> | Optional | State of filling | ``str`` ("enabled", "disabled") | "disabled" |
184-
| <a href="#fill">fill_color</a> | Optional | Color of the fill | ``str`` | "#5d6db6" |
175+
| master | Required | Master of the line | tkchart.Line | LineChart obj |
176+
| <a href="#line_color_size">color</a> | Optional | Color of the line | str | "#768df1" |
177+
| <a href="#line_color_size">size</a> | Optional | Size of the line | int | 1<= |
178+
| <a href="#line_style">style</a> | Optional | Style of the line | str ("normal", "dashed", "dotted") | "normal" |
179+
| <a href="#line_style_type">style_type</a> | Optional | Style type for the line | tuple[int, int] | (10, 5),... |
180+
| <a href="#point_highlight">point_highlight</a> | Optional | State of point highlighting | str ("enabled", "disabled") | "disabled" |
181+
| <a href="#point_highlight">point_highlight_size</a> | Optional | Size of the highlighted point | int | 1<= |
182+
| <a href="#point_highlight">point_highlight_color</a> | Optional | Color of the highlighted point | str | "#768df1" |
183+
| <a href="#fill">fill</a> | Optional | State of filling | str ("enabled", "disabled") | "disabled" |
184+
| <a href="#fill">fill_color</a> | Optional | Color of the fill | str | "#5d6db6" |
185185
186186
<br>
187187
@@ -297,10 +297,10 @@ https://github.com/Thisal-D/tkchart/assets/93121062/64440c23-63e6-4093-b027-21b0
297297
chart = tkchart.LineChart(master=any_widget,
298298
x_axis_values=(2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025),
299299
y_axis_values=(-100, 100),
300-
y_axis_data="Y data" ,
300+
y_axis_data="Y data",
301301
x_axis_data="X data",
302-
x_axis_data_font_color=("#ff0000", "#ff0000"),
303-
y_axis_data_font_color=("#00ff00", "#00ff00"),
302+
x_axis_data_font_color="#ff0000",
303+
y_axis_data_font_color="#00ff00",
304304
data_font_style=("arial", 15, "underline")
305305
)
306306
```

README_CN.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
[![Downloads](https://static.pepy.tech/badge/tkchart)](https://pepy.tech/project/tkchart) [![Downloads](https://static.pepy.tech/badge/tkchart/month)](https://pepy.tech/project/tkchart) [![Downloads](https://static.pepy.tech/badge/tkchart/week)](https://pepy.tech/project/tkchart)
2020

21-
<img src="https://drive.google.com/thumbnail?id=1asMd-U3BmmVEl8YpdRssj679n6jRdflC&sz=w180">
21+
<img src="https://drive.google.com/thumbnail?id=1rMILz6ODw-1UY4YhlYAFiRCFUluNcVpI&sz=w180">
2222

2323
</div>
2424

@@ -167,16 +167,16 @@ line = tkchart.Line()
167167
168168
| 参数名称 | 必备参数 / 可选参数 | 描述 | 数据类型 | 示例值 |
169169
| ---------------------------------------------------- | ------------------- | ---------------------------- | ---------------------------------- | ------------- |
170-
| master | 必须 | Master | ``tkchart.Line`` | LineChart obj |
171-
| <a href="#line_color_size">color</a> | 可选 | 折线的颜色 | ``str`` | "#768df1" |
172-
| <a href="#line_color_size">size</a> | 可选 | Size of the line | ``int`` | 1<= |
173-
| <a href="#line_style">style</a> | 可选 | 折线风格(直线、虚线、点线) | ``str`` ("normal", "dashed", "dotted") | "normal" |
174-
| <a href="#line_style_type">style_type</a> | 可选 | 实线与虚线的尺寸 | ``tuple[int, int]`` | (10, 5),... |
175-
| <a href="#point_highlight">point_highlight</a> | 可选 | 端点高亮状态 | ``str`` ("enabled", "disabled") | "disabled" |
176-
| <a href="#point_highlight">point_highlight_size</a> | 可选 | 高亮点的大小 | ``int`` | 1<= |
177-
| <a href="#point_highlight">point_highlight_color</a> | 可选 | 高亮点的颜色 | ``str`` | "#768df1" |
178-
| <a href="#fill">fill</a> | 可选 | 是否启用填充 | ``str`` ("enabled", "disabled") | "disabled" |
179-
| <a href="#fill">fill_color</a> | 可选 | 填充部分的颜​​色 | ``str`` | "#5d6db6" |
170+
| master | 必须 | Master | tkchart.Line | LineChart obj |
171+
| <a href="#line_color_size">color</a> | 可选 | 折线的颜色 | str | "#768df1" |
172+
| <a href="#line_color_size">size</a> | 可选 | Size of the line | int | 1<= |
173+
| <a href="#line_style">style</a> | 可选 | 折线风格(直线、虚线、点线) | str ("normal", "dashed", "dotted") | "normal" |
174+
| <a href="#line_style_type">style_type</a> | 可选 | 实线与虚线的尺寸 | tuple[int, int] | (10, 5),... |
175+
| <a href="#point_highlight">point_highlight</a> | 可选 | 端点高亮状态 | str ("enabled", "disabled") | "disabled" |
176+
| <a href="#point_highlight">point_highlight_size</a> | 可选 | 高亮点的大小 | int | 1<= |
177+
| <a href="#point_highlight">point_highlight_color</a> | 可选 | 高亮点的颜色 | str | "#768df1" |
178+
| <a href="#fill">fill</a> | 可选 | 是否启用填充 | str ("enabled", "disabled") | "disabled" |
179+
| <a href="#fill">fill_color</a> | 可选 | 填充部分的颜​​色 | str | "#5d6db6" |
180180
181181
<br>
182182
@@ -293,8 +293,8 @@ https://github.com/Thisal-D/tkchart/assets/93121062/64440c23-63e6-4093-b027-21b0
293293
y_axis_values=(-100, 100),
294294
y_axis_data="Y data" ,
295295
x_axis_data="X data",
296-
x_axis_data_font_color=("#ff0000", "#ff0000"),
297-
y_axis_data_font_color=("#00ff00", "#00ff00"),
296+
x_axis_data_font_color="#ff0000",
297+
y_axis_data_font_color="#00ff00",
298298
data_font_style=("arial", 15, "underline")
299299
)
300300
```

src/tkchart/LineChart.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(self,
119119
self.__y_axis_section_style_type = y_axis_section_style_type
120120
self.__y_axis_section_count = y_axis_section_count
121121
self.__y_axis_label_count = y_axis_label_count
122-
self.__y_axis_data = str(y_axis_data)
122+
self.__y_axis_data = y_axis_data
123123
self.__y_axis_data_position = y_axis_data_position
124124
self.__y_axis_values = y_axis_values
125125
self.__y_axis_min_value = y_axis_values[0]
@@ -135,7 +135,7 @@ def __init__(self,
135135
self.__x_axis_label_count = x_axis_label_count
136136
self.__x_axis_display_values_indices = x_axis_display_values_indices
137137
self.__x_labels_values_index_change = 1
138-
self.__x_axis_data = str(x_axis_data)
138+
self.__x_axis_data = x_axis_data
139139
self.__x_axis_data_position = x_axis_data_position
140140
self.__x_axis_values = x_axis_values
141141
self.__x_axis_values_handle_by = "auto"
@@ -318,25 +318,23 @@ def __configure_x_axis_point_spacing(self) -> None:
318318
def __configure_required_widget_size(self) -> None:
319319
self.__x_axis_data_req_width_space_top = 0
320320
self.__x_axis_data_req_height_space_side = 0
321-
self.__x_special_width_space = 0
322-
323321
self.__x_axis_data_req_height = Utils._RequiredHeight(text=self.__x_axis_data, font=self.__data_font_style)
324322
self.__x_axis_data_req_width = Utils._RequiredWidth(text=self.__x_axis_data, font=self.__data_font_style)
323+
self.__x_special_width_space = 0
325324
if self.__x_axis_data_position == "top":
326-
self.__x_special_width_space = 15
325+
self.__x_special_width_space = 30
327326
self.__x_axis_data_req_width_space_top = Utils._RequiredWidth(text=self.__x_axis_data, font=self.__data_font_style)
328327
else:
329328
self.__x_axis_data_req_height_space_side = Utils._RequiredHeight(text=self.__x_axis_data, font=self.__data_font_style)
330329

331330
self.__y_axis_data_req_height_space_top = 0
332-
self.__y_axis_data_req_width_space_side = 0
331+
self.__y_axis_data_req_height = Utils._RequiredHeight(text=self.__y_axis_data, font=self.__data_font_style)
332+
self.__y_axis_data_req_width = Utils._RequiredWidth(text=self.__y_axis_data, font=self.__data_font_style)
333333
self.__y_special_height_space = 0
334-
335-
#self.__y_axis_data_req_height = Utils._RequiredHeight(text=self.__y_axis_data, font=self.__data_font_style)
336-
#self.__y_axis_data_req_width = Utils._RequiredWidth(text=self.__y_axis_data, font=self.__data_font_style)
334+
self.__y_axis_data_req_width_space_side = 0
337335
if self.__y_axis_data_position == "top":
338-
self.__y_special_height_space = 15
339-
self.__y_axis_data_req_height_space_top = Utils._RequiredHeight(text=self.__y_axis_data, font=self.__data_font_style)
336+
self.__y_special_height_space = 30
337+
self.__y_axis_data_req_height_space_top = Utils._RequiredHeight(text=self.__y_axis_data[0], font=self.__data_font_style)
340338
else:
341339
self.__y_axis_data_req_width_space_side = Utils._RequiredWidth(text=self.__y_axis_data[0], font=self.__data_font_style)
342340

src/tkchart/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .LineChart import LineChart
22
from .Line import Line
33

4-
__version__ = "2.0.1"
4+
__version__ = "2.0.0"

templates/template (6).py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#creating a chart
1111
chart = tkchart.LineChart(master=root,
12-
x_axis_values = ("100\nS", "200\nS", "300\nS", "400\nS", "500\nS", "600\nS", "700\nS", "800\nS", "900\nS"),
12+
x_axis_values = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
1313
y_axis_values = (0,100),
1414
y_axis_label_count=10,
1515
x_axis_section_count=10,
@@ -25,11 +25,6 @@
2525
y_axis_data_font_color="#efefef",
2626
y_space=20,
2727
x_space=20,
28-
x_axis_data="Seconds\n(s)",
29-
x_axis_data_position="side",
30-
y_axis_data_position="top",
31-
32-
3328
)
3429
chart.pack()
3530

tests/main test.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import tkchart
2-
try:
3-
import customtkinter as ctk
4-
except :
5-
try:
6-
import os
7-
os.system("pip install customtkinter")
8-
os.system("pip install customtkinter --upgrade")
9-
except:
10-
pass
2+
import customtkinter as ctk
113
import random
124

135
root = ctk.CTk()

0 commit comments

Comments
 (0)