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
| Type | Usage | Key Options |
|---|---|---|
bar | Categories | horizontal, stack |
line | Trends | curve, strokeWidth |
scatter | Correlations | r (size), symbol |
area | Volume | stack, curve |
pie | Proportions | - |
donut | Proportions | innerRadius |
heatmap | Matrix | colorScheme |
boxplot | Distribution | - |
violin | Distribution | - |
histogram | Frequency | bins |
sankey | Flows | source, target, value |
treemap | Hierarchy | parent, value |
sunburst | Hierarchy | parent, value |
candlestick | OHLC | open, high, low, close |
forecast | Predictions | scenarios |
Data Sources
Inline JSON:
yaml
data:
source: '[{"x": 1, "y": 2}]'CSV/JSON file:
yaml
data:
file: data/sales.csvURL:
yaml
data:
url: https://api.example.com/data.jsonVault query:
yaml
data:
query: from:Projects where:status:activeMarkdown table:
yaml
data:
file: "#Sales Table"Essential Properties
| Property | Required | Description |
|---|---|---|
type | Yes | Chart type |
data | Yes | Data source |
x | Yes* | X-axis field |
y | Yes* | Y-axis field |
color | No | Color grouping field |
title | No | Chart title |
width | No | Width in pixels (default: 640) |
height | No | Height 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: descLimit:
yaml
transformations:
- type: limit
configuration:
count: 10Derive (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: categoryHorizontal bar:
yaml
type: bar
horizontal: trueMulti-line:
yaml
type: line
color: seriesTop N:
yaml
transformations:
- type: sort
configuration:
by: value
order: desc
- type: limit
configuration:
count: 10Filter then aggregate:
yaml
transformations:
- type: filter
configuration:
where:
year: { eq: 2024 }
- type: aggregate
configuration:
groupBy: ["month"]
sum: ["revenue"]Debugging
- Check YAML syntax - Use spaces, not tabs
- Verify field names - Case-sensitive, must match data
- Test with inline data - Rule out file issues
- Check console - Ctrl+Shift+I in Obsidian