Skip to content

Recipe: Project Status

Show project distribution by status as a pie or donut chart.

The Result

A donut chart showing how many projects are in each status.

Option 1: Inline Data

markdown
```dg
type: donut
data:
  source: '[
    {"status": "Completed", "count": 5},
    {"status": "In Progress", "count": 8},
    {"status": "Planning", "count": 3},
    {"status": "On Hold", "count": 2}
  ]'
x: status
y: count
title: Project Status
```

Option 2: From CSV

Using the sample data file:

markdown
```dg
type: donut
data:
  file: data/projects.csv
transformations:
  - type: aggregate
    configuration:
      groupBy: ["status"]
      count: ["name"]
x: status
y: name_count
title: Projects by Status
```

Option 3: From Vault Notes

If your projects are notes with frontmatter:

yaml
---
type: project
status: in-progress
priority: high
---
markdown
```dg
type: pie
data:
  query: from:Projects where:type:project
transformations:
  - type: aggregate
    configuration:
      groupBy: ["status"]
      count: ["title"]
x: status
y: title_count
title: Project Status
```

Customizations

Use pie instead of donut:

yaml
type: pie

Show percentages:

yaml
showPercentage: true

Custom colors for statuses:

yaml
scales:
  color:
    domain: ["Completed", "In Progress", "Planning", "On Hold"]
    range: ["#22c55e", "#3b82f6", "#f59e0b", "#ef4444"]

Filter to only high priority:

yaml
transformations:
  - type: filter
    configuration:
      where:
        priority: { eq: "high" }
  - type: aggregate
    ...

Released under the MIT License.