{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/dashboard-configuration.schema.json",
"title": "Dashboard Configuration",
"description": "Root object for the dashboard configuration, containing header, body, and footer segments.",
"type": "object",
"required": ["dashboard"],
"properties": {
"dashboard": {
"type": "object",
"description": "The main dashboard container holding all UI sections.",
"required": ["header", "body", "footer"],
"properties": {
"header": {
"description": "Top section of the dashboard, typically used for titles and high-level summaries.",
"$ref": "#/$defs/section"
},
"body": {
"type": "object",
"description": "The primary content area containing graphs, tables, and text sections.",
"properties": {
"graphs": {
"type": "object",
"description": "A dictionary of Plotly-based graph configurations, keyed by their unique Graph ID.",
"additionalProperties": {
"type": "object",
"description": "An individual graph entry including its display heading and plotly logic.",
"required": ["heading", "plotly"],
"properties": {
"heading": {
"type": "string",
"description": "The display title for the graph section."
},
"plotly": {
"description": "The configuration object for the Plotly instance.",
"$ref": "#/$defs/plotlyConfig"
}
}
}
},
"texts": {
"type": "array",
"description": "A collection of free-text or markdown content sections.",
"items": {
"$ref": "#/$defs/textSection"
}
}
}
},
"footer": {
"description": "Bottom section of the dashboard, usually for credits, timestamps, or secondary stats.",
"$ref": "#/$defs/section"
}
}
}
},
"$defs": {
"section": {
"type": "object",
"description": "A generic UI section containing a heading, content, and optional statistics.",
"properties": {
"heading": {
"type": "string",
"description": "The title of the section."
},
"content": {
"type": "string",
"description": "The primary text or body of the section."
},
"stats": {
"type": "array",
"description": "Key-value pairs for displaying quick metrics.",
"items": {
"type": "object",
"description": "A single metric data point.",
"required": ["label", "value"],
"properties": {
"label": {
"type": "string",
"description": "The name or label of the metric."
},
"value": {
"type": "string",
"description": "The value of the metric."
}
}
}
}
}
},
"plotlyConfig": {
"type": "object",
"description": "Configuration for a Plotly graph, including IDs for navigation and plug-and-play data.",
"required": ["data", "layout"],
"properties": {
"fromGraph": {
"type": "string",
"description": "The ID of the parent graph. If filled, this graph displays upon selection from the parent. If not filled, this graph is shown by default."
},
"data": {
"type": "array",
"description": "Array of trace objects passed directly to Plotly. Refer to plotly-angular documentation (https://github.com/plotly/angular-plotly.js) and the Plotly JS reference (https://plotly.com/javascript/reference/) for valid trace attributes.",
"items": {
"type": "object",
"description": "A Plotly trace object - can include any standard Plotly attribute.",
"required": ["customdata"],
"properties": {
"customdata": {
"type": "array",
"description": "A 1-1 mapping array where index [i] matches the coordinates at x[i] and y[i]. This array stores the business logic used for cascading filters.",
"items": {
"type": "object",
"properties": {
"formulaId": {
"type": "string",
"description": "Unique identifier representing the formula (file name)"
},
"filterBy": {
"type": "string",
"description": "The 'Inbound Filter'. The graph renders this coordinate only if this ID matches the filter key sent by a parent graph. This property is optional or not required for the primary/parent graph." },
"emitId": {
"type": "string",
"description": "The 'Outbound Filter'. When this point is clicked, this ID is sent to all graphs listed in the 'toGraph' array to serve as their new filter key."
}
},
"additionalProperties": true
}
}
},
"additionalProperties": true
}
},
"layout": {
"type": "object",
"description": "Plotly layout configuration object. - refer to plotly documentation",
"additionalProperties": true
},
"config": {
"type": "object",
"description": "Plotly configuration options - refer to plotly documentation.",
"additionalProperties": true
},
"frames": {
"type": "array",
"description": "Plotly frames used for animations - refer to plotly documentation",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"allOf": [
{
"description": "Enforce formulaId for primary graphs: If fromGraph is not defined, formulaId must be provided in customdata. This will help us determine which file we need to read and persist in FD",
"if": {
"not": { "required": ["fromGraph"] }
},
"then": {
"properties": {
"data": {
"items": {
"properties": {
"customdata": {
"items": { "required": ["formulaId"] }
}
}
}
}
}
}
},
{
"description": "Enforce filterBy for drill-down graphs: If fromGraph is defined, filterBy must be provided in customdata. So that the child graph can be filtered and the data point shown.",
"if": {
"required": ["fromGraph"]
},
"then": {
"properties": {
"data": {
"items": {
"properties": {
"customdata": {
"items": { "required": ["filterBy"] }
}
}
}
}
}
}
}
]
},
"textSection": {
"type": "object",
"description": "A section containing a heading and a large block of text content.",
"required": ["heading", "content"],
"properties": {
"heading": {
"type": "string",
"description": "The title of the text section."
},
"content": {
"type": "string",
"description": "The body text content."
}
}
}
}
}