Skip to main content
The no-code chart types (Single, Distribution, Time-based, Cohort, Leaderboard, Objective) cover most needs. When you want full control over how data is displayed, custom visualizations, external libraries, complex layouts, use Smart Charts. With Smart Charts you write the data source on the back-end and the rendering component in the UI editor. There’s no limit to what you can render: D3.js, custom SVG, embedded iframes, anything you can write in JavaScript.

Creating a Smart Chart

From any dashboard or record analytics tab, click Edit Smart Chart to open the editor.
Edit Smart Chart button

Open the Smart Chart editor

The editor exposes three tabs:
  • Template, the Handlebars template that renders your chart
  • Component, the JavaScript component that loads data and orchestrates rendering
  • Style, optional CSS scoped to this chart
Click Run code at any time to preview the chart. When you’re done, click Create Chart (or Save if already created).
Smart Chart editor with code tabs

The Smart Chart code editor with Template, Component, and Style tabs

When creating a Smart Chart on a specific record (record’s Analytics tab), the record object is directly accessible via this.args.record in the component or @record in the template.

Defining the data source on the back-end

A Smart Chart pulls its data from a custom endpoint you expose on the back-end with addChart. The handler returns any shape your component expects.
The component then fetches /forest/_charts/mytablechart and passes the data to the template.

Passing extra parameters

The chart handler’s context exposes any custom query-string or body parameters sent to the chart endpoint via context.parameters, alongside context.caller (the current user). Use them to make a chart depend on a filter, a date range, or the current record:
For collection charts, context also exposes context.recordId, context.compositeRecordId, and context.getRecord(fields).

Example: table chart

A minimal table chart in three steps: back-end endpoint, component fetch, template.
Smart Chart rendered as a table

A custom table Smart Chart

Component:
Template:

Example: bar chart with D3.js

Smart Charts can load any external library. This bar chart uses D3.js, inspired by this example.
Smart Chart rendered as a D3 bar chart

A custom bar chart rendered with D3.js

Back-end:
Component (excerpt):
Template:

Example: cohort retention chart

A retention table with shaded cells, also using D3.js.
Cohort retention chart with shaded cells

A cohort retention Smart Chart

The back-end returns the cohort matrix; the component computes percentages and renders shaded cells; the template wraps the result.

Example: density map

A geographic density map, fetching contour data and population statistics, rendering with D3 + topojson.
US density map showing population concentrations

A density map Smart Chart

The component loads D3, topojson, then renders the SVG. See this Observable notebook for the rendering logic.