Skip to content

ChartTabularData

ClassChartGuruChartGuru
public sealed class ChartTabularData

Lightweight, in-memory tabular dataset shared by every ChartGuru file and live data source. Produced by ChartGuru.DataSources.Parsers.CsvParser and ChartGuru.DataSources.Parsers.JsonToTabular; consumed by ChartDataFrame.FromTabular(ChartTabularData, string, CultureInfo).

The model is intentionally narrow — strings on disk, typed lookups via helper methods. This keeps parsing cheap (no boxing of every cell into object) and lets the mapping layer convert lazily based on the chosen ChartColumnType.

public static readonly ChartTabularData Empty

Empty singleton — handy null-object for failed parses.

Returns

ChartGuru.ChartTabularData

ChartTabularData(string[], ChartColumnType[], string[], int)

Section titled “ChartTabularData(string[], ChartColumnType[], string[], int)”
public ChartTabularData(string[] columns, ChartColumnType[] types, string[] cells, int rowCount)

Creates a row-major table and precomputes numeric lookups, reading invariant numbers with the comma rules of automatic CSV parsing. Supplied arrays are retained rather than copied; null arrays become empty arrays.

Parameters

NameType
columnsSystem.String[]
typesChartGuru.ChartColumnType[]
cellsSystem.String[]
rowCountSystem.Int32

public int IndexOf(string columnName)

Returns the index of the named column, or -1.

Parameters

NameType
columnNameSystem.String

Returns

System.Int32

public string GetCell(int row, int col)

Raw cell text at [row, col].

Parameters

NameType
rowSystem.Int32
colSystem.Int32

Returns

System.String

public float GetFloat(int row, int col, float fallback = 0)

Parse a cell as float in the table’s number format. Returns fallback on failure.

Parameters

NameType
rowSystem.Int32
colSystem.Int32
fallbackSystem.Single

Returns

System.Single

public bool TryGetFloat(int row, int col, out float value)

Reads a number in the table’s format without conflating an invalid cell with a caller-provided fallback.

Parameters

NameType
rowSystem.Int32
colSystem.Int32
valueSystem.Single

Returns

System.Boolean

TryGetDateTime(int, int, string, CultureInfo, out DateTime)

Section titled “TryGetDateTime(int, int, string, CultureInfo, out DateTime)”
public bool TryGetDateTime(int row, int col, string format, CultureInfo culture, out DateTime value)

Parse a cell as DateTime using format (or any standard format).

Parameters

NameType
rowSystem.Int32
colSystem.Int32
formatSystem.String
cultureSystem.Globalization.CultureInfo
valueSystem.DateTime

Returns

System.Boolean

public IEnumerable<ChartTabularRow> EnumerateRows()

Iterates rows. Each yielded item is bound to the underlying storage; do not capture across iterations.

Returns

System.Collections.Generic.IEnumerable{ChartGuru.ChartTabularRow}

ShapeEquals(ChartTabularData, ChartTabularData)

Section titled “ShapeEquals(ChartTabularData, ChartTabularData)”
public static bool ShapeEquals(ChartTabularData a, ChartTabularData b)

Compares the shape of two datasets — column names, column types, and row count. Used by the diff fast-path to decide between Chart.SetValues() (shape unchanged) and Chart.SetData().

Parameters

NameType
aChartGuru.ChartTabularData
bChartGuru.ChartTabularData

Returns

System.Boolean

public string[] Columns { get; }

Column display names (header row, or generated Col1..ColN).

Returns

System.String[]

public ChartColumnType[] Types { get; }

Inferred type for each column — same length as ChartTabularData.Columns.

Returns

ChartGuru.ChartColumnType[]

public string[] Cells { get; }

Row-major cell storage. Cells[r * ColumnCount + c].

Returns

System.String[]

public int RowCount { get; }

Number of data rows (excludes the header).

Returns

System.Int32

public int ColumnCount { get; }

Number of columns.

Returns

System.Int32