Skip to content

Commit c08c2c3

Browse files
authored
Add faq (#197)
1 parent 88baccd commit c08c2c3

3 files changed

Lines changed: 135 additions & 0 deletions

File tree

doc/_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ website:
4848
- text: "`LABEL`"
4949
href: syntax/clause/label.qmd
5050
- examples.qmd
51+
- href: faq.qmd
52+
text: FAQ
5153
tools:
5254
- icon: github
5355
menu:

doc/faq.qmd

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Frequently Asked Questions
3+
---
4+
5+
## Getting Started
6+
7+
::: {.callout-note collapse="true"}
8+
## What is ggsql?
9+
10+
ggsql is a SQL extension for declarative data visualization based on Grammar of Graphics principles. It allows you to combine SQL data queries with visualization specifications in a single, composable syntax.
11+
12+
```ggsql
13+
SELECT date, revenue, region FROM sales
14+
VISUALISE date AS x, revenue AS y, region AS color
15+
DRAW line
16+
```
17+
:::
18+
19+
::: {.callout-note collapse="true"}
20+
## How do I install ggsql?
21+
22+
See the installation instruction in the [Getting started](installation.qmd) tutorial.
23+
:::
24+
25+
::: {.callout-note collapse="true"}
26+
## Can I use ggsql with my existing database?
27+
28+
ggsql is built in a modular way so we can gradually add new backends to it. Currently, ggsql works with DuckDB and SQLite, but we are planning on expanding that soon!
29+
:::
30+
31+
::: {.callout-note collapse="true"}
32+
## Is ggsql just a new frontend for Vegalite
33+
34+
We have designed ggsql to be modular, both when it comes to the database input and the final rendering. For the first phase of the development we have chosen to use Vegalite as a renderer as it has allowed us to iterate quickly, but we do not envision Vegalite to remain the only, nor default writer in the future.
35+
:::
36+
37+
## Syntax & Usage
38+
39+
::: {.callout-note collapse="true"}
40+
## What's the difference between `VISUALISE` and `VISUALIZE`?
41+
42+
Both spellings are supported - use whichever you prefer. The grammar accepts both British (`VISUALISE`) and American (`VISUALIZE`) spellings.
43+
:::
44+
45+
::: {.callout-note collapse="true"}
46+
## How do I create a multi-layer chart?
47+
48+
Add multiple `DRAW` clauses to your query. Each `DRAW` creates a new layer:
49+
50+
```ggsql
51+
SELECT x, y FROM data
52+
VISUALISE x, y
53+
DRAW line MAPPING x AS x, y AS y
54+
DRAW point MAPPING x AS x, y AS y
55+
```
56+
:::
57+
58+
::: {.callout-note collapse="true"}
59+
## How do I set axis labels and a title?
60+
61+
Use the `LABEL` clause:
62+
63+
```ggsql
64+
SELECT date, revenue FROM sales
65+
VISUALISE date AS x, revenue AS y
66+
DRAW line
67+
LABEL title => 'Sales Over Time', x => 'Date', y => 'Revenue (USD)'
68+
```
69+
:::
70+
71+
::: {.callout-note collapse="true"}
72+
## Can I use SQL queries inside the `VISUALISE` clause
73+
74+
Some parts of the syntax are passed on directly to the database, such as the `FILTER` and `ORDER BY` clauses in `DRAW`.
75+
76+
```ggsql
77+
SELECT date, revenue FROM sales
78+
VISUALISE date AS x, revenue AS y
79+
DRAW line
80+
DRAW point
81+
FILTER revenue = max(revenue)
82+
```
83+
84+
Further, any query before the `VISUALISE` clause is passed directly to the database so anything supported by your backend can go in there.
85+
:::
86+
87+
::: {.callout-note collapse="true"}
88+
## What if I'm working with huge datasets
89+
90+
ggsql integrates very deeply with the database backends and handles all statistical transformations as SQL queries. This means that if you need to make a histogram of 1 billion observations, you'll only ever fetch the values of each histogram bin, not the full dataset.
91+
:::
92+
93+
::: {.callout-note collapse="true"}
94+
## Can I make interactive plots
95+
96+
ggsql does not yet support interactive functionality like tool tips and zooming. This is a point of focus for us and we will rather get the syntax and implementation right than rush to it.
97+
:::
98+
99+
## Troubleshooting
100+
101+
::: {.callout-note collapse="true"}
102+
## My dates aren't formatting correctly on the x-axis
103+
104+
Add `SCALE x VIA date` to tell ggsql to treat the x-axis as temporal data:
105+
106+
```ggsql
107+
SELECT date, value FROM data
108+
VISUALISE date AS x, value AS y
109+
DRAW line
110+
SCALE x VIA date
111+
```
112+
:::
113+
114+
::: {.callout-note collapse="true"}
115+
## How do I report a bug or request a feature?
116+
117+
Please open an issue on our [GitHub repository](https://github.com/posit-dev/ggsql/issues).
118+
:::

doc/styles.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,18 @@ code {
419419
}
420420
}
421421
}
422+
423+
// FAQ callouts with brand teal colors
424+
.callout.callout-style-default.callout-note {
425+
border-color: var(--brand-paleteal, #DEF1EB);
426+
border-left-color: var(--brand-teal, #0A9396);
427+
428+
.callout-icon {
429+
// Transform icon to brand-teal (#0A9396)
430+
filter: brightness(0) saturate(100%) invert(33%) sepia(92%) saturate(458%) hue-rotate(152deg) brightness(93%) contrast(89%);
431+
}
432+
433+
.callout-header {
434+
background-color: var(--brand-paleteal, #DEF1EB);
435+
}
436+
}

0 commit comments

Comments
 (0)