Metadata-Version: 2.1
Name: tkchart
Version: 1.4.0
Summary: tkchart Library is a Python library that simplifies the process of creating line charts in tkinter and customtkinter GUI applications.
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/tkchart
Project-URL: repository, https://github.com/Thisal-D/tkchart
Project-URL: issues, https://github.com/Thisal-D/tkchart/issues
Keywords: tkchart,linechart,tkinter,customtkinter,line chart in tkinter,line chart in customtkinter
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE

<div id="top">

### <a href="#contributing">Contributing to tkchart</a>
### <a href="#whatsnew">Whats New ?</a>

# Read Me

<div align="center">

<img src="https://drive.google.com/thumbnail?id=16Y00GIKEpmC4t3gAlUv7IJutE4yzFszo&sz=w900">

[![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)

<img src="https://drive.google.com/thumbnail?id=1YxLGG88z1EyPR7SUgJhqtmD0uthRYgNp&sz=w180">

</div>

### <li>tkchart Library is a Python library that simplifies the process of creating line charts in tkinter and customtkinter GUI applications.</li>

## Examples

<div align="center">

<img src="https://drive.google.com/thumbnail?id=1F_elYaMgKzVMNLgDjBN6B7P4EX9X43YV&sz=w900">

</div>

<br>
<br>

## tkchart - 1.4.0

### You need to install & import package first
* installation
    * ``` 
        pip install tkchart 
        ```

* importing
    * ```
        import tkchart
        ```

## objects
* LineChart 
* Line 

## To display data using LineChart you need to do 3 main tasks
1. Creating a LineChart
2. Creating a Line
3. Display of data
<br>
<br>


# 1 . Creating a LineChart
 
```
linechart = tkchart.LineChart()
```
- ##  Attributes & Types & Values
    ## Master Configuration
    - master : ``tkinter | customtkinter (Frame | Canvas | Tk)``

    ## Dimensions 
    - width : ``int``
    - height : ``int``
    - axis_size : ``int``
    - x_space : ``int``
    - y_space : ``int``
    - line_width : ``int | str``
        - "auto"
        - 10
    - pointer_size : ``int``

    ## Value Configuration
    - x_axis_section_count : ``int``
    - y_axis_section_count : ``int``
    - x_axis_label_count : ``int``
    - y_axis_label_count : ``int``
    - x_axis_display_values_indices : ``tuple[int, ...]``
    - x_axis_data : ``any``
    - y_axis_data : ``any``
    - x_axis_values : ``tuple(any, ...)`` 
        - ("2020 Year", "2021 Year", "2022 Year", "2023 Year", "2024 Year")
        - (0.1, 0.2, 0.3, 0.4, 0.5)
    - y_axis_values : ``tuple(int | float, int | float)``
        - (0 ,1000)
        - (-1000, 1000)
    - y_axis_precision : ``int``
    - pointing_values_precision : ``int``
    - ~~y_axis_max_value~~ : <span style="color:red; font-weight:bold">Deprecated</span>

    ## Color Configuration
    - bg_color : ``str``
    - fg_color : ``str``
    - axis_color : ``str``
    - x_axis_font_color : ``str``
        - "#ffffff"
        - "white"
    - y_axis_font_color : ``str``
    - x_axis_data_font_color : ``str``
    - y_axis_data_font_color : ``str``
    - y_axis_section_color : ``str``
    - x_axis_section_color : ``str``
    - pointer_color : ``str``
    - ~~section_color~~ : <span style="color:red; font-weight:bold">Deprecated</span>
    
    ## Font Configuration
    - data_font_style : ``tuple[str, int, str]``
        - ("arial", 10, "bold")
        - ("arial", 20, "normal")
    - axis_font_style : ``tuple``

    ## Style Configuration
    - x_axis_data_position : ``str``
        - "top"
        - "side"
    - y_axis_data_position : ``str``
    - x_axis_section_style : ``str``
        - "normal"
        - "dashed"
    - y_axis_section_style : ``str``
    - x_axis_section_style_type : ``tuple(int, int)``
        - (50, 10)
        - (10, 10)
    - y_axis_section_style_type : ``tuple(int, int)``

    ## Data Retrieval Configuration
    - pointing_callback_function : ``function``
        - function_name(*args)
        - function_name(x ,y)
    - pointer_state : ``str``
        - "enabled"
        - "disabled"
    - pointer_lock : ``str``
        - "enabled"
        - "disabled"
    
    ## Recent Changes
    -  ~~y_axis_max_value : ``int | float``~~ <span style="color:red; font-weight:bold">Deprecated</span>
        - replaced with y_axis_values : ``tuple(int | float, int | float)``

            **_The y_axis_values parameter is a tuple where the value at index 0 represents the starting value of the Y-axis, and the value at index 1 represents the ending value of the Y-axis._**

    - ~~section_color : ``str``~~ <span style="color:red; font-weight:bold">Deprecated</span>
        - replaced with x_axis_section_color : ``str``
        - replaced with y_axis_section_color : ``str``

- ##  Methods

    - ### configure : ``use to change LineChart attributes``
        Support parameters
        - width 
        - height 
        - axis_size 
        - x_space 
        - y_space 
        - line_width 
        - pointer_size
        - x_axis_section_count 
        - y_axis_section_count 
        - x_axis_label_count
        - y_axis_label_count 
        - x_axis_display_values_indices 
        - x_axis_data 
        - y_axis_data 
        - x_axis_values 
        - y_axis_values 
        - y_axis_precision 
        - pointing_values_precision
        - bg_color 
        - fg_color
        - axis_color
        - x_axis_font_color 
        - y_axis_font_color 
        - x_axis_data_font_color 
        - y_axis_data_font_color
        - y_axis_section_color 
        - x_axis_section_color 
        - pointer_color
        - data_font_style 
        - axis_font_style
        - x_axis_data_position 
        - y_axis_data_position 
        - x_axis_section_style 
        - y_axis_section_style
        - x_axis_section_style_type 
        - y_axis_section_style_type 
        - pointing_callback_function
        - pointer_state 
        - pointer_lock 
        - ~~y_axis_max_value~~ : <span style="color:red; font-weight:bold">Removed</span>
        - ~~section_color~~ : <span style="color:red; font-weight:bold">Removed</span>
    

        
    - ### show_data : ``use to display data``
        Support parameters
        - data : ``tuple``
        - line : ``tkchart.Line``
       
    - ### place : ``use to place LineChart``
        Support parameters
        - x
        - y
        - rely
        - relx
        - anchor
       
    - ### pack : ``use to pack LineChart``
        Support parameters
        - pady
        - padx
        - before
        - after
        - side
        - anchor
        
    - ### grid : ``use to grid LineChart``
        Support parameters
        - column
        - columnspan
        - padx
        - pady
        - row
        - rowspan
        - sticky

    - ### place_forget : ``use to place forget the chart``
    - ### pack_forget : ``use to pack forget the chart``
    - ### grid_forget : ``use to grid forget the chart``
    - ### place_back : ``use to place chart in the old location after place forget``
    - ### pack_back : ``use to pack chart in the old location after pack forget``
    - ### grid_back : ``use to grid chart in the old location after grid forget``
    - ### hide_all : ``use to hide all the lines``
        Support parameters
        - state : ``bool``
        
    - ### hide : ``use to hide a specific line``
        Support parameters
        - line : ``tkchart.Line``
        - state : ``bool``
    - ### reset : ``use to reset chart``

    
```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5
                        )
```

<div align="center"><img src="https://drive.google.com/thumbnail?id=1UnGHJ-tLrki3HegDs7WM1TVUIkMAbWVS&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                        )
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1FPzXc0NVyY50TOKIbBC_bXellnVUTY6l&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis__max_value=(0, 1000),
                            y_axis_precision=5
                        )
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1F8fZdWwA4q-f3cL3Oejvey0rU0yEBF6j&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis__max_value=(0, 1000),
                            y_axis_precision=5
                            
                            x_axis_section_color="#404040",
                            y_axis_section_color="#404040",
                            x_axis_font_color="#707070",
                            y_axis_font_color="#707070",
                            x_axis_data_font_color="lightblue",
                            y_axis_data_font_color="lightblue",
                            bg_color="#202020",
                            fg_color="#202020",
                            axis_color="#707070"
                        )
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1A1FAprrNkbWjZAyaoL3NvdPu5RASIq5Q&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis__max_value=(0, 1000),
                            y_axis_precision=5
                            
                            x_axis_section_color="#404040",
                            y_axis_section_color="#404040",
                            x_axis_font_color="#707070",
                            y_axis_font_color="#707070",
                            x_axis_data_font_color="lightblue",
                            y_axis_data_font_color="lightblue",
                            bg_color="#202020",
                            fg_color="#202020",
                            axis_color="#707070"
                            
                            data_font_style=("Arial", 15, "bold"),
                            axis_font_style=("Arial", 10, "bold")
                        )
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1qIk805dmi9wpBUSv2UmnD7gQFSQB5RPF&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis__max_value=(0, 1000),
                            y_axis_precision=5
                            
                            x_axis_section_color="#404040",
                            y_axis_section_color="#404040",
                            x_axis_font_color="#707070",
                            y_axis_font_color="#707070",
                            x_axis_data_font_color="lightblue",
                            y_axis_data_font_color="lightblue",
                            bg_color="#202020",
                            fg_color="#202020",
                            axis_color="#707070"
                            
                            data_font_style=("Arial", 15, "bold"),
                            axis_font_style=("Arial", 10, "bold"),
                            
                            x_space=20,
                            y_space=20
                        )
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1W8P7wXlNLymaE0sexSSfltv0fX5t7XXD&sz=w900"></div> 
<br>
<br>

