# alameerashraf/angular-activity-heatmap architecture

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

- Interactive diagram: https://gitdiagram.com/alameerashraf/angular-activity-heatmap
- Repository: https://github.com/alameerashraf/angular-activity-heatmap

## Overview

##### Project Type Analysis
This is an Angular library project that provides a reusable heatmap visualization component. It's designed to be integrated into other Angular applications as a module.

##### Main Components

A. Core Library Module Layer:
- ActivityHeatmapModule (main entry point)
- Public API interface

B. Component Layer:
- HeatmapComponent (main visualization component)
- Component Template (HTML)
- Component Styles (CSS)

C. Builder Pattern Layer:
- HeatmapBuilder
- HeatmapFactory

D. Generator Layer (Strategy Pattern):
- Base HeatmapGenerator
- Specialized Generators:
- YearHeatmapGenerator
- MonthsHeatmapGenerator
- SingleMonthHeatmapGenerator
- RangeHeatmapGenerator

E. Data Model Layer:
- IDataItem
- IDayData
- IMonthData
- IHeatmapOptions

**┌─ Application Integration Layer ─┐**
- (Shows how external apps use   │
- the library)                  │
- ┬────────────────┘
- ↓
**┌─ Public API Layer ────────────┐**
- @public-api.ts               │
- ┬────────────────┘
- ↓
**┌─ Module Layer ───────────────┐**
- ActivityHeatmapModule        │
- ┬────────────────┘
- ↓
**┌─ Component Layer ────────────┐**
- HeatmapComponent            │
- ┬────────────────┘
- ↓
**┌─ Builder Layer ─────────────┐**
- HeatmapBuilder             │
- HeatmapFactory             │
- ┬────────────────┘
- ↓
**┌─ Generator Layer ───────────┐**
- Base Generator             │
- Specialized Generators     │
- ┬────────────────┘
- ↓
**┌─ Data Model Layer ──────────┐**
- Interfaces & Types         │
- ┘

##### Important Elements to Highlight

- Input/Output flow:
- How data flows from consumer application to visualization
- Configuration options (mode, theme, action)
- How different generator strategies are selected

- Theme System:
- A side panel showing theme options (fire, deepblue, github, purple)
- How themes interact with the component

##### Implementation Details

- How the factory pattern is used to create appropriate generators
- Builder pattern's role in constructing the heatmap
- Demonstrate how different heatmap types are handled
- Relationship between component inputs and internal state

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#388E3C,color:white
    classDef builder fill:#FF9800,stroke:#F57C00,color:white
    classDef generator fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef model fill:#9E9E9E,stroke:#616161,color:white
    classDef component fill:#00BCD4,stroke:#0097A7,color:white

    %% Application Integration Layer
    subgraph AppLayer["Application Integration Layer"]
        ConsumerApp["Consumer Angular Application"]
    end

    %% Public API Layer
    subgraph APILayer["Public API Layer"]
        PublicAPI["Public API"]:::api
    end

    %% Module Layer
    subgraph ModuleLayer["Module Layer"]
        ActivityModule["ActivityHeatmapModule"]:::core
    end

    %% Component Layer
    subgraph ComponentLayer["Component Layer"]
        HeatmapComponent["HeatmapComponent"]:::component
        Template["Component Template"]:::component
        Styles["Component Styles"]:::component
    end

    %% Builder Layer
    subgraph BuilderLayer["Builder Layer"]
        HeatmapFactory["HeatmapFactory"]:::builder
    end

    %% Generator Layer
    subgraph GeneratorLayer["Generator Layer"]
        BaseGenerator["Base HeatmapGenerator"]:::generator
        YearGenerator["YearHeatmapGenerator"]:::generator
        MonthsGenerator["MonthsHeatmapGenerator"]:::generator
        SingleMonthGenerator["SingleMonthHeatmapGenerator"]:::generator
        RangeGenerator["RangeHeatmapGenerator"]:::generator
    end

    %% Data Model Layer
    subgraph ModelLayer["Data Model Layer"]
        IDataItem["IDataItem"]:::model
        IDayData["IDayData"]:::model
        IMonthData["IMonthData"]:::model
        IHeatmapOptions["IHeatmapOptions"]:::model
    end

    %% Relationships
    ConsumerApp --> PublicAPI
    PublicAPI --> ActivityModule
    ActivityModule --> HeatmapComponent
    HeatmapComponent --> Template
    HeatmapComponent --> Styles
    HeatmapComponent --> HeatmapFactory
    HeatmapFactory --> BaseGenerator
    BaseGenerator --> YearGenerator
    BaseGenerator --> MonthsGenerator
    BaseGenerator --> SingleMonthGenerator
    BaseGenerator --> RangeGenerator
    YearGenerator & MonthsGenerator & SingleMonthGenerator & RangeGenerator --> IDataItem
    IDataItem --> IDayData
    IDayData --> IMonthData
    HeatmapComponent --> IHeatmapOptions

    %% Click Events
    click PublicAPI "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/public-api.ts"
    click ActivityModule "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/activity-heatmap.module.ts"
    click HeatmapComponent "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap.component.ts"
    click Template "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap.component.html"
    click Styles "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap.component.css"
    click HeatmapFactory "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/factory/heatmap-factory.ts"
    click BaseGenerator "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/heatmap-generator.ts"
    click YearGenerator "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/generators/year-heatmap-generator.ts"
    click MonthsGenerator "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/generators/months-heatmap-generator.ts"
    click SingleMonthGenerator "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/generators/single-month-heatmap-generator.ts"
    click RangeGenerator "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/generators/range-heatmap-generator.ts"
    click IDataItem "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/interfaces/IDataItem.ts"
    click IDayData "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/interfaces/IDayData.ts"
    click IMonthData "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/interfaces/IMonthData.ts"
    click IHeatmapOptions "https://github.com/AlameerAshraf/angular-activity-heatmap/blob/main/projects/angular-activity-heatmap/src/lib/activity-heatmap/heatmap/heatmap-builder/interfaces/IHeatmapOptions.ts"
```
