# klinecharts/pro architecture

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

- Interactive diagram: https://gitdiagram.com/klinecharts/pro
- Repository: https://github.com/klinecharts/pro

## Overview

KLineChart Pro is a configurable financial-chart UI built on KLineChart. The user selects a symbol and period, views chart data, and can adjust indicators, drawing overlays, appearance, timezone, and capture a screenshot. The main chart component coordinates the chart engine and its widgets; data access is abstracted behind a datafeed. The excerpts establish the component wiring and several widget interactions, but do not show the full chart-data request path or DefaultDatafeed implementation, so those links are not asserted.

Main entry points: [`src/ChartProComponent.tsx`](https://github.com/klinecharts/pro/blob/main/src/ChartProComponent.tsx) (Chart component), [`src/index.ts`](https://github.com/klinecharts/pro/blob/main/src/index.ts) (Public API), [`src/widget/drawing-bar/index.tsx`](https://github.com/klinecharts/pro/blob/main/src/widget/drawing-bar/index.tsx) (Drawing toolbar), [`src/DefaultDatafeed.ts`](https://github.com/klinecharts/pro/blob/main/src/DefaultDatafeed.ts) (Default datafeed)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chart["Chart runtime"]
  node_api["Public API<br/>[index.ts]"]
  node_chartapi["Chart interface<br/>[KLineChartPro.tsx]"]
  node_chartui["Chart component"]
  node_engine["KLineChart engine"]
  node_feed["Default datafeed<br/>[DefaultDatafeed.ts]"]
end

subgraph group_controls["Chart controls"]
  node_period["Period bar<br/>[index.tsx]"]
  node_symbol["Symbol search<br/>[index.tsx]"]
  node_indicators["Indicator controls<br/>[index.tsx]"]
  node_indicatorconfig["Indicator settings<br/>[index.tsx]"]
  node_settings["Chart settings<br/>[index.tsx]"]
  node_timezone["Timezone controls<br/>[index.tsx]"]
  node_screenshot["Screenshot dialog<br/>[index.tsx]"]
end

subgraph group_drawings["Drawing tools"]
  node_drawingbar["Drawing toolbar<br/>[index.tsx]"]
  node_overlays["Drawing overlays"]
  node_drawingicons["Drawing icons"]
end

subgraph group_foundation["Shared services"]
  node_primitives["UI components"]
  node_locales["Localization<br/>[index.ts]"]
end

node_user(("Chart user"))
node_market["Market data service"]

node_user -->|"configures"| node_api
node_api -->|"exports"| node_chartapi
node_api -->|"registers"| node_overlays
node_api -->|"exports"| node_feed
node_chartapi -->|"creates"| node_chartui
node_chartui -->|"initializes"| node_engine
node_chartui -->|"renders"| node_symbol
node_chartui -->|"renders"| node_indicators
node_chartui -->|"renders"| node_indicatorconfig
node_chartui -->|"renders"| node_screenshot
node_chartui -->|"uses"| node_period
node_chartui -->|"uses"| node_drawingbar
node_chartui -->|"uses"| node_settings
node_chartui -->|"uses"| node_timezone
node_drawingbar -->|"renders"| node_drawingicons
node_drawingbar -.->|"selects"| node_overlays
node_chartui -->|"uses"| node_primitives
node_chartui -.->|"uses"| node_locales
node_symbol -->|"searches"| node_feed
node_feed -.->|"fetches data"| node_market

click node_api "https://github.com/klinecharts/pro/blob/main/src/index.ts"
click node_chartapi "https://github.com/klinecharts/pro/blob/main/src/KLineChartPro.tsx"
click node_chartui "https://github.com/klinecharts/pro/blob/main/src/ChartProComponent.tsx"
click node_feed "https://github.com/klinecharts/pro/blob/main/src/DefaultDatafeed.ts"
click node_period "https://github.com/klinecharts/pro/blob/main/src/widget/period-bar/index.tsx"
click node_symbol "https://github.com/klinecharts/pro/blob/main/src/widget/symbol-search-modal/index.tsx"
click node_indicators "https://github.com/klinecharts/pro/blob/main/src/widget/indicator-modal/index.tsx"
click node_indicatorconfig "https://github.com/klinecharts/pro/blob/main/src/widget/indicator-setting-modal/index.tsx"
click node_settings "https://github.com/klinecharts/pro/blob/main/src/widget/setting-modal/index.tsx"
click node_timezone "https://github.com/klinecharts/pro/blob/main/src/widget/timezone-modal/index.tsx"
click node_screenshot "https://github.com/klinecharts/pro/blob/main/src/widget/screenshot-modal/index.tsx"
click node_drawingbar "https://github.com/klinecharts/pro/blob/main/src/widget/drawing-bar/index.tsx"
click node_overlays "https://github.com/klinecharts/pro/tree/main/src/extension"
click node_drawingicons "https://github.com/klinecharts/pro/tree/main/src/widget/drawing-bar/icons"
click node_primitives "https://github.com/klinecharts/pro/tree/main/src/component"
click node_locales "https://github.com/klinecharts/pro/blob/main/src/i18n/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_chartapi,node_chartui,node_engine,node_feed,node_user toneBlue
class node_period,node_symbol,node_indicators,node_indicatorconfig,node_settings,node_timezone,node_screenshot toneAmber
class node_drawingbar,node_overlays,node_drawingicons toneMint
class node_primitives,node_locales toneRose
class node_market toneIndigo
```

## Components

### Chart runtime

- [Public API](https://github.com/klinecharts/pro/blob/main/src/index.ts): `src/index.ts`
- [Chart interface](https://github.com/klinecharts/pro/blob/main/src/KLineChartPro.tsx): `src/KLineChartPro.tsx`
- [Chart component](https://github.com/klinecharts/pro/blob/main/src/ChartProComponent.tsx): `src/ChartProComponent.tsx`
- **KLineChart engine**
- [Default datafeed](https://github.com/klinecharts/pro/blob/main/src/DefaultDatafeed.ts): `src/DefaultDatafeed.ts`

### Chart controls

- [Period bar](https://github.com/klinecharts/pro/blob/main/src/widget/period-bar/index.tsx): `src/widget/period-bar/index.tsx`
- [Symbol search](https://github.com/klinecharts/pro/blob/main/src/widget/symbol-search-modal/index.tsx): `src/widget/symbol-search-modal/index.tsx`
- [Indicator controls](https://github.com/klinecharts/pro/blob/main/src/widget/indicator-modal/index.tsx): `src/widget/indicator-modal/index.tsx`
- [Indicator settings](https://github.com/klinecharts/pro/blob/main/src/widget/indicator-setting-modal/index.tsx): `src/widget/indicator-setting-modal/index.tsx`
- [Chart settings](https://github.com/klinecharts/pro/blob/main/src/widget/setting-modal/index.tsx): `src/widget/setting-modal/index.tsx`
- [Timezone controls](https://github.com/klinecharts/pro/blob/main/src/widget/timezone-modal/index.tsx): `src/widget/timezone-modal/index.tsx`
- [Screenshot dialog](https://github.com/klinecharts/pro/blob/main/src/widget/screenshot-modal/index.tsx): `src/widget/screenshot-modal/index.tsx`

### Drawing tools

- [Drawing toolbar](https://github.com/klinecharts/pro/blob/main/src/widget/drawing-bar/index.tsx): `src/widget/drawing-bar/index.tsx`
- [Drawing overlays](https://github.com/klinecharts/pro/tree/main/src/extension): `src/extension`
- [Drawing icons](https://github.com/klinecharts/pro/tree/main/src/widget/drawing-bar/icons): `src/widget/drawing-bar/icons`

### Shared services

- [UI components](https://github.com/klinecharts/pro/tree/main/src/component): `src/component`
- [Localization](https://github.com/klinecharts/pro/blob/main/src/i18n/index.ts): `src/i18n/index.ts`

### Other components

- **Chart user**
- **Market data service**

## Connections

- Chart user → Public API: configures
- Public API → Chart interface: exports (evidence: `src/index.ts`)
- Public API → Drawing overlays: registers (evidence: `src/index.ts`)
- Public API → Default datafeed: exports (evidence: `src/index.ts`)
- Chart interface → Chart component: creates (evidence: `src/KLineChartPro.tsx`)
- Chart component → KLineChart engine: initializes (evidence: `src/ChartProComponent.tsx`)
- Chart component → Symbol search: renders (evidence: `src/ChartProComponent.tsx`)
- Chart component → Indicator controls: renders (evidence: `src/ChartProComponent.tsx`)
- Chart component → Indicator settings: renders (evidence: `src/ChartProComponent.tsx`)
- Chart component → Screenshot dialog: renders (evidence: `src/ChartProComponent.tsx`)
- Chart component → Period bar: uses
- Chart component → Drawing toolbar: uses
- Chart component → Chart settings: uses
- Chart component → Timezone controls: uses
- Drawing toolbar → Drawing icons: renders (evidence: `src/widget/drawing-bar/index.tsx`)
- Drawing toolbar → Drawing overlays: selects
- Chart component → UI components: uses (evidence: `src/ChartProComponent.tsx`)
- Chart component → Localization: uses
- Symbol search → Default datafeed: searches (evidence: `src/widget/symbol-search-modal/index.tsx`)
- Default datafeed → Market data service: fetches data
