Skip to content
Draft
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
46 changes: 20 additions & 26 deletions src/documentation/visualizations/about_rendering.malloynb
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
>>>markdown
# Rendering Documentation
The latest and most up to date documentation for the Malloy renderer are now found in GitHub:
# Rendering Results

- [Renderer Tag Documentation](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/renderer_tags_overview.md)
- [Renderer Tag Cheatsheet](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/renderer_tag_cheatsheet.md)
Malloy's rendering library interprets tags to control how query results are displayed.

For developers wishing to implement custom renderers, a plugin system is available:
- [Plugin System Overview](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-system.md)
- [Plugin Quick Start](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-quick-start.md)
- [Plugin API Reference](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-api-reference.md)
>>>markdown
# Using Render Tags
## Documentation

- [Renderer Tags](renderer_tags.malloynb) - Complete guide to all visualization and formatting tags
- [Tag Cheatsheet](renderer_cheatsheet.malloynb) - Quick reference for all tags

## Plugin System

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.
- [Custom Plugins](plugins.malloynb) - Build your own renderers for specialized visualizations

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.
---

Malloy's rendering library interprets these tags to change how results are rendered.
## How Tags Work

## Tagging individual elements
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.
When Malloy runs a query, it returns results and metadata including schema and tags. Tags start with `#` and attach to the following item.

For details on tag syntax, see [Tags](../language/tags.malloynb).
>>>malloy
source: flights is duckdb.table('../data/flights.parquet') extend {
measure:
Expand All @@ -31,23 +30,18 @@ source: flights is duckdb.table('../data/flights.parquet') extend {
#(docs) size=small limit=5000
run: flights -> {
group_by: carrier
aggregate:
flight_count
aggregate:
flight_count
percent_of_flights
}
>>>malloy
#(docs) size=small limit=5000
run: duckdb.table('../data/flights.parquet') -> {
group_by: carrier
aggregate: flight_count is count()
}
>>>markdown

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.
## Quick Examples
>>>malloy
#(docs) size=large limit=5000
# bar_chart
run: duckdb.table('../data/flights.parquet') -> {
run: duckdb.table('../data/flights.parquet') -> {
group_by: carrier
aggregate: flight_count is count()
}
limit: 10
}
46 changes: 46 additions & 0 deletions src/documentation/visualizations/plugins.malloynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
>>>markdown
# Custom Renderer Plugins

The Malloy Render plugin system lets you create custom visualizations for specific field types or data patterns.

## Use Cases

- Custom chart types not included in the standard renderer
- Domain-specific visualizations (maps, diagrams, etc.)
- Branded or styled components
- Interactive visualizations with custom behavior

## Getting Started

Plugins can be built using SolidJS (recommended) or direct DOM manipulation. They match fields based on tags and field types.

```typescript
const MyPluginFactory: RenderPluginFactory = {
name: 'my_plugin',

matches: (field, fieldTag, fieldType) => fieldTag.has('my_plugin'),

create: (field) => ({
name: 'my_plugin',
field,
renderMode: 'solidjs',
sizingStrategy: 'fixed',
renderComponent: (props) => <div>{props.dataColumn.value}</div>,
getMetadata: () => ({ type: 'my_plugin' })
})
};
```

Then tag fields in Malloy to use your plugin:

```malloy
source: data extend {
dimension: status # my_plugin
}
```

## Documentation

- [Plugin System Overview](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-system.md) - Architecture and concepts
- [Plugin Quick Start](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-quick-start.md) - Minimal examples
- [Plugin API Reference](https://github.com/malloydata/malloy/blob/main/packages/malloy-render/docs/plugin-api-reference.md) - Complete type definitions
Loading