Create a Smart Chart

Create a Smart Chart

On the previous page, we learned how API-based charts allow you to fetch any dataset from a custom endpoint. But using the finite list of predefined charts (Single, Distribution, Time-based, etc.), you are still constrained by how that data is displayed. With Smart Charts, you can code exactly what data you want and how you want it displayed!

You need a Starter plan or above to create Smart charts

Creating a Smart Chart

To create a chart and access the Smart Chart Editor, click on the Edit Smart Chart button:

Next, use the Template, Component, and Style tabs to create your customized chart. At any point, you can render your chart by clicking on the Run code button.

If you are creating a record-specific smart chart (in the record Analytics tab), the record object is directly accessible (either through this.args.record in the component or @record in the template).

Creating a Table Chart

Our first Smart Chart example will be a simple table: however you may choose to make it as complex and customized as you wish.

Using a trivial set of hardcoded data for example's sake:

To query a custom route of your Forest server as your datasource, you may use this syntax instead:

Creating a Bar Chart

This second example shows how you can achieve any format of charts, as you can benefit from external libraries like D3js.

In the above snippet, notice how we import the D3js library. Of course, you can choose to use any other library of your choice.

This bar chart is inspired by this one.

The resulting chart can be resized to fit your use:

Creating a density map

This last example shows how you can achieve virtually anything, since you are basically coding in a sandbox. There's no limit to what you can do with Smart charts.

In the above snippet, notice how we import the D3js library. Of course, you can choose to use any other library of your choice.

This density map chart is inspired from this one.

The resulting chart can be resized to fit your use:

Creating a Cohort Chart

This is another example to help you build a Cohort Chart.

In the above snippet, notice how we import the D3js library. Of course, you can choose to use any other library of your choice.

The resulting chart can be resized to fit your use:

Last updated

Was this helpful?