Skip to content
Docs

Workflows

Send graph

Show the person a chart – such as their spending by month – drawn from data in the chat.

Send graph draws a chart in the chat from rows of data – usually from an earlier SQL Query or Send API, such as a person’s spending by month.

Important: Send graph is only on the Enterprise plan.

Settings

The Send graph panel, with Graph type, Chart data input and the styling options

SettingWhat it does
Graph typeBar, Grouped Bar, Stacked Bar, Line, Multi-Line, Pie or Combo – bars and a line together.
Chart data inputThe rows to draw – a variable, such as query_results, or the rows themselves. See Data.
Graph title, X-axis label, Y-axis labelOptional. They can include variables.
Color schemeOne colour – Blue, Green, Grey, Orange, Rose, Violet or Yellow – or a mix – Neutral, Distinct, Vivid or Mild.
Show grid linesOn unless you turn it off. Not for Pie.
Show legendOn unless you turn it off. Not for Bar or Line.

Combo has Line data and Bar data instead of Chart data input, each with its own rows and Y-axis label.

Data

Each row has an x – the label, as text – and a y – the number:

[
  {"x": "Jan", "y": 420},
  {"x": "Feb", "y": 380},
  {"x": "Mar", "y": 510}
]

Grouped Bar, Stacked Bar and Multi-Line draw several series, so each row also has a series:

[
  {"x": "Jan", "y": 420, "series": "Groceries"},
  {"x": "Jan", "y": 150, "series": "Travel"},
  {"x": "Feb", "y": 380, "series": "Groceries"},
  {"x": "Feb", "y": 90, "series": "Travel"}
]

The data is an expression, so rows can use variables, such as {"x": "This month", "y": total}.

From a database, name your columns x, y and series, and make x text:

SELECT TO_CHAR(paid_at, 'Mon') AS x, SUM(amount) AS y
FROM payments WHERE account_id = $1
GROUP BY 1 ORDER BY MIN(paid_at)
Graph typeRules
Bar, Line, PieNo series, and each x only once. Pie values can’t be negative.
Grouped Bar, Stacked Bar, Multi-LineEvery row needs a series, and each x only once in each series.

What happens

The person gets the chart in the chat, then the workflow carries on. Your team sees it in the Inbox too.

Important: put Send graph in a Branch that checks there are rows, such as query_results. A chart with no rows stops the workflow.

Good to know

  • Charts show in Webchat. Other channels don’t show them.
  • If Chart data input is blank, nothing is sent and the workflow carries on.
  • Data that breaks the rules stops the workflow – including no rows at all, such as a query that found nothing, a variable that isn’t set and a y that isn’t a number.
  • Send graph can’t be added to the Chat closed workflow.

Stuck? Ask Advisor in the Proto dashboard, or contact us.

© Proto