# Chartexa

> A modular, high-performance, backend-agnostic charting engine — by **Kedevo**

[![CI](https://github.com/redrum88/Chartexa/actions/workflows/ci.yml/badge.svg)](https://github.com/redrum88/Chartexa/actions/workflows/ci.yml)
[![NuGet](https://img.shields.io/nuget/v/Chartexa.Core?label=NuGet&color=blue)](https://www.nuget.org/packages/Chartexa.Core)
[![PyPI](https://img.shields.io/pypi/v/chartexa?label=PyPI&color=blue)](https://pypi.org/project/chartexa)
[![.NET](https://img.shields.io/badge/.NET-10.0-purple)](https://dotnet.microsoft.com/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

---

## What is Chartexa?

Chartexa is a rendering-backend-agnostic charting engine that cleanly separates **data**, **logic**, **commands**, **rendering**, and **interaction**. 

Built from scratch in C#/.NET 10, it is designed for high-performance visualization with support for multiple rendering backends.

### Key Capabilities
- High-performance rendering pipeline
- Pluggable renderers (WPF, DirectX 12, Skia, WebAssembly)
- Cross-platform and Python support
- Modular architecture

---

## Installation

### .NET (NuGet)
```bash
# Core engine
dotnet add package Chartexa.Core

# Renderers (choose as needed)
dotnet add package Chartexa.Rendering.Wpf
dotnet add package Chartexa.Rendering.DirectX
dotnet add package Chartexa.Rendering.Skia
dotnet add package Chartexa.Rendering.Web

# Optional modules
dotnet add package Chartexa.Data
dotnet add package Chartexa.Modifiers
dotnet add package Chartexa.Theming
```

### Python
```bash
pip install chartexa
```
> Requires the [.NET 10 Runtime](https://dotnet.microsoft.com/download) to be installed.

---

## Quick Start

### .NET / WPF
```xml
<Window xmlns:chartexa="clr-namespace:Chartexa.Rendering.Wpf.Controls;assembly=Chartexa.Rendering.Wpf">
    <chartexa:ChartSurface x:Name="Chart"/>
</Window>
```

```csharp
using Chartexa.Core.Axes;
using Chartexa.Data.Series;

Chart.XAxes.Add(new NumericAxis { Id = "X" });
Chart.YAxes.Add(new NumericAxis { Id = "Y" });

var series = new XYDataSeries();
series.Append(new[] { 1.0, 2.0, 3.0, 4.0 }, new[] { 10.0, 20.0, 15.0, 30.0 });

Chart.Series.Add(new FastLineRenderableSeries { DataSeries = series });
Chart.InvalidateChart();
```

### Python

```python
import chartexa as cx

# One-liner convenience functions
cx.line([10, 20, 15, 30, 25]).save("chart.png")

# Fluent API with multiple series
(cx.Chart(800, 600)
    .line([1, 2, 3, 4], [10, 20, 15, 30], stroke="#4FC3F7", label="Revenue")
    .scatter([1, 2, 3, 4], [12, 18, 17, 28], fill="red", label="Targets")
    .save("multi_series.png"))

# Financial charts from Pandas DataFrames
import pandas as pd
df = pd.read_csv("stock_data.csv")
cx.candlestick(df).save("candlestick.png")

# Multi-panel dashboards
fig, axes = cx.subplots(2, 2)
axes[0, 0].line([1, 2, 3], [10, 20, 15])
axes[0, 1].scatter([1, 2, 3], [30, 10, 25])
fig.save("dashboard.png")
```

The Python package provides 40+ series types, NumPy/Pandas integration, Jupyter notebook support, LTTB downsampling for large datasets, and real-time streaming capabilities. See the [PyPI page](https://pypi.org/project/chartexa) for full documentation.

---

## Architecture

Chartexa uses a clean, layered architecture:

```
User Code → ChartSurface → Axes + Series
         → RenderPipeline → RenderCommand[]
         → Renderer (WPF / DirectX / Skia / Web)
```

Full architecture documentation is available in the repository (see `ARCHITECTURE.md`).

---

## Available Packages

| Package                    | Description                          | Platform          |
|---------------------------|--------------------------------------|-------------------|
| **Chartexa.Core**         | Core engine primitives               | Cross-platform    |
| **Chartexa.Data**         | Data series and processing           | Cross-platform    |
| **Chartexa.Rendering.Wpf**| WPF renderer + controls              | Windows (WPF)     |
| **Chartexa.Rendering.DirectX** | DirectX 12 GPU renderer         | Windows           |
| **Chartexa.Rendering.Skia**| SkiaSharp cross-platform renderer   | Cross-platform    |
| **Chartexa.Rendering.Web**| WebAssembly / JSON export            | Cross-platform    |
| **Chartexa.Modifiers**    | Interaction modifiers                | Windows (WPF)     |
| **Chartexa.Theming**      | Theme system                         | Cross-platform    |

---

## Building from Source

### Prerequisites
- [.NET 10 SDK](https://dotnet.microsoft.com/download)
- Windows (required for WPF and DirectX renderer development)

### Commands
```bash
dotnet build
dotnet test
```

Run the WPF demo:
```bash
dotnet run --project examples/WpfDemo
```

---

## License
MIT — see [LICENSE](LICENSE) for details.

---
