Skip to content

Basic Concepts ​

Understand how DataGlass works so you can create any chart you need.

The Code Block ​

DataGlass reads special code blocks in your notes. Use either dg or data-glass:

markdown
```dg
type: bar
x: category
y: value
```

The content is YAML - a simple format where each line is property: value.

The Four Essential Properties ​

Every chart needs these four things:

PropertyWhat it doesExample
typeThe kind of chartbar, line, scatter, pie
dataWhere the data comes fromfile: sales.csv
xWhat goes on the horizontal axismonth, date, category
yWhat goes on the vertical axisrevenue, count, value

Minimal example:

markdown
```dg
type: bar
data:
  file: data.csv
x: category
y: amount
```

Common Optional Properties ​

PropertyWhat it doesExample
titleChart titletitle: Monthly Revenue
colorGroup data by categorycolor: region
widthChart width in pixelswidth: 800
heightChart height in pixelsheight: 400

Data Sources ​

DataGlass can read data from multiple places:

SourceSyntaxBest for
Inline JSONsource: '[{...}]'Quick demos, small datasets
CSV/JSON filesfile: data/sales.csvYour own data files
URLsurl: https://...APIs, remote data
Vault queriesquery: from:folderData from your notes
Markdown tablesfile: "#Table Heading"Tables in your notes

Learn more: Data Sources

Chart Types ​

DataGlass supports 30+ chart types:

Basic: bar, line, area, scatter, pie, donut

Statistical: boxplot, violin, histogram

Hierarchical: treemap, sunburst, dendrogram

Network: sankey, chord, force-directed

Specialized: heatmap, candlestick, forecast

See all: Chart Gallery

Transformations ​

Filter, aggregate, and sort your data before charting:

markdown
```dg
type: bar
data:
  file: orders.csv
transformations:
  - type: filter
    configuration:
      where:
        status: { eq: "completed" }
  - type: aggregate
    configuration:
      groupBy: ["region"]
      sum: ["amount"]
x: region
y: amount_sum
```

Learn more: Transformations

YAML Tips ​

Indentation matters. Use 2 spaces (not tabs):

yaml
# Correct
data:
  file: sales.csv

# Wrong - will cause errors
data:
file: sales.csv

Quotes are optional for simple values:

yaml
title: Monthly Sales     # works
title: "Monthly Sales"   # also works

Use quotes when values contain special characters:

yaml
title: "Sales: Q1 2024"  # colon needs quotes

Next Steps ​

Released under the MIT License. Built by Boundary Lab.