# dataf3l/openchart architecture

> Architecture diagram of the GitHub repository dataf3l/openchart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dataf3l/openchart
- Repository: https://github.com/dataf3l/openchart

## Overview

##### Main Components

a) Frontend Layer:
- Property Editor
- Rendering Controls

b) Core Processing Layer:
- Rendering Engine
- Cost Calculation Engine
- AZ Command Generator

c) Data Layer:
- Cost Templates (docs/cost.json)
- Sample Configurations (docs/sample.json)

##### Component Relationships

**[UI Layer]**
- ↓ ↑
**[Core Processing]**
- ↓ ↑
**[Data Layer]**

##### Detailed Component Breakdown

UI Components (Blue):

- UI Layer     |

- Drawing Area||

- Props Editor||

Core Processing (Green):

- ↓                      ↓

- Cost Calculator |←→| Command Generator|

Data Layer (Yellow):

- Cost Data   |

- Templates   |

##### Interaction Flows

- User input flow (mouse events, keyboard shortcuts)
- Cost calculation triggers
- Command generation process

##### Technical Details

Annotations showing:
- Browser-based implementation
- Static file serving
- JSON data storage
- DOM manipulation features

##### Implementation Notes

Notes about:
- Shift + mouse movement for drawing
- ALT + mouse movement for connections
- Drag and drop functionality
- Render button functionality

Remember to highlight the extensibility points mentioned in the README, such as potential future support for UI cost estimation and mobile application estimation.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#a8d1f0,stroke:#2c89c4
    classDef core fill:#a8f0b8,stroke:#2cc45e
    classDef data fill:#f0e4a8,stroke:#c4ac2c
    classDef legend fill:none,stroke:#333

    %% UI Layer
    subgraph UI
        Canvas["Drawing Canvas"]:::ui
        PropEditor["Property Editor"]:::ui
        ShapeTools["Shape Tools"]:::ui
        RenderControls["Rendering Controls"]:::ui
        MouseHandler["Mouse Event Handler"]:::ui
        DOMSystem["DOM Manipulation"]:::ui
    end

    %% Core Processing Layer
    subgraph Core
        ShapeMgmt["Shape Management"]:::core
        RenderEngine["Rendering Engine"]:::core
        EdgeRender["Edge Renderer"]:::core
        NodeRender["Node Renderer"]:::core
        CostCalc["Cost Calculator"]:::core
        CmdGen["AZ Command Generator"]:::core
        EdgeMgmt["Edge Management"]:::core
        NodeMgmt["Node Management"]:::core
    end

    %% Data Layer
    subgraph Data
        CostTemp["Cost Templates"]:::data
        SampleConfig["Sample Configurations"]:::data
        Styles["UI Styles"]:::data
    end

    %% Relationships
    Canvas --> MouseHandler
    MouseHandler --> ShapeMgmt
    ShapeMgmt --> RenderEngine
    RenderEngine --> EdgeRender
    RenderEngine --> NodeRender
    ShapeMgmt --> CostCalc
    ShapeMgmt --> CmdGen
    PropEditor --> ShapeMgmt
    ShapeTools --> ShapeMgmt
    RenderControls --> RenderEngine
    EdgeRender --> EdgeMgmt
    NodeRender --> NodeMgmt
    CostCalc --> CostTemp
    ShapeMgmt --> SampleConfig
    DOMSystem --> Canvas

    %% Click Events
    click PropEditor "https://github.com/dataf3l/openchart/blob/master/ui/property_editor.js"
    click ShapeMgmt "https://github.com/dataf3l/openchart/blob/master/ui/libshape.js"
    click MouseHandler "https://github.com/dataf3l/openchart/blob/master/ui/mouse.js"
    click EdgeMgmt "https://github.com/dataf3l/openchart/blob/master/ui/edge.js"
    click NodeMgmt "https://github.com/dataf3l/openchart/blob/master/ui/node.js"
    click EdgeRender "https://github.com/dataf3l/openchart/blob/master/ui/render_edges.js"
    click NodeRender "https://github.com/dataf3l/openchart/blob/master/ui/render_nodes.js"
    click DOMSystem "https://github.com/dataf3l/openchart/blob/master/ui/lib/domdrag.js"
    click CostTemp "https://github.com/dataf3l/openchart/blob/master/docs/cost.json"
    click SampleConfig "https://github.com/dataf3l/openchart/blob/master/docs/sample.json"
    click Styles "https://github.com/dataf3l/openchart/blob/master/ui/style.css"

    %% Legend
    subgraph Legend
        L1["UI Components"]:::ui
        L2["Core Processing"]:::core
        L3["Data Storage"]:::data
    end
```
