Concrete implementations of the chart domain model for the Pure ecosystem — immutable, AOT-compatible records implementing the Pure.Chart.Model.Abstractions contracts.
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.
| 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.
- Immutable — all properties are init-only; values are set once in the constructor and never changed.
- Composable —
ChartaggregatesIAxis,IChartType, andIEnumerable<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.
Pure.Chart.Model.Abstractions— interfacesIChart,IAxis,IChartSeries, andIChartTypethat this package implementsPure.Primitives.Abstractions— base primitive interfaces;IStringis used for all string-valued properties
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.Chart.ModelusingPure.Chart.Model;usingPure.Primitives.Abstractions.String;// Assuming MyString : IString is provided by your primitives implementationIStringtitle=newMyString("Sales 2024");IStringdescription=newMyString("Monthly revenue by region");IStringtypeName=newMyString("bar");IStringxLegend=newMyString("Month");IStringyLegend=newMyString("Revenue");IStringseriesName=newMyString("EMEA");IStringxSource=newMyString("month_col");IStringySource=newMyString("revenue_col");varchart=newChart(title,description,newChartType(typeName),newAxis(xLegend),newAxis(yLegend),[newChartSeries(seriesName,xSource,ySource)]);