Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ DRAW line
SCALE x VIA date
SCALE y FROM [0, 100000]
LABEL title => 'Sales by Region', x => 'Date', y => 'Revenue'
THEME minimal
```

**Statistics**:
Expand Down Expand Up @@ -257,7 +256,7 @@ For detailed API documentation, see [`src/doc/API.md`](src/doc/API.md).

- Uses `tree-sitter-ggsql` grammar (507 lines, simplified approach)
- Parses **full query** (SQL + VISUALISE) into concrete syntax tree (CST)
- Grammar supports: PLOT/TABLE/MAP types, DRAW/SCALE/FACET/PROJECT/LABEL/THEME clauses
- Grammar supports: PLOT/TABLE/MAP types, DRAW/SCALE/FACET/PROJECT/LABEL clauses
- British and American spellings: `VISUALISE` / `VISUALIZE`
- **SQL portion parsing**: Basic SQL structure (SELECT, WITH, CREATE, INSERT, subqueries)
- **Recursive subquery support**: Fully recursive grammar for complex SQL
Expand Down Expand Up @@ -305,7 +304,6 @@ pub struct Plot {
pub facet: Option<Facet>, // FACET clause
pub project: Option<Project>, // PROJECT clause
pub labels: Option<Labels>, // LABEL clause
pub theme: Option<Theme>, // THEME clause
}

/// Global mapping specification from VISUALISE clause
Expand Down Expand Up @@ -1182,7 +1180,6 @@ Where `<global_mapping>` can be:
| `FACET` | ❌ No | Small multiples | `FACET region` |
| `PROJECT` | ❌ No | Coordinate system | `PROJECT TO cartesian` |
| `LABEL` | ❌ No | Text labels | `LABEL title => 'My Chart', x => 'Date'` |
| `THEME` | ❌ No | Visual styling | `THEME minimal` |

### DRAW Clause (Layers)

Expand Down Expand Up @@ -1539,23 +1536,6 @@ LABEL
caption => 'Data from Q4 2024'
```

### THEME Clause

**Syntax**:

```sql
THEME <name> [SETTING <overrides>]
```

**Base Themes**: `minimal`, `classic`, `gray`, `bw`, `dark`, `void`

**Example**:

```sql
THEME minimal
THEME dark SETTING background => '#1a1a1a'
```

---

## Complete Example Walkthrough
Expand All @@ -1576,7 +1556,6 @@ DRAW point
SCALE x VIA date
FACET region
LABEL title => 'Sales Trends by Region', x => 'Date', y => 'Total Quantity'
THEME minimal
```

### Execution Flow
Expand Down Expand Up @@ -1616,8 +1595,7 @@ Plot {
Scale { aesthetic: "x", scale_type: Some(ScaleType::Date) }
],
facet: Some(Facet::Wrap { variables: ["region"], scales: "fixed" }),
labels: Some(Labels { labels: {"title": "...", "x": "Date", "y": "Total Quantity"} }),
theme: Some(Theme::Minimal)
labels: Some(Labels { labels: {"title": "...", "x": "Date", "y": "Total Quantity"} })
}
```

Expand Down
30 changes: 4 additions & 26 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document provides a collection of basic examples demonstrating how to use g
- [Multiple Layers](#multiple-layers)
- [Scales and Transformations](#scales-and-transformations)
- [Projections](#projections)
- [Labels and Themes](#labels-and-themes)
- [Labels](#labels)
- [Faceting](#faceting)
- [Common Table Expressions (CTEs)](#common-table-expressions-ctes)
- [Advanced Examples](#advanced-examples)
Expand Down Expand Up @@ -168,7 +168,7 @@ PROJECT y, x TO polar SETTING start => 90

---

## Labels and Themes
## Labels

### Chart with Title and Axis Labels

Expand All @@ -194,24 +194,6 @@ LABEL title => 'Performance Metrics',
caption => 'Data source: Analytics DB'
```

### Themed Visualization

```sql
SELECT category, value FROM data
VISUALISE category AS x, value AS y
DRAW bar
THEME minimal
```

### Theme with Custom Properties

```sql
SELECT x, y FROM data
VISUALISE x, y
DRAW point
THEME dark SETTING background => '#1a1a1a'
```

---

## Faceting
Expand Down Expand Up @@ -455,7 +437,6 @@ FACET region
LABEL title => 'Sales Trends by Region',
x => 'Date',
y => 'Total Quantity'
THEME minimal
```

### Time Series with Multiple Aesthetics
Expand Down Expand Up @@ -495,7 +476,6 @@ SCALE fill TO ['red', 'orange', 'yellow', 'green', 'blue',
LABEL title => 'Top 10 Products by Revenue',
x => 'Product',
y => 'Revenue ($)'
THEME classic
```

### Distribution with Custom range
Expand Down Expand Up @@ -639,11 +619,9 @@ Draw Line

6. **Multiple Layers**: Combine layers (e.g., line + point) for richer visualizations.

7. **Themes**: Apply themes last in your specification for consistent styling.

8. **Labels**: Always provide meaningful titles and axis labels for clarity.
7. **Labels**: Always provide meaningful titles and axis labels for clarity.

9. **Range Specification**: Use SCALE for all axis limits and aesthetic domain specifications.
8. **Range Specification**: Use SCALE for all axis limits and aesthetic domain specifications.

---

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ WHERE year = 2024
VISUALISE date AS x, revenue AS y, region AS color
DRAW line
LABEL title => 'Sales by Region'
THEME minimal
```

## Project Status
Expand All @@ -37,7 +36,7 @@ THEME minimal
- 📋 Additional readers
- 📋 Additional writers
- 📋 More geom types and statistical transformations
- 📋 Enhanced theme system
- 📋 More geom types

## Architecture

Expand Down Expand Up @@ -219,7 +218,7 @@ Key grammar elements:
- `SCALE <aesthetic> SETTING` - Configure data-to-visual mappings
- `FACET` - Create small multiples (WRAP for flowing layout, BY for grid)
- `PROJECT` - Coordinate transformations (cartesian, flip, polar)
- `LABEL`, `THEME` - Styling and annotation
- `LABEL` - Text labels and annotation

## Jupyter Kernel

Expand Down
Loading
Loading