Skip to main content

Basic structure

Data is structured as a table with explicitly defined columns and rows:
const config: GraphConfig = {
  data: {
    columns: [
      { key: 'category', label: 'Category' },
      { key: 'value', label: 'Value' }
    ],
    rows: [
      { category: 'A', value: 100 },
      { category: 'B', value: 200 },
      { category: 'C', value: 150 }
    ]
  }
};
The columns array defines your data structure, while rows contains the actual values. Each row object must have keys matching the column keys.

Data type inference

Graphy automatically infers the type of each column based on the values in your rows. This determines how the data is visualised and formatted. Text columns - Strings are treated as categorical data:
{ category: 'North', value: 100 }
{ category: 'South', value: 200 }
Date columns - Date-like strings are automatically parsed. Graphy recognises ISO dates, month names and locale-specific formats:
{ date: '2024-01-15', value: 100 }
{ date: 'January 2024', value: 200 }
{ date: '15/01/2024', value: 150 }  // DD/MM/YYYY with en-GB locale
Numeric columns - Numbers and numeric strings are treated as quantitative data:
{ category: 'A', value: 100 }
{ category: 'B', value: '200' }      // String numbers work too
{ category: 'C', value: 1500.50 }
Currency columns - Currency-formatted strings are parsed as numbers:
{ product: 'A', price: '$1,250' }
{ product: 'B', price: '£2,450.50' }
{ product: 'C', price: '€3,000' }
Graphy uses the inferred data types to automatically determine which columns to use for axes. Typically, categorical or date columns become the x-axis and numeric columns become the y-axis.

Schema

data.columns
Column[]
required
Array of column definitions. Each column defines the structure and metadata for a data field.
columns[].key
string
required
Unique, stable identifier for the column. Must match the keys used in rows objects.
columns[].label
string
Human-readable label displayed in the UI (axis labels, legends, tooltips). Defaults to the key if not provided.
columns[]._metadata
object
Internal column metadata. Managed automatically by the editor.
data.rows
Row[]
required
Array of data rows. Each row is an object with keys matching the column keys. Values can be strings, numbers or null.
data._metadata
object
Optional metadata for advanced data processing.
Row object keys must exactly match the key values in your columns array. Data with keys that don’t have a corresponding column definition will be ignored.