```
linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis__max_value=(0, 1000),
                            y_axis_precision=5
                            
                            x_axis_section_color="#404040",
                            y_axis_section_color="#404040",
                            x_axis_font_color="#707070",
                            y_axis_font_color="#707070",
                            x_axis_data_font_color="lightblue",
                            y_axis_data_font_color="lightblue",
                            bg_color="#202020",
                            fg_color="#202020",
                            axis_color="#707070"
                            
                            data_font_style=("Arial", 15, "bold"),
                            axis_font_style=("Arial", 10, "bold"),
                            
                            x_space=20,
                            y_space=20,
                            
                            x_axis_data_position="side",
                            y_axis_data_position="side"
                        )

linechart.pack()
```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1kNoJalW6aLx79wxcmrUaAS_D8XsldL3h&sz=w900"></div> 


<br>
<hr>
<br>

# 2 . Creating a Line

```
line = tkchart.Line()
```

- ##  Attributes & Types & Values
    - master : ``tkchart.LineChart``
    - color : ``str``
        - "white"
        - "#10f0f0"
    - size : ``int``
    - style : ``str``
        - "normal"
        - "dashed"
        - "dotted"
    - style_type : ``tuple(int, int)``
        - (5,10)
        - (10,5)
    - point_highlight: ``str``
        - "disabled"
        - "enabled"
    - point_highlight_size: ``int`` 
    - point_highlight_color: ``str``


