# chartsorg/charts architecture

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

- Interactive diagram: https://gitdiagram.com/chartsorg/charts
- Repository: https://github.com/chartsorg/charts

## Overview

DGCharts is a Swift charting library for Apple platforms, usable from Swift and Objective-C. Its principal workflow is that an app supplies chart entries and datasets to a chart view; the view coordinates axes, transforms and rendering to display a chart, with gestures supporting zooming and highlighting. The library also provides formatting, animation, markers and multiple chart families. The graph uses the README and SOURCE INDEX references; unsampled implementation details are represented at directory level, and unverified links are dashed.

Main entry points: [`Source/Charts/Charts/BarLineChartViewBase.swift`](https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/BarLineChartViewBase.swift) (Bar and line views), [`Source/Charts/Data/Implementations/Standard/ChartData.swift`](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartData.swift) (Chart data), [`Source/Charts/Renderers`](https://github.com/chartsorg/charts/tree/master/Source/Charts/Renderers) (Chart renderers), [`Source/Charts/Renderers/BarChartRenderer.swift`](https://github.com/chartsorg/charts/blob/master/Source/Charts/Renderers/BarChartRenderer.swift) (Bar renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Chart data"]
  node_entries["Entries"]
  node_barentries["Bar entries"]
  node_datasets["Datasets<br/>[ChartDataSet.swift]"]
  node_bardatasets["Bar datasets"]
  node_chartdata["Chart data<br/>[ChartData.swift]"]
end

subgraph group_views["Chart views"]
  node_barviews["Bar and line views"]
  node_chartbase["Base chart view"]
  node_chartfamilies["Chart families"]
  node_combined["Combined charts"]
end

subgraph group_render["Rendering and layout"]
  node_axes["Axes<br/>[AxisBase.swift]"]
  node_yaxis["Y axis<br/>[YAxis.swift]"]
  node_axisformat["Axis formatting"]
  node_valueformat["Value formatting"]
  node_renderers["Chart renderers"]
  node_barrenderer["Bar renderer"]
  node_viewport["Viewport handling"]
end

subgraph group_interaction["Interaction and presentation"]
  node_highlights["Highlight selection<br/>[Highlight.swift]"]
  node_gestures["Gestures and zoom"]
  node_animation["Chart animation<br/>[Animator.swift]"]
  node_markers["Markers<br/>[Marker.swift]"]
end

node_app(("App developer"))
node_demo["Demo selection"]
node_chartresult["Rendered chart"]

node_app -.->|"provides values"| node_entries
node_app -.->|"configures data"| node_datasets
node_app -.->|"uses chart view"| node_barviews
node_entries -.->|"forms data"| node_chartdata
node_barentries -->|"populates"| node_bardatasets
node_datasets -.->|"groups datasets"| node_chartdata
node_chartdata -.->|"supplies chart data"| node_barviews
node_barviews -->|"inherits from"| node_chartbase
node_barviews -->|"uses axis"| node_yaxis
node_barviews -->|"draws through"| node_renderers
node_barviews -->|"transforms viewport"| node_viewport
node_barviews -->|"selects values"| node_highlights
node_barviews -->|"handles gestures"| node_gestures
node_barrenderer -->|"reads dataset"| node_bardatasets
node_barrenderer -->|"uses viewport"| node_viewport
node_axes -->|"specialized by"| node_yaxis
node_axisformat -.->|"formats labels"| node_axes
node_valueformat -.->|"formats values"| node_chartdata
node_animation -.->|"animates drawing"| node_renderers
node_markers -.->|"presents selection"| node_highlights
node_combined -.->|"combines chart types"| node_chartfamilies
node_demo -->|"demonstrates charts"| node_chartfamilies
node_renderers -.->|"draws chart"| node_chartresult

click node_entries "https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift"
click node_barentries "https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift"
click node_datasets "https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift"
click node_bardatasets "https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift"
click node_chartdata "https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartData.swift"
click node_barviews "https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/BarLineChartViewBase.swift"
click node_chartbase "https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/ChartViewBase.swift"
click node_chartfamilies "https://github.com/chartsorg/charts/tree/master/Source/Charts/Charts"
click node_combined "https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/CombinedChartView.swift"
click node_axes "https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/AxisBase.swift"
click node_yaxis "https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/YAxis.swift"
click node_axisformat "https://github.com/chartsorg/charts/blob/master/Source/Charts/Formatters/AxisValueFormatter.swift"
click node_valueformat "https://github.com/chartsorg/charts/blob/master/Source/Charts/Formatters/ValueFormatter.swift"
click node_renderers "https://github.com/chartsorg/charts/tree/master/Source/Charts/Renderers"
click node_barrenderer "https://github.com/chartsorg/charts/blob/master/Source/Charts/Renderers/BarChartRenderer.swift"
click node_viewport "https://github.com/chartsorg/charts/blob/master/Source/Charts/Utils/ViewPortHandler.swift"
click node_highlights "https://github.com/chartsorg/charts/blob/master/Source/Charts/Highlight/Highlight.swift"
click node_gestures "https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/BarLineChartViewBase.swift"
click node_animation "https://github.com/chartsorg/charts/blob/master/Source/Charts/Animation/Animator.swift"
click node_markers "https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/Marker.swift"
click node_demo "https://github.com/chartsorg/charts/blob/master/ChartsDemo-iOS/Swift/DemoListViewController.swift"

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_entries,node_barentries,node_datasets,node_bardatasets,node_chartdata toneBlue
class node_barviews,node_chartbase,node_chartfamilies,node_combined toneAmber
class node_axes,node_yaxis,node_axisformat,node_valueformat,node_renderers,node_barrenderer,node_viewport toneMint
class node_highlights,node_gestures,node_animation,node_markers toneRose
class node_app,node_chartresult toneIndigo
class node_demo toneTeal
```

## Components

### Chart data

- [Entries](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift): `Source/Charts/Data/Implementations/Standard/ChartDataEntry.swift`
- [Bar entries](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift): `Source/Charts/Data/Implementations/Standard/BarChartDataEntry.swift`
- [Datasets](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartDataSet.swift): `Source/Charts/Data/Implementations/Standard/ChartDataSet.swift`
- [Bar datasets](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift): `Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift`
- [Chart data](https://github.com/chartsorg/charts/blob/master/Source/Charts/Data/Implementations/Standard/ChartData.swift): `Source/Charts/Data/Implementations/Standard/ChartData.swift`

### Chart views

- [Bar and line views](https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/BarLineChartViewBase.swift): `Source/Charts/Charts/BarLineChartViewBase.swift`
- [Base chart view](https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/ChartViewBase.swift): `Source/Charts/Charts/ChartViewBase.swift`
- [Chart families](https://github.com/chartsorg/charts/tree/master/Source/Charts/Charts): `Source/Charts/Charts`
- [Combined charts](https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/CombinedChartView.swift): `Source/Charts/Charts/CombinedChartView.swift`

### Rendering and layout

- [Axes](https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/AxisBase.swift): `Source/Charts/Components/AxisBase.swift`
- [Y axis](https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/YAxis.swift): `Source/Charts/Components/YAxis.swift`
- [Axis formatting](https://github.com/chartsorg/charts/blob/master/Source/Charts/Formatters/AxisValueFormatter.swift): `Source/Charts/Formatters/AxisValueFormatter.swift`
- [Value formatting](https://github.com/chartsorg/charts/blob/master/Source/Charts/Formatters/ValueFormatter.swift): `Source/Charts/Formatters/ValueFormatter.swift`
- [Chart renderers](https://github.com/chartsorg/charts/tree/master/Source/Charts/Renderers): `Source/Charts/Renderers`
- [Bar renderer](https://github.com/chartsorg/charts/blob/master/Source/Charts/Renderers/BarChartRenderer.swift): `Source/Charts/Renderers/BarChartRenderer.swift`
- [Viewport handling](https://github.com/chartsorg/charts/blob/master/Source/Charts/Utils/ViewPortHandler.swift): `Source/Charts/Utils/ViewPortHandler.swift`

### Interaction and presentation

- [Highlight selection](https://github.com/chartsorg/charts/blob/master/Source/Charts/Highlight/Highlight.swift): `Source/Charts/Highlight/Highlight.swift`
- [Gestures and zoom](https://github.com/chartsorg/charts/blob/master/Source/Charts/Charts/BarLineChartViewBase.swift): `Source/Charts/Charts/BarLineChartViewBase.swift`
- [Chart animation](https://github.com/chartsorg/charts/blob/master/Source/Charts/Animation/Animator.swift): `Source/Charts/Animation/Animator.swift`
- [Markers](https://github.com/chartsorg/charts/blob/master/Source/Charts/Components/Marker.swift): `Source/Charts/Components/Marker.swift`

### Other components

- **App developer**
- [Demo selection](https://github.com/chartsorg/charts/blob/master/ChartsDemo-iOS/Swift/DemoListViewController.swift): `ChartsDemo-iOS/Swift/DemoListViewController.swift`
- **Rendered chart**

## Connections

- App developer → Entries: provides values
- App developer → Datasets: configures data
- App developer → Bar and line views: uses chart view
- Entries → Chart data: forms data
- Bar entries → Bar datasets: populates (evidence: `Source/Charts/Data/Implementations/Standard/BarChartDataSet.swift`)
- Datasets → Chart data: groups datasets
- Chart data → Bar and line views: supplies chart data
- Bar and line views → Base chart view: inherits from (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar and line views → Y axis: uses axis (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar and line views → Chart renderers: draws through (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar and line views → Viewport handling: transforms viewport (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar and line views → Highlight selection: selects values (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar and line views → Gestures and zoom: handles gestures (evidence: `Source/Charts/Charts/BarLineChartViewBase.swift`)
- Bar renderer → Bar datasets: reads dataset (evidence: `Source/Charts/Renderers/BarChartRenderer.swift`)
- Bar renderer → Viewport handling: uses viewport (evidence: `Source/Charts/Renderers/BarChartRenderer.swift`)
- Axes → Y axis: specialized by (evidence: `Source/Charts/Components/YAxis.swift`)
- Axis formatting → Axes: formats labels (evidence: `Source/Charts/Formatters/AxisValueFormatter.swift`)
- Value formatting → Chart data: formats values
- Chart animation → Chart renderers: animates drawing (evidence: `Source/Charts/Renderers/BarChartRenderer.swift`)
- Markers → Highlight selection: presents selection
- Combined charts → Chart families: combines chart types
- Demo selection → Chart families: demonstrates charts (evidence: `ChartsDemo-iOS/Swift/DemoListViewController.swift`)
- Chart renderers → Rendered chart: draws chart
