Skip to content
Reeflow
Start Building

Mock Data

This page provides information about the mock data system for the Reeflow Core SDK.

When developing or testing your application, you can use the built-in mock data system by setting the mock attribute on the <reeflow-provider> component.

The mock data system provides intelligent sample data based on an e-commerce scenario with 20 orders from 2024. Unlike static mock data, the Reeflow SDK’s mock system:

  • Automatically aggregates data for chart queries
  • Supports time-based grouping with different granularities
  • Handles filtering and pagination for table queries
  • Returns properly formatted results matching real API responses

The mock dataset represents e-commerce orders with the following columns:

ColumnTypeDescriptionExample Values
order_idintegerUnique order identifier1, 2, 3…
order_datedateOrder date (YYYY-MM-DD)2024-01-15, 2024-03-22
customer_nametextCustomer full nameAlice Johnson, Bob Smith
product_categorytextProduct categoryElectronics, Clothing, Books
product_nametextProduct nameLaptop Pro 15”, Winter Jacket
total_amountrealOrder total in USD1299.99, 89.99
statustextOrder statuscompleted, shipped, processing, pending

The dataset includes orders from 6 product categories:

  • Electronics - Laptop Pro 15”, Wireless Mouse, 4K Monitor, USB-C Hub, Mechanical Keyboard
  • Clothing - Winter Jacket, Running Shoes, Denim Jeans
  • Books - TypeScript Guide, Design Patterns, Clean Code
  • Home & Garden - Coffee Maker, LED Lamp, Plant Pot
  • Sports - Yoga Mat, Dumbbells Set, Water Bottle
  • Toys - Building Blocks, Board Game

The mock dataset contains 20 orders spanning from January to October 2024:

#DateCustomerCategoryProductAmountStatus
12024-01-15Alice JohnsonElectronicsLaptop Pro 15”$1,299.99completed
22024-01-18Bob SmithClothingWinter Jacket$89.99completed
32024-02-03Charlie BrownBooksTypeScript Guide$34.99completed
42024-02-14Diana PrinceElectronicsWireless Mouse$29.99shipped
52024-03-05Ethan HuntHome & GardenCoffee Maker$79.99completed
62024-03-22Fiona GreenSportsYoga Mat$24.99completed
72024-04-10George WilsonToysBuilding Blocks$49.99completed
82024-04-25Hannah MooreElectronics4K Monitor$349.99shipped
92024-05-08Ian TaylorClothingRunning Shoes$119.99completed
102024-05-30Julia RobertsBooksDesign Patterns$44.99completed
112024-06-12Alice JohnsonElectronicsUSB-C Hub$39.99processing
122024-06-28Bob SmithHome & GardenLED Lamp$19.99shipped
132024-07-05Charlie BrownSportsDumbbells Set$89.99completed
142024-07-19Diana PrinceToysBoard Game$34.99completed
152024-08-02Ethan HuntElectronicsMechanical Keyboard$159.99processing
162024-08-16Fiona GreenClothingDenim Jeans$59.99shipped
172024-09-01George WilsonBooksClean Code$39.99completed
182024-09-14Hannah MooreHome & GardenPlant Pot$14.99pending
192024-10-03Ian TaylorSportsWater Bottle$12.99processing
202024-10-15Julia RobertsElectronicsWireless Mouse$29.99pending

Total Revenue: $2,537.87

When you use an aggregate query, the mock system automatically groups and aggregates the data.

Query:

{
"type": "aggregate",
"measures": [{ "column": "orders.total_amount", "type": "sum" }],
"dimensions": [{ "column": "orders.product_category", "type": "categorical" }]
}

Result: 6 rows (automatically aggregated and sorted by revenue):

product_categorytotal_amount
Electronics$1,819.96
Clothing$269.97
Books$119.97
Home & Garden$114.97
Sports$127.97
Toys$84.98

Time dimensions support multiple granularities:

Query:

{
"type": "aggregate",
"measures": [{ "column": "orders.total_amount", "type": "sum" }],
"dimensions": [
{
"column": "orders.order_date",
"type": "time",
"granularity": "month"
}
]
}