- ##  Methods
    - #### configure : ``use to change Line attributes``
        Support parameters
        - size 
        - color 
        - style
        - style_type
        - point_highlight
        - point_highlight_size
        - point_highlight_color

```
line = tkchart.Line(master=linechart,
                color="lightblue",
                size=2,
                style="dashed",
                style_type=(4,10))

```
<div align="center"><img src="https://drive.google.com/thumbnail?id=1PDKdRPfjhzUkAlY-ktFhE70MsYCKeFn5&sz=w900"></div> 

<br>
<hr>
<br>

# 3 . Display of Data
```
import customtkinter 
import tkchart
import random

root = customtkinter.CTk()

linechart = tkchart.LineChart(master=root,
                            width=800, 
                            height=400,
                            axis_size=5,
                            
                            y_axis_section_count=5,
                            x_axis_section_count=5,
                            y_axis_label_count=5,
                            x_axis_label_count=10,
                            
                            y_axis_data="GB",
                            x_axis_data="S",
                            x_axis_values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
                            y_axis_values=(0, 1000),
                            y_axis_precision=5,
                            
                            x_axis_section_color="#404040",
                            y_axis_section_color="#404040",
                            x_axis_font_color="#707070",
                            y_axis_font_color="#707070",
                            x_axis_data_font_color="lightblue",
                            y_axis_data_font_color="lightblue",
                            bg_color="#202020",
                            fg_color="#202020",
                            axis_color="#707070",
                            
                            data_font_style=("Arial", 15, "bold"),
                            axis_font_style=("Arial", 10, "bold"),
                            
                            x_space=20,
                            y_space=20,
                            
                            x_axis_data_position="side",
                            y_axis_data_position="side"
                        )
linechart.pack()


line = tkchart.Line(master=linechart,
                    color="lightblue",
                    size=2,
                    style="dashed",
                    style_type=(4, 10))

data = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
def loop():
    linechart.show_data(data=tuple([random.choice(data)]), line=line)
    root.after(250, loop)
loop()

root.mainloop()
```

