# patrykandpatrick/vico architecture

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

- Interactive diagram: https://gitdiagram.com/patrykandpatrick/vico
- Repository: https://github.com/patrykandpatrick/vico

## Overview

##### Main Components Structure

**Core Module**
- Common Components
- Cartesian System
- Data Management

**View System Integration**
- Android Views Implementation

**Compose Integration**
- Base Compose
- Material 2 Theme
- Material 3 Theme

**Sample Implementation**
- Demo Applications

##### Key Architectural Elements

a. Core Architecture Layer:
- Core module as the foundation, containing:
- Cartesian chart system
- Data management system
- Drawing contexts and measuring systems

b. Platform Integration Layers:
- Demonstrate two parallel implementation paths:
- Views implementation (traditional Android)
- Compose implementation (with M2 and M3 theming)

c. Feature Components:
- Chart Types:
- Line charts
- Column charts
- Candlestick charts
- Markers and Decorations
- Axes (Horizontal and Vertical)
- Touch and Gesture Handling

##### Interaction Flows

- Data input → Chart Model → Rendering Pipeline
- User interaction → Gesture Handlers → Chart Updates
- Theme System → Component Styling

##### Implementation Details to Highlight

- Clear separation between:
- Core chart logic
- Platform-specific implementations
- Theming systems
- Data handling
- Drawing and measuring contexts

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Module"]
        direction TB
        Common["Common Components"]:::core
        Cartesian["Cartesian System"]:::core
        DataMgmt["Data Management"]:::core
        
        subgraph ChartTypes["Chart Types"]
            direction TB
            LineChart["Line Charts"]:::chart
            ColumnChart["Column Charts"]:::chart
            CandleChart["Candlestick Charts"]:::chart
        end

        subgraph AxesSystem["Axes System"]
            direction TB
            BaseAxis["Base Implementation"]:::axis
            HAxis["Horizontal Axis"]:::axis
            VAxis["Vertical Axis"]:::axis
        end

        Markers["Markers & Decorations"]:::core
    end

    subgraph ViewInt["View System Integration"]
        direction TB
        ViewImpl["Main Implementation"]:::view
        ChartView["Chart View"]:::view
        ViewGesture["Gesture Handling"]:::view
        ViewTheme["View Theme"]:::view
    end

    subgraph ComposeInt["Compose Integration"]
        direction TB
        BaseCompose["Base Compose"]:::compose
        M2Theme["Material 2 Theme"]:::compose
        M3Theme["Material 3 Theme"]:::compose
        ComposeTheme["Compose Theme"]:::compose
    end

    Common --> Cartesian
    Common --> DataMgmt
    Cartesian --> ChartTypes
    Cartesian --> AxesSystem
    Cartesian --> Markers

    Common --> ViewImpl
    Common --> BaseCompose
    ViewImpl --> ChartView
    ViewImpl --> ViewGesture
    ViewImpl --> ViewTheme

    BaseCompose --> M2Theme
    BaseCompose --> M3Theme
    BaseCompose --> ComposeTheme

    %% Click events for component mapping
    click Common "https://github.com/patrykandpatrick/vico/tree/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/common/"
    click Cartesian "https://github.com/patrykandpatrick/vico/tree/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/"
    click DataMgmt "https://github.com/patrykandpatrick/vico/tree/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/common/data/"
    click ViewImpl "https://github.com/patrykandpatrick/vico/tree/master/vico/views/src/main/java/com/patrykandpatrick/vico/views/"
    click ChartView "https://github.com/patrykandpatrick/vico/blob/master/vico/views/src/main/java/com/patrykandpatrick/vico/views/cartesian/CartesianChartView.kt"
    click ViewGesture "https://github.com/patrykandpatrick/vico/tree/master/vico/views/src/main/java/com/patrykandpatrick/vico/views/common/gesture/"
    click BaseCompose "https://github.com/patrykandpatrick/vico/tree/master/vico/compose/src/main/java/com/patrykandpatrick/vico/compose/"
    click M2Theme "https://github.com/patrykandpatrick/vico/tree/master/vico/compose-m2/src/main/java/com/patrykandpatrick/vico/compose/m2/"
    click M3Theme "https://github.com/patrykandpatrick/vico/tree/master/vico/compose-m3/src/main/java/com/patrykandpatrick/vico/compose/m3/"
    click LineChart "https://github.com/patrykandpatrick/vico/blob/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/layer/LineCartesianLayer.kt"
    click ColumnChart "https://github.com/patrykandpatrick/vico/blob/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/layer/ColumnCartesianLayer.kt"
    click CandleChart "https://github.com/patrykandpatrick/vico/blob/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/layer/CandlestickCartesianLayer.kt"
    click BaseAxis "https://github.com/patrykandpatrick/vico/tree/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/axis/"
    click HAxis "https://github.com/patrykandpatrick/vico/blob/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/axis/HorizontalAxis.kt"
    click VAxis "https://github.com/patrykandpatrick/vico/blob/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/axis/VerticalAxis.kt"
    click Markers "https://github.com/patrykandpatrick/vico/tree/master/vico/core/src/main/java/com/patrykandpatrick/vico/core/cartesian/marker/"
    click ViewTheme "https://github.com/patrykandpatrick/vico/tree/master/vico/views/src/main/java/com/patrykandpatrick/vico/views/common/theme/"
    click ComposeTheme "https://github.com/patrykandpatrick/vico/blob/master/vico/compose/src/main/java/com/patrykandpatrick/vico/compose/common/VicoTheme.kt"

    %% Styling
    classDef core fill:#2196F3,stroke:#1976D2,color:white
    classDef view fill:#FF9800,stroke:#F57C00,color:white
    classDef compose fill:#4CAF50,stroke:#388E3C,color:white
    classDef chart fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef axis fill:#607D8B,stroke:#455A64,color:white

    %% Legend
    subgraph Legend
        CoreLegend["Core Components"]:::core
        ViewLegend["View Components"]:::view
        ComposeLegend["Compose Components"]:::compose
        ChartLegend["Chart Types"]:::chart
        AxisLegend["Axis Components"]:::axis
    end
```
