The Chart block has two editors. Most charts are built with the point-and-click chart builder. This page covers the second editor, Plotly JSON, where you write the chart definition by hand as a Plotly figure spec.

Writing JSON takes more effort, but it unlocks the full power of the Plotly charting library: dual axis charts, combined bar and line charts, scatter plots, heatmaps, candlesticks, custom colors, annotations, and everything else Plotly can draw. If the visual builder cannot express the chart you have in mind, this editor can.

The Plotly JSON editor open in a Chart block, showing a JSON spec in the text area with Render Chart and Format JSON buttons below it

Which editor should I use?

Chart builderPlotly JSON
How you workPoint and click, live previewWrite a JSON spec by hand
Chart typesBar, line, area, donut, bar list, tableEvery Plotly trace type
Dual axis, combined bar + lineNot supportedSupported
Custom styling and annotationsLimited to the built-in optionsFull control
Best forStandard charts, fast setupAdvanced or heavily customized charts

Both editors read from the same SQL sources, render the same server-side PNG when a report runs, and deliver to email and Slack the same way. You are choosing an editor, not a different feature.


Open the Plotly JSON editor

There are three ways to get a chart block into the Plotly JSON editor:

1
Switch an existing block. In any chart builder block, click Switch to Plotly JSON in the toolbar and confirm. The block keeps its source query and opens with a small starter spec you can edit.
2
Make it your workspace default. A workspace admin can set Default Chart Engine to Plotly JSON (advanced) in Account Settings. From then on, every new chart block in the workspace opens directly in the JSON editor. See the Chart block page for details.
3
Already there. Chart blocks created before the visual builder existed are Plotly JSON blocks. They keep working unchanged, and nothing migrates automatically.

Write the spec

A Plotly JSON spec has two parts: data (a list of traces, one per series) and layout (titles, axes, legend, styling). Instead of pasting data into the spec, you reference columns from your source query with src fields. The chart pulls fresh values from the query every time it renders.

Pick your query in the Source dropdown, write the spec, and click Render Chart to see the result. Format JSON pretty-prints the spec, and the editor shows an inline error if the JSON does not parse.

A minimal bar chart looks like this:

{
  "data": [
    { "xsrc": "month", "ysrc": "revenue", "type": "bar", "name": "Revenue" }
  ],
  "layout": {
    "title": "Monthly Revenue"
  }
}

Here xsrc and ysrc point at the month and revenue columns of the source query.

Column references

Any trace field that normally takes an array of values accepts a src variant that names a source column instead:

ReferenceFillsTypical use
xsrc / ysrcx / yBar, line, scatter, area
labelssrc / valuessrclabels / valuesPie and donut
textsrc / hovertextsrctext / hovertextPoint labels and tooltips
opensrc, highsrc, lowsrc, closesrcOHLC fieldsCandlestick charts
marker.colorsrc / marker.sizesrcmarker.color / marker.sizeColor or size points by a column

Other src fields (zsrc, latsrc, lonsrc, parentssrc, idssrc, rsrc, thetasrc, locationssrc) work the same way. For everything the spec can contain, see the Plotly figure reference.

Example: dual axis with bar and line

This is the kind of chart that needs the JSON editor. Revenue as bars on the left axis, conversion rate as a line on a second axis on the right:

{
  "data": [
    {
      "xsrc": "month",
      "ysrc": "revenue",
      "type": "bar",
      "name": "Revenue"
    },
    {
      "xsrc": "month",
      "ysrc": "conversion_rate",
      "type": "scatter",
      "mode": "lines+markers",
      "name": "Conversion %",
      "yaxis": "y2"
    }
  ],
  "layout": {
    "title": "Revenue vs. Conversion",
    "yaxis": { "title": "Revenue" },
    "yaxis2": { "title": "Conversion %", "overlaying": "y", "side": "right" }
  }
}
A rendered combined chart with revenue bars on the left axis and a conversion rate line on a second axis on the right

Preview and export

Once a chart is rendered, the block shows the interactive Plotly chart. Use Edit in the toolbar to go back to the JSON, and Preview to return to the chart. Export PNG downloads the current chart on demand.

When a report runs, the block renders a PNG on the server from the latest query results, exactly like a builder chart. Reference it from an Email or Slack block with:

{{ chart_1.export() }}

Attachments, inline embedding with export(embed=True), and file uploads all work the same as for builder charts. See the Chart block page for the full delivery options.


Switching back to the builder

Click Switch to new chart builder in the toolbar to move the block to the visual builder. The source selection is kept, the JSON spec is discarded, and a confirmation dialog explains this before anything changes.

⚠️
Switching discards the chart configuration. The two formats cannot be converted into each other, so switching in either direction keeps only your source selection. If you have a heavily tuned spec, copy the JSON somewhere safe before switching.