Skip to content

Repository files navigation

Pure.Chart.Model

Concrete implementations of the chart domain model for the Pure ecosystem — immutable, AOT-compatible records implementing the Pure.Chart.Model.Abstractions contracts.

.NET build & test Build and Deploy NuGet License: MIT

Overview

Pure.Chart.Model provides sealed record implementations of the chart abstractions defined in Pure.Chart.Model.Abstractions. Each type is immutable by construction, taking all values through its constructor, and depends on IString from Pure.Primitives.Abstractions for all string-valued properties.

Types

Type Implements Description
Chart IChart Root chart record — holds title, description, type, two axes, and a series collection
Axis IAxis Single axis with a legend label
ChartSeries IChartSeries A data series with a legend and source column names for each axis
ChartType IChartType Named chart type (e.g. bar, line, pie)

All types reside in the Pure.Chart.Model namespace.

Design Principles

  • Immutable — all properties are init-only; values are set once in the constructor and never changed.
  • Composable — Chart aggregates IAxis, IChartType, and IEnumerable<IChartSeries>, all of which are abstractions, so any implementation can be substituted.
  • AOT-compatible — sealed records with no reflection or dynamic dispatch; the package is fully compatible with Native AOT.

Dependencies

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Chart.Model

Usage

using Pure.Chart.Model;
using Pure.Primitives.Abstractions.String;

// Assuming MyString : IString is provided by your primitives implementation
IString title       = new MyString("Sales 2024");
IString description = new MyString("Monthly revenue by region");
IString typeName    = new MyString("bar");
IString xLegend     = new MyString("Month");
IString yLegend     = new MyString("Revenue");
IString seriesName  = new MyString("EMEA");
IString xSource     = new MyString("month_col");
IString ySource     = new MyString("revenue_col");

var chart = new Chart(
    title,
    description,
    new ChartType(typeName),
    new Axis(xLegend),
    new Axis(yLegend),
    [new ChartSeries(seriesName, xSource, ySource)]
);

About

Concrete immutable record implementations of the chart domain model for the Pure ecosystem — implements Pure.Chart.Model.Abstractions contracts.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

Generated from kudima03/Pure.Template