# ChartDataset<T>

Represents an immutable, renderer-neutral collection of source rows that can be transformed before chart construction.

 Class  

`ChartForgeX.Data`

**Namespace**

`ChartForgeX.Data`

**Assembly**

`ChartForgeX`

**Source**

[ChartDataset.cs:36](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L36)

**Implements**

 `IReadOnlyList<T>` `IReadOnlyCollection<T>` `IEnumerable<T>` `IEnumerable` 

**Modifiers**

sealed

**Attributes**

 `DefaultMember("Item")` 

Represents an immutable, renderer-neutral collection of source rows that can be transformed before chart construction.

## Inheritance

- object
- ChartDataset<T>

## Usage

 Explore 13 API references to this type 

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 10

- Property [ChartDataBin<T>.Dataset](/api/chartforgex-data-chartdatabin/#property-dataset)
- Property [ChartDataGroup<T1, T2>.Dataset](/api/chartforgex-data-chartdatagroup/#property-dataset)
- Method [ChartDataset<T>.Bin](/api/chartforgex-data-chartdataset/#method-bin-func-system-double-int32)
- Method [ChartDataset<T>.Filter](/api/chartforgex-data-chartdataset/#method-filter-func-system-boolean)
- Method [ChartDataset<T>.From](/api/chartforgex-data-chartdataset/#method-from-collections-generic-ienumerable)
- Method [ChartDataset<T>.Select``1](/api/chartforgex-data-chartdataset/#method-select-func)
- Method [ChartDataset<T>.SortByDescending``1](/api/chartforgex-data-chartdataset/#method-sortbydescending-func-collections-generic-icomparer)
- Method [ChartDataset<T>.SortBy``1](/api/chartforgex-data-chartdataset/#method-sortby-func-collections-generic-icomparer)
- Method [ChartDataset<T>.Summarize``2](/api/chartforgex-data-chartdataset/#method-summarize-func-func-system-collections-generic-ireadonlylist-collections-generic-iequalitycomparer)
- Property [ChartDataset<T>.Empty](/api/chartforgex-data-chartdataset/#property-empty)

### Accepted by parameters 3

- Method [Chart.AddHistogram``1](/api/chartforgex-core-chart/#method-addhistogram-string-chartforgex-data-chartdataset-chartforgex-data-chartdatabin-nullable-chartforgex-primitives-chartcolor) parameter `bins`
- Method [ChartGrid.FromFacets``2](/api/chartforgex-core-chartgrid/#method-fromfacets-chartforgex-data-chartdataset-func-func-chartforgex-data-chartdataset-chartforgex-core-chart-int32-collections-generic-iequalitycomparer) parameter `chartFactory`
- Method [ChartGrid.FromFacets``2](/api/chartforgex-core-chartgrid/#method-fromfacets-chartforgex-data-chartdataset-func-func-chartforgex-data-chartdataset-chartforgex-core-chart-int32-collections-generic-iequalitycomparer) parameter `dataset`

## Type Parameters

**T**

The source row type.

 Filter members   

    Show inherited   

 

## Methods

 Bin 2 overloads 

 `public ChartDataset<ChartDataBin<T?>> Bin(Func<T?, double> valueSelector, int binCount)` [#](#method-bin-func-system-double-int32) 

[ChartDataset.cs:84](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L84)

Partitions a numeric measure into the same rounded, equal-width layout used by scalar histogram ingestion.

Parameters

**valueSelector System.Func<T?, double> required**

**binCount int required**

Returns

 `ChartDataset<ChartDataBin<T?>>` 

 `public ChartDataset<ChartDataBin<T?>> Bin(Func<T?, double> valueSelector, ChartHistogramBinLayout layout)` [#](#method-bin-func-system-double-chartforgex-core-charthistogrambinlayout) 

[ChartDataset.cs:104](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L104)

Partitions measurements through an explicit shared layout, preserving empty intervals and rejecting observations outside intervals or in gaps.

Parameters

**valueSelector System.Func<T?, double> required**

**layout ChartForgeX.Core.ChartHistogramBinLayout required**

Returns

 `ChartDataset<ChartDataBin<T?>>` 

 `public ChartDataset<T?> Filter(Func<T?, bool> predicate)` [#](#method-filter-func-system-boolean) 

[ChartDataset.cs:42](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L42)

Returns rows accepted by the predicate without changing this dataset.

Parameters

**predicate System.Func<T?, bool> required**

Returns

 `ChartDataset<T?>` 

 `public static ChartDataset<T?> From(IEnumerable<T?> rows)` [#](#method-from-collections-generic-ienumerable) 

[ChartDataset.cs:36](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L36)

Materializes a source sequence once into an immutable dataset.

Parameters

**rows System.Collections.Generic.IEnumerable<T?> required**

Returns

 `ChartDataset<T?>` 

 `public IEnumerator<T?> GetEnumerator()` [#](#method-getenumerator) 

[ChartDataset.cs:132](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L132)

Returns an enumerator over the dataset rows in insertion order.

Returns

 `IEnumerator<T?>` 

 `public IReadOnlyList<ChartDataGroup<TKey?, T?>> GroupBy<TKey>(Func<T?, TKey?> keySelector, IEqualityComparer<TKey?>? comparer = null)` [#](#method-groupby-func-collections-generic-iequalitycomparer) 

[ChartDataset.cs:66](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L66)

Groups rows by key while preserving first-key and source-row order.

Type Parameters

**TKey**

Parameters

**keySelector System.Func<T?, TKey?> required**

**comparer System.Collections.Generic.IEqualityComparer<TKey?>? = null optional**

Returns

 `IReadOnlyList<ChartDataGroup<TKey?, T?>>` 

 `public ChartDataset<TResult?> Select<TResult>(Func<T?, TResult?> selector)` [#](#method-select-func) 

[ChartDataset.cs:60](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L60)

Projects every row into a new immutable dataset.

Type Parameters

**TResult**

Parameters

**selector System.Func<T?, TResult?> required**

Returns

 `ChartDataset<TResult?>` 

 `public ChartDataset<T?> SortByDescending<TKey>(Func<T?, TKey?> keySelector, IComparer<TKey?>? comparer = null)` [#](#method-sortbydescending-func-collections-generic-icomparer) 

[ChartDataset.cs:54](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L54)

Returns rows ordered descending by the selected key without changing this dataset.

Type Parameters

**TKey**

Parameters

**keySelector System.Func<T?, TKey?> required**

**comparer System.Collections.Generic.IComparer<TKey?>? = null optional**

Returns

 `ChartDataset<T?>` 

 `public ChartDataset<T?> SortBy<TKey>(Func<T?, TKey?> keySelector, IComparer<TKey?>? comparer = null)` [#](#method-sortby-func-collections-generic-icomparer) 

[ChartDataset.cs:48](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L48)

Returns rows ordered by the selected key without changing this dataset.

Type Parameters

**TKey**

Parameters

**keySelector System.Func<T?, TKey?> required**

**comparer System.Collections.Generic.IComparer<TKey?>? = null optional**

Returns

 `ChartDataset<T?>` 

 `public ChartDataset<TResult?> Summarize<TKey, TResult>(Func<T?, TKey?> keySelector, Func<TKey?, IReadOnlyList<T?>, TResult?> summarize, IEqualityComparer<TKey?>? comparer = null)` [#](#method-summarize-func-func-system-collections-generic-ireadonlylist-collections-generic-iequalitycomparer) 

[ChartDataset.cs:78](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L78)

Creates one summary row per group.

Type Parameters

**TKey**

**TResult**

Parameters

**keySelector System.Func<T?, TKey?> required**

**summarize System.Func<TKey?, System.Collections.Generic.IReadOnlyList<T?>, TResult?> required**

**comparer System.Collections.Generic.IEqualityComparer<TKey?>? = null optional**

Returns

 `ChartDataset<TResult?>` 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Properties

 `public static ChartDataset<T?> Empty { get; }` [#](#property-empty) 

[ChartDataset.cs:23](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L23)

Gets an empty dataset.

 `public int Count { get; }` [#](#property-count) 

[ChartDataset.cs:26](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L26)

Gets the number of rows.

 `public T? this[int index] { get; }` [#](#property-item-int32) 

[ChartDataset.cs:29](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L29)

Gets the row at the specified position.

Parameters

**index int required**

 `public IReadOnlyList<T?> Rows { get; }` [#](#property-rows) 

[ChartDataset.cs:32](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Data/ChartDataset.cs#L32)

Gets the rows through a read-only collection.

<!-- PowerForge markdown artifact sha256:97BDDA8400E852BB0FD13B7F2849134DD2A595046C9D040186E5D7B038DEDC2A -->
