read
general

Draw a chart in the conversation. Use it whenever the answer is a shape rather than a number: a trend over time, a compa

Changed on

Draw a chart in the conversation. Use it whenever the answer is a shape rather than a number: a trend over time, a comparison across products or campaigns, a split of a total, a relationship between two measures. Prefer a chart to a markdown table for anything with more than about five rows of numbers, and always pass the figures you actually read from a tool — never invent or round data to make a nicer picture. Pick the kind by the question: line/area for a value over time; bar for magnitude across categories; stacked_bar or stacked_area when the TOTAL is also a real quantity; pie or donut for one whole split into a few parts; scatter for two measures against each other; combo for one measure as bars with another as a line. There is no dual-axis chart on purpose — two measures of very different scale go in two charts. ALWAYS set unit (and currency when it is money): a currency drawn as a bare number is a figure the merchant will read as the wrong thing. ALWAYS set source with the tool you read, the window, and the row count, so the merchant can trace the number back. At most 6 series; if you have more, chart the ones that matter and say so. Write a one-line answer in prose as well — the chart supports the sentence, it does not replace it.

post/api/v1/tools/render_chart

Request

  • Base URL
    https://app.magistry.io
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization codehttps://app.magistry.io/api/oauth/authorize
      Token URLhttps://app.magistry.io/api/oauth/token
      Scopesread

Request body

object required
kind, 'line' | 'bar' | 'area' | 'stacked_bar' | 'stacked_area' | 'pie' | 'donut' | 'scatter' | 'combo' required

Chosen by the question the data answers, not by preference.

data, object[] required

The rows, each an object. Every yKey must be a NUMBER in every row it appears in; use null for a genuinely missing point rather than 0, which is a measurement.

xKey, string required

The field on the x axis (or the slice name for pie/donut).

yKeys, string[] required

The measures to plot. Six at most — the series palette has six slots and is never reused.

labels, object

Display names keyed by raw field name, e.g. {"rev":"Revenue","d":"Day"}.

title, string

What the chart shows, as a short noun phrase.

subtitle, string

The window, the filter, or the caveat. One line.

unit, 'number' | 'currency' | 'percent' | 'duration_s' | 'compact'

How to format values. Percentages are whole numbers (12.5 means 12.5%), not fractions.

currency, string

ISO 4217, when unit is currency. e.g. EUR, GBP, USD.

barKeys, string[]

combo only: which series are bars.

lineKeys, string[]

combo only: which series are the line.

reference, object

An optional marked rule: a target, a break-even, last period's average.

source, object

Where these numbers came from. Set it whenever the data came from a tool — it is what lets the merchant trace a figure back to the question that produced it.

Response

Tool result

object required
ok, boolean required
result, unknown required

Changes

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    11 more changes in this revision