<div align="center">
click to play

https://github.com/Thisal-D/tkchart/assets/93121062/ec29a3f4-7eba-40c5-9f5c-cc7071ff40ff

</div>

<br>
<hr>
<br>

### Examples
- <div align="center"><img src="https://drive.google.com/thumbnail?id=1_fLJaHHxNYf8Hviu_I7HKIst_l2m5_A0&sz=w900"></div> 

- <div align="center"><img src="https://drive.google.com/thumbnail?id=1HoYA0oDPnEW6l7ALNTO8GwPzewXIutU-&sz=w900"></div> 

- <div align="center"><img src="https://drive.google.com/thumbnail?id=1Q5Y8vw4Inh6Ne6WckfBDt_PRYpbgWpiI&sz=w900"></div> 

- <div align="center"><img src="https://drive.google.com/thumbnail?id=10lmTzrQ29Tynx3zjZOHCyW3f5qXdjPMr&sz=w900"></div> 

- <div align="center"><img src="https://drive.google.com/thumbnail?id=1tdo37nq3Hcv2roTOA80qsME9P185F7r1&sz=w900"></div> 

- <div align="center"><img src="https://drive.google.com/thumbnail?id=1_vTP7DIsEdd4gU5hQOYeWF5FVYfilCvG&sz=w900"></div> 

</div>

<br>
<hr>
<br>

### go to PyPi
- # PyPi.org   :   <a href="https://pypi.org/project/tkchart" target="_blank" ><i>tkchart</i></a>

### go to GitHub
- # GitHub.com   :  <a href="https://github.com/Thisal-D/tkchart" target="_blank" ><i>tkchart</i></a>


</div>
<br>
<br>
 

<div id="contributing">

### <a href="#whatsnew">Whats New ?</a>
### <a href="#top"> Go to top </a>


# Contributing to tkchart

Thank you for considering contributing to tkchart! Please follow these guidelines to contribute effectively.

## Getting Started

1. Fork the repository.
2. Clone your forked repository: `git clone https://github.com/Thisal-D/tkchart.git`
3. Create a new branch for your changes: `git checkout -b feature-branch`

## Making Changes

1. Make your changes and ensure they follow the project's coding standards.
2. Test your changes locally.
3. Commit your changes: `git commit -m "Brief description of your changes"`

## Submitting Changes

1. Push your changes to your forked repository: `git push origin feature-branch`
2. Create a pull request on the main repository.

## Code of Conduct

Please adhere to the [Code of Conduct](CODE_OF_CONDUCT.md) to maintain a respectful and inclusive community.

## Issues and Discussions

If you encounter issues or have questions, please check the [issue tracker](https://github.com/Thisal-D/tkchart/issues) or start a discussion in the [GitHub Discussions](https://github.com/Thisal-D/tkchart/discussions) section.

## License

By contributing, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE).

Thank you for your contribution!

</div>

<br>
<br>

<div id="whatsnew">

### <a href="#contributing">Contributing to tkchart</a>

### <a href="#top"> Go to top </a>

# Whats New

Added new parameters to Line object

Try on :
<a href="https://github.com/Thisal-D/tkchart/blob/main/Tests/Main%20-%20Test.py"> Tests/Main - Test.py </a>

- point_highlight: ``str``
- point_highlight_size: ``int`` 
- point_highlight_color: ``str``

:: before
<div align="center"><img src="https://drive.google.com/thumbnail?id=1gamwp1fyXbwVFUduohPFH5nZydDYBDlZ&sz=w900"></div>

:: after
- point_highlight = "enabled"
- point_highlight_size = 10
- point_highlight_color = "#00FFFF"

<div align="center"><img src="https://drive.google.com/thumbnail?id=1uhnCAKUHyCFytpxwImWPx0ubwd_4mTxA&sz=w900"></div>

</div>
