Skip to content

Commit fe949fd

Browse files
committed
feat: update renderer docs
1 parent aded32d commit fe949fd

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
>>>markdown
2+
# Rendering Documentation
3+
The latest and most up to date documentation for the Malloy renderer are now found in GitHub:
4+
5+
- [Renderer Tag Documentation](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/renderer_tags_overview.md)
6+
- [Renderer Tag Cheatsheet](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/renderer_tag_cheatsheet.md)
7+
8+
For developers wishing to implement custom renderers, a plugin system is available:
9+
- [Plugin System Overview](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-system.md)
10+
- [Plugin Quick Start](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-quick-start.md)
11+
- [Plugin API Reference](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-api-reference.md)
12+
>>>markdown
13+
# Using Render Tags
14+
15+
When Malloy runs a query, it returns two things. The *results* of the query and *metadata* about the results. The metadata are the schema for the results, including type information. Malloy also provides a mechanism to tag things in the source code and return tags with this meta data.
16+
17+
In Malloy, anything that can be named can be tagged. A tag starts with a `#`. Tags that start on a new line attach the tag the thing on the following line. For more details about how tagging works, see the [Tags](../language/tags.malloynb) section.
18+
19+
Malloy's rendering library interprets these tags to change how results are rendered.
20+
21+
## Tagging individual elements
22+
In the query below, the measure `percent_of_total` is tagged as a percentage. Any time `percent_of_total` is used in a query, Malloy's rendering library will be displayed as a percentage.
23+
>>>malloy
24+
source: flights is duckdb.table('../data/flights.parquet') extend {
25+
measure:
26+
flight_count is count()
27+
# percent
28+
percent_of_flights is flight_count / all(flight_count)
29+
}
30+
>>>malloy
31+
#(docs) size=small limit=5000
32+
run: flights -> {
33+
group_by: carrier
34+
aggregate:
35+
flight_count
36+
percent_of_flights
37+
}
38+
>>>malloy
39+
#(docs) size=small limit=5000
40+
run: duckdb.table('../data/flights.parquet') -> {
41+
group_by: carrier
42+
aggregate: flight_count is count()
43+
}
44+
>>>markdown
45+
46+
Simply adding `# bar_chart` before the query tags it and tells the rendering library to show the result as a bar chart. See the docs on the [Bar Chart tag](./bar_charts.malloynb) for more information.
47+
>>>malloy
48+
#(docs) size=large limit=5000
49+
# bar_chart
50+
run: duckdb.table('../data/flights.parquet') -> {
51+
group_by: carrier
52+
aggregate: flight_count is count()
53+
}

src/documentation/visualizations/pivots.malloynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Malloy's rederer has flexible and powerful way of pivoting data.
55
## Nesting first
66
Malloy's ability to nest queries allows you to compute two levels of queries simultaneously. The query below first groups airports by `state` and then groups by the type of facility (`fac_type`). For each state we see count of all the facilities.
77
>>>malloy
8+
## renderer_legacy
9+
810
run: duckdb.table('../data/airports.parquet') -> {
911
group_by: state
1012
aggregate: facility_count is count()
@@ -186,3 +188,4 @@ run: flights -> {
186188
}
187189
}
188190
>>>markdown
191+

src/table_of_contents.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@
214214
},
215215
{
216216
"title": "Rendering Results",
217+
"items": [
218+
{
219+
"title": "Overview",
220+
"link": "/visualizations/about_rendering.malloynb"
221+
}
222+
]
223+
},
224+
{
225+
"title": "Rendering Legacy Docs",
217226
"items": [
218227
{
219228
"title": "Overview",

0 commit comments

Comments
 (0)