Visualizations
A visualization belongs to a query and draws its rows. One query can have many, and they all show the same data — so fixing the SQL fixes every one of them.
Choosing one
| You want to show | Use |
|---|---|
| Rows, as rows | Table — with per-column formatting, colouring and data bars |
| Something over time | Line, area, or a stat with a sparkline |
| Categories compared | Bar or column; horizontal bars when the labels are long |
| One number that matters | Counter, or Gauge when there is a target or a healthy range |
| Parts of a whole | Pie for a handful of slices; a stacked bar for more |
| Progress toward a target | Progress bar, bullet bar, or Gauge |
| Status across many things | Status grid — one tile per row, coloured by a column |
| Two numbers related | Scatter, or a bubble chart with a third for size |
| Where something is | Map (markers), or Choropleth for regions |
| Flow between stages | Sankey, or Funnel for a conversion sequence |
| Distribution | Histogram or box plot |
Turning a point or a cell into a link
This is the drill-down: click a bar, land on the query, dashboard or system that explains it. It is configured per visualization, and the important part is that the link is built from the row — so one setting makes every point link somewhere different.
On a chart
Open the visualization editor and go to General. Tick Enable click events — until you do, the two settings under it stay greyed out and clicking a point does nothing:
- Enable click events
- Makes the points clickable. Nothing below works without it.
- Open in new tab
- Usually what you want from a dashboard somebody is watching.
- URL template
- A URL with placeholders filled in from the point that was clicked, for example
/dashboards/12?p_region={{ @@x }}. The braces are part of it.
The placeholders are:
{{ @@x }}and{{ @@y }}— the point you clicked;{{ @@name }}— the name of the series it belongs to;{{ @@x1 }},{{ @@y1 }},{{ @@x2 }},{{ @@y2 }}… — every series at that same position, numbered in the order they appear under Series. Use these when the link needs the whole row rather than the one line under the pointer.
Values go in raw, not formatted: a tooltip may read 1.2k, but the URL gets
1200, because the other end has to be able to look it up. A placeholder that matches
nothing is replaced with an empty string rather than left in the URL.
A worked example. A column chart of revenue by region, where clicking a column opens a dashboard filtered to that region:
Enable click events: yes
Open in new tab: yes
URL template: /dashboards/7-regional-detail?p_region={{ @@x }}
Because {{ @@x }} is filled in per point, the North column links to North's dashboard
and the South column to South's. There is no per-point configuration.
Charts have no link text setting — the whole point is clickable, and there is no label to write. Per-cell link text is a table thing, below.
On a table
A table column can be a link instead of text. In the visualization editor choose the column, set its Display as to Link, and fill in:
- URL template —
https://tickets.internal/{{ id }}, whereidis any column in the row, named exactly as it appears in the result; - Text template — what the cell shows, for example
#{{ id }}. Leave it empty and the cell shows the URL; - Title template — the hover text;
- Open in new tab.
Note the difference from a chart: a table's placeholders are column names, with no
@@ in front of them. That prefix belongs to charts, where there are no column names to
use. {{ @ }} is the one shorthand here — the value of the column being displayed.
Any column of the row can be used, not only the one being displayed. A common shape is to select an
id you never show, and use it to build links in the column you do.
If the link does not appear
- The placeholder has to match exactly, including case: a column name on a table,
@@xand friends on a chart. - On a chart, Enable click events has to be ticked. Without it the URL template is greyed out and clicking does nothing.
- A relative URL (
/dashboards/7) stays inside SQLDesk. An external one needs its scheme —https://— or the browser treats it as relative. - On a table, a URL template that resolves to nothing leaves the cell empty rather than showing a broken link.
Formatting numbers
Every numeric column and most chart values take a format string. It is applied in the browser, so it changes what is shown and never what was fetched.
| Format | 1234567.891 becomes |
|---|---|
0,0 | 1,234,568 |
0,0.00 | 1,234,567.89 |
0.0a | 1.2m |
$0,0.00 | $1,234,567.89 |
0.00% | applied to 0.1234 gives 12.34% |
0[.]00 | decimals only when there are any |
Thousands and decimal separators follow the organization's setting, so the same format string reads correctly for everyone.
Dates and times
Times are stored as the warehouse returned them and displayed in the organization's configured format. If a chart's x axis looks wrong by exactly some number of hours, the column is almost certainly a timestamp without a time zone — the fix belongs in the SQL, where the intent is known.