Skip to content

DataGlass Cheat Sheet

Quick reference for all DataGlass features.


Basic Template

yaml
```dg
type: bar
data:
  file: data/mydata.csv
x: category
y: value
title: My Chart
```

Chart Types

TypeUsageKey Options
barCategorieshorizontal, stack
lineTrendscurve, strokeWidth
scatterCorrelationsr (size), symbol
areaVolumestack, curve
pieProportions-
donutProportionsinnerRadius
heatmapMatrixcolorScheme
boxplotDistribution-
violinDistribution-
histogramFrequencybins
sankeyFlowssource, target, value
treemapHierarchyparent, value
sunburstHierarchyparent, value
candlestickOHLCopen, high, low, close
forecastPredictionsscenarios

Data Sources

Inline JSON:

yaml
data:
  source: '[{"x": 1, "y": 2}]'

CSV/JSON file:

yaml
data:
  file: data/sales.csv

URL:

yaml
data:
  url: https://api.example.com/data.json

Vault query:

yaml
data:
  query: from:Projects where:status:active

Markdown table:

yaml
data:
  file: "#Sales Table"

Essential Properties

PropertyRequiredDescription
typeYesChart type
dataYesData source
xYes*X-axis field
yYes*Y-axis field
colorNoColor grouping field
titleNoChart title
widthNoWidth in pixels (default: 640)
heightNoHeight in pixels (default: 400)

*Some chart types have different requirements


Transformations

Filter:

yaml
transformations:
  - type: filter
    configuration:
      where:
        status: { eq: "active" }
        value: { gt: 100 }

Operators: eq, ne, gt, gte, lt, lte, in, contains, between

Aggregate:

yaml
transformations:
  - type: aggregate
    configuration:
      groupBy: ["category"]
      sum: ["value"]
      avg: ["price"]
      count: ["id"]

Functions: sum, avg, min, max, count, first, last

Sort:

yaml
transformations:
  - type: sort
    configuration:
      by: value
      order: desc

Limit:

yaml
transformations:
  - type: limit
    configuration:
      count: 10

Derive (computed columns):

yaml
transformations:
  - type: derive
    configuration:
      profit: "revenue - cost"

Color Schemes

yaml
scales:
  color:
    scheme: "category10"

Categorical: category10, paired, set1, set2, set3, tableau10

Sequential: blues, greens, reds, purples, oranges, greys

Diverging: rdbu, rdylbu, rdylgn, spectral


Axis Configuration

yaml
scales:
  x:
    label: "Month"
    domain: ["Jan", "Feb", "Mar"]
  y:
    label: "Revenue ($)"
    domain: [0, 1000]

Common Patterns

Stacked bar:

yaml
type: bar
stack: true
color: category

Horizontal bar:

yaml
type: bar
horizontal: true

Multi-line:

yaml
type: line
color: series

Top N:

yaml
transformations:
  - type: sort
    configuration:
      by: value
      order: desc
  - type: limit
    configuration:
      count: 10

Filter then aggregate:

yaml
transformations:
  - type: filter
    configuration:
      where:
        year: { eq: 2024 }
  - type: aggregate
    configuration:
      groupBy: ["month"]
      sum: ["revenue"]

Debugging

  1. Check YAML syntax - Use spaces, not tabs
  2. Verify field names - Case-sensitive, must match data
  3. Test with inline data - Rule out file issues
  4. Check console - Ctrl+Shift+I in Obsidian

Released under the MIT License.