# henearkrxern0/python_graphing_app architecture

> Architecture diagram of the GitHub repository henearkrxern0/python_graphing_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/henearkrxern0/python_graphing_app
- Repository: https://github.com/henearkrxern0/python_graphing_app

## Overview

##### Project type and purpose
- This is a desktop, single-process Python application for graphing CSV data.
- Purpose: provide a Tkinter GUI for loading CSVs, configuring axis parameters, plotting with Matplotlib, and saving graphs.

##### File structure
- Top-level:
- app/ – contains core modules
- assets/, examples/, img/ – static data, sample CSVs, and screenshots
- requirements.txt – external dependencies
- app/ modules:
- main.py – entry point (initializes and runs the GUI)
- gui.py – Presentation layer (GraphingApp class and all widgets)
- file_manager.py – Handles folder/file selection, encoding detection (Chardet), CSV loading (Pandas)
- plot_manager.py – Business logic for preparing data, plotting graphs (Matplotlib), saving images
- settings.py – Configuration constants (default separators, file filters, scaling defaults)
- code_test.py – Utility or test harness (optional, lower-priority component)

##### README for insights
- Confirms use of Tkinter, Pandas, Matplotlib, Chardet.
- Describes user workflows: select folder, load files, set header/indices/separators, normalize/scale, set axis limits/labels, plot, save/reset.
- No distributed services—everything lives in one process.

##### Main components
a. Presentation Layer
- GraphingApp (app/gui.py)
b. Application Logic Layer
- FileManager (app/file_manager.py)
- PlotManager (app/plot_manager.py)
- Settings (app/settings.py)
c. Infrastructure
- Local File System (input CSVs in examples/ or user folder; output PNG/SVG)
d. External Libraries
- Tkinter (GUI toolkit)
- Pandas (data loading and manipulation)
- Chardet (encoding detection)
- Matplotlib (plot rendering and export)

##### Relationships and data flow
- User → (clicks) → GraphingApp
- GraphingApp → FileManager → File System → Pandas & Chardet → returns DataFrames → GraphingApp
- GraphingApp → PlotManager (passes DataFrames + settings) → Matplotlib → rendering in GUI
- PlotManager → File System (on “Save”) → writes PNG/SVG
- Both FileManager & PlotManager log events → GraphingApp.log window

##### Architectural patterns and principles
- Layered (Presentation → Application Logic → Infrastructure)
- Single-responsibility: each module has one clear role (GUI, I/O, plotting, config)
- Dependency injection (GraphingApp passes user settings into FileManager/PlotManager)
- Monolithic desktop application (no microservices, no database server)

##### Detailed checklist
- [ ] GraphingApp (UI) block with sub-widgets listed
- [ ] Settings block feeding into FileManager & PlotManager
- [ ] External Libraries grouped on one side

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Python Application"
        Main["Main\n(app/main.py)"]:::logic
        GraphingApp["GraphingApp\n(app/gui.py)"]:::ui
        FileManager["FileManager\n(app/file_manager.py)"]:::logic
        PlotManager["PlotManager\n(app/plot_manager.py)"]:::logic
        Settings["Settings\n(app/settings.py)"]:::logic
        CodeTest["CodeTest\n(app/code_test.py)"]:::logic
    end

    subgraph "Infrastructure" 
        FileSystem["Local File System"]:::infra
        Examples["examples/"]:::infra
        Assets["assets/"]:::infra
        Images["img/"]:::infra
        Requirements["requirements.txt"]:::infra
    end

    subgraph "External Libraries"
        Tkinter["Tkinter"]:::external
        Pandas["Pandas"]:::external
        Chardet["Chardet"]:::external
        Matplotlib["Matplotlib"]:::external
    end

    Main -->|"initializes"| GraphingApp
    GraphingApp -->|"invokes"| FileManager
    GraphingApp -->|"invokes"| PlotManager
    Settings -->|"provides defaults to"| FileManager
    Settings -->|"provides defaults to"| PlotManager

    FileManager -->|"loads CSV"| FileSystem
    FileSystem -->|"reads from"| Examples
    FileSystem -->|"reads from"| Assets
    FileSystem -->|"reads from"| Images
    FileSystem -->|"reads/writes"| Requirements
    FileManager -->|"uses"| Pandas
    FileManager -->|"detects encoding via"| Chardet
    FileManager -.->|"logs events to"| GraphingApp

    PlotManager -->|"renders via"| Matplotlib
    PlotManager -->|"saves output to"| FileSystem
    PlotManager -.->|"logs events to"| GraphingApp

    classDef ui fill:#AED6F1,stroke:#21618C,color:#1B2631,stroke-width:1px;
    classDef logic fill:#A9DFBF,stroke:#196F3D,color:#1B2631,stroke-width:1px;
    classDef infra fill:#D5DBDB,stroke:#566573,color:#1B2631,stroke-width:1px,stroke-dasharray: 5 5;
    classDef external fill:#F5CBA7,stroke:#B9770E,color:#1B2631,stroke-width:1px,stroke-dasharray: 2 2;

    click GraphingApp "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/gui.py"
    click Main "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/main.py"
    click FileManager "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/file_manager.py"
    click PlotManager "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/plot_manager.py"
    click Settings "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/settings.py"
    click CodeTest "https://github.com/henearkrxern0/python_graphing_app/blob/master/app/code_test.py"
    click Examples "https://github.com/henearkrxern0/python_graphing_app/tree/master/examples/"
    click Assets "https://github.com/henearkrxern0/python_graphing_app/tree/master/assets/"
    click Images "https://github.com/henearkrxern0/python_graphing_app/tree/master/img/"
    click Requirements "https://github.com/henearkrxern0/python_graphing_app/blob/master/requirements.txt"
```
