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 ChartGuru.ChartTabularDataToMarks.

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 [ChartGuru.ChartColumnType](/tools/chartguru/api/chartguru-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 invariant-culture numeric lookups. Supplied arrays are retained rather than copied; null arrays become empty arrays.

Parameters

Name Type
columns System.String[]
types ChartGuru.ChartColumnType[]
cells System.String[]
rowCount System.Int32

public int IndexOf(string columnName)

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

Parameters

Name Type
columnName System.String

Returns

System.Int32

public string GetCell(int row, int col)

Raw cell text at [row, col].

Parameters

Name Type
row System.Int32
col System.Int32

Returns

System.String

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

Parse a cell as System.Single using invariant culture. Returns fallback on failure.

Parameters

Name Type
row System.Int32
col System.Int32
fallback System.Single

Returns

System.Single

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 System.DateTime using format (or any standard format).

Parameters

Name Type
row System.Int32
col System.Int32
format System.String
culture System.Globalization.CultureInfo
value System.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

Name Type
a ChartGuru.ChartTabularData
b ChartGuru.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 ChartGuru.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