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
Array of column definitions. Each column defines the structure and metadata for a data field.
Unique, stable identifier for the column. Must match the keys used in rows objects.
Human-readable label displayed in the UI (axis labels, legends, tooltips). Defaults to the key if not provided.
Internal column metadata. Managed automatically by the editor. Whether the column is hidden from visualization.
aggregation
'count' | 'distinct' | 'max' | 'min' | 'sum' | 'mean' | 'mode' | 'median'
Aggregation function applied to this column.
Array of data rows. Each row is an object with keys matching the column keys. Values can be strings, numbers or null.
Optional metadata for advanced data processing. Locale for parsing dates and numbers. Defaults to 'en-US'.
'en-US': MM/DD/YYYY date format
'en-GB': DD/MM/YYYY date format
Whether the data is transposed. Used by the data table component.
Whether aggregation is active. Managed automatically by the editor.
groupByTimeUnit
'year' | 'quarter' | 'month' | 'week' | 'day'
Time unit for grouping time-based data.
Rolling date filter configuration. timeUnit
'year' | 'quarter' | 'month' | 'week' | 'day'
required
Time unit for the filter.
Number of time units (e.g., last 30 days: { timeUnit: 'day', value: 30 }).
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.