Result: 10 rows (one per month):

order_datetotal_amount
2024-01$1,389.98
2024-02$64.98
2024-03$104.98
2024-04$399.98
2024-05$164.98
2024-06$59.98
2024-07$124.98
2024-08$219.98
2024-09$39.99
2024-10$42.98
  • day - Group by individual days (2024-01-15, 2024-01-18, …)
  • week - Group by week within month (2024-01-W3, 2024-02-W1, …)
  • month - Group by month (2024-01, 2024-02, …)
  • quarter - Group by quarter (2024-Q1, 2024-Q2, …)
  • year - Group by year (2024)

Table queries return raw data with optional column filtering and pagination.

Query:

{
"type": "table",
"columns": [
{ "name": "orders.order_id" },
{ "name": "orders.order_date" },
{ "name": "orders.customer_name" },
{ "name": "orders.total_amount" }
],
"limit": 5,
"offset": 0
}

Result: First 5 orders with selected columns only.

The mock system supports all standard aggregation types:

  • sum - Sum of values
  • avg - Average of values
  • count - Count of rows
  • min - Minimum value
  • max - Maximum value
  • count_distinct - Count of unique values
import { ReeflowBarChart } from '@reeflow/react';
<ReeflowBarChart
title="Revenue by Status"
query={{
type: 'aggregate',
measures: [{ column: 'total_amount', type: 'sum' }],
dimensions: [{ column: 'status', type: 'categorical' }],
}}
/>;
import { ReeflowLineChart } from '@reeflow/react';
<ReeflowLineChart
title="Orders Per Month"
query={{
type: 'aggregate',
measures: [{ column: 'order_id', type: 'count' }],
dimensions: [
{
column: 'order_date',
type: 'time',
granularity: 'month',
},
],
}}
/>;
import { ReeflowPieChart } from '@reeflow/react';
<ReeflowPieChart
title="Revenue by Category"
query={{
type: 'aggregate',
measures: [{ column: 'total_amount', type: 'sum' }],
dimensions: [{ column: 'product_category', type: 'categorical' }],
}}
/>;

The mock data system is designed for development and testing purposes. It has the following limitations:

  • Fixed dataset - Always returns the same 20 orders
  • No filtering support - Filters in queries are ignored
  • No joins - Join clauses are ignored
  • Simple sorting - Results are sorted by the first measure in descending order
  • No data persistence - Data cannot be modified

For production use, connect to a real Reeflow workspace using an embed token.

When using the <reeflow-workbook> component in mock mode, a sample workbook is returned with a complete multi-page dashboard structure.

The mock workbook is called “Sample Analytics Dashboard” and includes 2 pages.

Main dashboard overview with key metrics using a 12-column grid layout (24px row height):

ComponentTypePositionSizeDescription
Recent OrdersTable(0, 0)12×8Displays columns: customer_id, total_amount, id
Sales by DateBar Chart(0, 8)12×11Sum of total_amount grouped by order_date

Detailed breakdown with a 12-column grid layout (10px row height):

ComponentTypePositionSizeDescription
All DataTable(0, 0)12×28Full table view with all available columns

The workbook handles pagination, sorting, and rendering of all component types automatically.

import { ReeflowProvider, ReeflowWorkbook } from '@reeflow/react';
<ReeflowProvider mock>
<ReeflowWorkbook workbookId="any-id" />
</ReeflowProvider>;

In mock mode, any workbook ID will return the same sample dashboard. For real workbooks, use a valid embed token and workbook ID from your Reeflow Console.

You can provide your own mock data function when configuring the provider:

import { ReeflowProvider } from '@reeflow/core-sdk';
import type { JSONQLQuery, QueryResult } from '@reeflow/core-sdk';
async function myMockData(query: JSONQLQuery): Promise<QueryResult> {
// Your custom logic here
return {
rows: [...],
columns: [...],
row_count: 0,
execution_time_ms: 0,
};
}
const provider = new ReeflowProvider({
authToken: 'token',
mockData: myMockData
});

See the Provider documentation for more details on custom mock data.