name: developing-in-lightdash description: Use when reading, creating, and editing Lightdash dashboards and charts as JSON, including dashboard layout and chart-type-specific configuration.
Developing in Lightdash
Use this skill when working with Lightdash dashboards and charts.
What You Can Do
| Task | Tools/Action | References |
|---|---|---|
| Read dashboards and charts | readContent |
dashboard-reference, chart refs |
| Edit dashboards | editContent with RFC6902 JSON Patch |
dashboard-reference |
| Edit charts and tiles | editContent, then update referencing dashboards if needed |
Chart refs, dashboard-reference |
| Create charts | discoverFields, runContentQuery, createContent |
Chart refs |
| Create dashboards | discoverFields, createContent |
dashboard-reference, best practices |
| Add period comparisons | Edit chart metricQuery and config |
period-over-period-reference |
| Verify changed metric queries | runContentQuery with source.type: "metricQuery" |
Chart refs |
Rules:
- Always read content before editing if you have not read it since the last user message.
- Preserve unrelated fields.
- Prefer minimal patches.
- Follow the dashboard or chart shape from the resource instead of inventing structure.
- When you create or edit content, please provide links for them in the final response
Common Mistakes
| Mistake | Consequence | Prevention |
|---|---|---|
| Guessing filter values | Case mismatches like "Payment" vs "payment" can make a chart silently return no data |
Verify exact values before editing filters. Do not guess string filter values |
| Not updating dashboard tiles after renaming a chart | Dashboard tile still shows the old title because tile title and chartName do not auto-update |
If you change a chart's name or purpose, also update dashboard tiles that reference its chartSlug |
Including unused dimensions in metricQuery |
Extra dimensions change grouping and can produce wrong numbers | Every dimension in metricQuery.dimensions must be used by the chart configuration |
| Leaving invalid touched tile positions | Edited tiles overlap, sit outside the 36-column grid, or leave unintended gaps | Validate touched tiles against dashboard-reference grid layout rules after tile actions |
Missing contentType |
Content type becomes ambiguous | Always keep contentType: "chart" or contentType: "dashboard" |
Core Workflows
Edit Dashboards
- Call
readContentand inspect the current JSON shape. - Always read the
dashboard-referenceresource. - Build the smallest possible JSON Patch.
- Call
editContentwith that patch. - Re-read if needed to verify the final state.
Edit Charts and Dashboard Tiles
- Call
readContentfor the chart slug. - Always read the chart reference for chart type (see
Choosing the Right Chart Typebelow). - If you add or change filters, verify exact filter values before patching.
- If you change the chart's name or purpose, also update dashboards that reference that chart.
- Build the smallest possible JSON Patch.
- If you changed the chart's
metricQuery, callrunContentQuerywithsource.type: "metricQuery"and the edited chart'stableName/metricQuery. - Call
editContentwith that patch. - Re-read if needed to verify the final state.
Create Charts
- Use
discoverFieldsto explore available fields and plan your chart. - Always read the chart reference for chart type (see
Choosing the Right Chart Typebelow) to understand required fields and configuration. - Build the full chart JSON with that metric query and other required fields.
- Call
runContentQuerywithsource.type: "metricQuery"and the chart'stableName/metricQuery. - Call
createContentwith the verified chart JSON.
Create Dashboards
- Always read the
dashboard-referenceanddashboard-best-practicesresources. - Explore existing dashboards and charts to find reusable content and inspiration for layout and design.
- Use
discoverFieldsto explore available fields and plan which charts to include. - Create an empty dashboard shell first.
- Start building charts and adding them to the dashboard one by one, using the workflow above for creating charts.
Editing Charts
Dashboard tiles have their own titles. A saved_chart tile's title and chartName are independent overrides and do not automatically change when a chart is renamed. If you change a chart from "Total Revenue" to "Gross Profit", update the dashboard tile too.
{
"tiles": [
{
"properties": {
"chartName": "Gross Profit",
"chartSlug": "total-revenue-kpi",
"title": "Gross Profit"
},
"type": "saved_chart"
}
]
}
Slug Fields
slug is a read-only stable identifier.
Dashboards
spaceSlugis the dashboard's space path. Changing it moves the dashboard to another space.- Dashboard tile
properties.chartSlugreferences an existing reusable or dashboard-owned chart.
Charts
Charts are either reusable space charts or dashboard-owned charts.
- Reusable chart: no
dashboardSlug;spaceSlugis its space path and changing it moves the chart. - Dashboard-owned chart: has
dashboardSlug; bothdashboardSlugandspaceSlugare read-only, andspaceSlugis the owning dashboard's space.
Chart Types
All charts share a common base structure:
{
"chartConfig": {
"config": {},
"type": "<type>"
},
"contentType": "chart",
"dashboardSlug": "my-dashboard",
"metricQuery": {
"dimensions": ["my_explore_category"],
"exploreName": "my_explore",
"filters": {},
"limit": 500,
"metrics": ["my_explore_total_sales"],
"sorts": []
},
"name": "Chart Name",
"slug": "unique-chart-slug",
"spaceSlug": "target-space",
"tableConfig": {
"columnOrder": []
},
"tableName": "my_explore",
"version": 1
}
Spaces can be nested. Use parent/child syntax in spaceSlug for sub-spaces, for example "sales/forecasts". A bare slug like "sales-forecasts" is a flat top-level space; the slash defines the hierarchy.
Choosing the Right Chart Type
| Data Pattern | Recommended Chart | Why |
|---|---|---|
| Trends over time | Line or area (cartesian) |
Shows continuous change with time on the X-axis |
| Category comparisons | Bar (cartesian) |
Easy visual comparison between discrete categories |
| Part-of-whole relationships | pie or treemap |
Shows proportions or composition |
| Single KPI metric | big_number |
Focuses attention on one important value |
| Conversion stages | funnel |
Shows drop-off between sequential stages |
| Progress toward target | gauge |
Shows current value relative to a goal |
| Geographic data | map |
Places values on points or regions |
| Flow between categories | sankey |
Shows how values move from source to target |
| Detailed records | table |
Shows row-level or pivoted data clearly |
| Advanced custom needs | custom |
Full Vega-Lite control |
| Type | Use Case | Resource |
|---|---|---|
cartesian |
Bar, line, area, scatter | cartesian-chart-reference |
pie |
Parts of whole | pie-chart-reference |
table |
Data tables | table-chart-reference |
big_number |
KPIs | big-number-chart-reference |
funnel |
Conversion funnels | funnel-chart-reference |
gauge |
Progress indicators | gauge-chart-reference |
treemap |
Hierarchical composition | treemap-chart-reference |
map |
Geographic data | map-chart-reference |
sankey |
Flow diagrams | sankey-chart-reference |
custom |
Vega-Lite | custom-viz-reference |
For period comparisons, read period-over-period-reference in addition to the chart type reference.
Resources
Charts
cartesian-chart-reference- Bar, line, area, scatterpie-chart-reference- Parts of wholetable-chart-reference- Data tablesbig-number-chart-reference- KPIsfunnel-chart-reference- Conversion funnelsgauge-chart-reference- Progress indicatorstreemap-chart-reference- Hierarchical compositionmap-chart-reference- Geographic datasankey-chart-reference- Flow diagramscustom-viz-reference- Vega-Liteperiod-over-period-reference- PoP comparisonsfield-formatting-reference- Chart-level field formatting overrides for metrics and dimensions
Dashboards
dashboard-reference- Dashboard structure, layout, tabs, tiles, and filtersdashboard-best-practices- Dashboard design guidance