This tutorial guides you through creating powerful dashboards with
sphinx-needs. By the end, you’ll be able to visualize your requirements,
specifications, and test coverage using tables, charts, and flow diagrams.
Note
Target audience: Developers familiar with sphinx-needs basics who
want to create visual dashboards for project status monitoring,
traceability visualization, and metrics reporting.
..needtable:: Requirements Status
:filter: type == 'req' and 'dashboard_demo' in tags
:columns: id as "ID"; title as "Requirement"; status as "State"; priority as "Priority"
:style: table
..needpie:: Requirements Status
:labels: Open, In Progress, Done
:legend:
type == 'req' and status == 'open' and 'dashboard_demo' in tags
type == 'req' and status == 'in_progress' and 'dashboard_demo' in tags
type == 'req' and status == 'done' and 'dashboard_demo' in tags
Each line in the content is a filter expression. The count of matching
needs determines the slice size.
..needpie:: Status Distribution
:labels: Open, In Progress, Done
:legend::colors: #ff6b6b, #ffd93d, #6bcb77
type == 'req' and status == 'open' and 'dashboard_demo' in tags
type == 'req' and status == 'in_progress' and 'dashboard_demo' in tags
type == 'req' and status == 'done' and 'dashboard_demo' in tags
Use :explode: to highlight specific slices (0-indexed):
..needpie:: Focus on Open Items
:labels: Open, In Progress, Done
:legend::colors: #ff6b6b, #ffd93d, #6bcb77
:explode: 0
type == 'req' and status == 'open' and 'dashboard_demo' in tags
type == 'req' and status == 'in_progress' and 'dashboard_demo' in tags
type == 'req' and status == 'done' and 'dashboard_demo' in tags
..needpie:: Dark Theme Status
:labels: Open, In Progress, Done
:legend::style: dark_background
type == 'req' and status == 'open' and 'dashboard_demo' in tags
type == 'req' and status == 'in_progress' and 'dashboard_demo' in tags
type == 'req' and status == 'done' and 'dashboard_demo' in tags
..needbar:: Coverage by Type
:legend::xlabels: Requirements, Specifications, Tests
:colors: #6bcb77, #ff6b6b
Done; type=='req' and status=='done'; type=='spec' and status=='done'; type=='test' and status=='done'
Open; type=='req' and status!='done'; type=='spec' and status!='done'; type=='test' and status!='done'
Each row defines a data series. The format is:
Label;filter1;filter2;filter3
..needbar:: Stacked Status
:legend::xlabels: Requirements, Specifications, Tests
:stacked::colors: #6bcb77, #ffd93d, #ff6b6b
Done; type=='req' and status=='done'; type=='spec' and status=='done'; type=='test' and status=='done'
In Progress; type=='req' and status=='in_progress'; type=='spec' and status=='in_progress'; type=='test' and status=='in_progress'
Open; type=='req' and status=='open'; type=='spec' and status=='open'; type=='test' and status=='open'
Display bars horizontally for better label readability:
..needbar:: Horizontal Status
:legend::xlabels: Requirements, Specifications, Tests
:horizontal::colors: #6bcb77, #ff6b6b
Done; type=='req' and status=='done'; type=='spec' and status=='done'; type=='test' and status=='done'
Open; type=='req' and status!='done'; type=='spec' and status!='done'; type=='test' and status!='done'
..needflow:: Monochrome Flow
:filter: 'dashboard_demo' in tags
:config: monochrome
..needflow:: Left to Right Flow
:filter: 'dashboard_demo' in tags
:config: lefttoright
Now let’s combine everything into a comprehensive dashboard page.
Create a file called dashboard.rst:
Project Dashboard=================
This dashboard provides an overview of the project status.
Status Overview---------------..needpie:: Requirements Status
:labels: Open, In Progress, Done
:legend::colors: #ff6b6b, #ffd93d, #6bcb77
type == 'req' and status == 'open'
type == 'req' and status == 'in_progress'
type == 'req' and status == 'done'
Coverage by Type----------------..needbar:: Status by Type
:legend::xlabels: Requirements, Specifications, Tests
:stacked::colors: #6bcb77, #ffd93d, #ff6b6b
Done; type=='req' and status=='done'; type=='spec' and status=='done'; type=='test' and status=='done'
In Progress; type=='req' and status=='in_progress'; type=='spec' and status=='in_progress'; type=='test' and status=='in_progress'
Open; type=='req' and status=='open'; type=='spec' and status=='open'; type=='test' and status=='open'
Requirements List-----------------..needtable:: All Requirements
:filter: type == 'req'
:columns: id as "ID"; title as "Requirement"; status as "Status"; priority as "Priority"
:colwidths: 15, 50, 20, 15
:style: table
Traceability------------..needflow:: Full Traceability
:link_types: tests, links
:show_link_names:
sphinx-needs provides point-in-time dashboards - snapshots of your current
project state. It does not include built-in history or trending capabilities
to answer questions like:
How has test coverage changed over the last month?
What was the status distribution two sprints ago?
Are we closing requirements faster than we’re opening them?
For historical tracking, trend analysis, and time-based comparisons,
ubTrace from useblocks is the recommended solution. ubTrace provides:
Historical data tracking across documentation builds
Trend visualization over time
Easy configuration for project management workflows
Integration with CI/CD pipelines for automatic tracking