Back to posts
Part 7 of 7 · Fabric Data Agents in Your Apps
Nov 23, 2026•10 min read

Charts for Agent Answers: From Markdown Table to Visual

Over MCP, a Fabric Data Agent answers in text and markdown tables. If your app wants charts, it has to draw them. Ask for a fixed answer shape, parse it, pick the chart from the table itself, and draw it by the same rules as every other chart in the app.

In the Fabric portal, a data agent can now answer with a chart. Call the same agent from your own app over MCP and you get text and markdown tables. That gap looks like a limitation. It is actually where the app earns its keep.

Your app knows things the agent does not: your chart conventions, your colours, what the user was looking at when they asked, and the charts already on the screen next to the answer. An answer drawn by those rules reads as part of the app. A pasted-in chart with preset styling reads as a guest. This post is the method I used in my Day of Data app: ask for a shape, parse it, choose the chart from the data, and draw it consistently.

  • 5 parts to every answer. Answer, key points, table, chart suggestion, notes. Always in that order, so code knows where to look.
  • 3 chart forms cover most answers. A line for months, diverging bars for gaps, ranked bars for everything else.
  • 1 click back to the table. Every chart keeps the agent's original table one toggle away. Some readers trust rows more than bars.

From Answer to Chart, Step by Step

Here is the whole idea with one real-shaped answer: a question about key accounts against budget, as the agent returns it, and what the app does with it.

What the agent returnedThree of five key accounts are behindbudget; **Public Sector** is furthestbehind at **−8.2%**.- Public Sector is over half the gap.- Atlas Freight is ahead at +3.4%.| Key account | Gap (EUR m) | Gap (%) || --- | ---: | ---: || Public Sector | −104.6 | −8.2 || Orbital Sys. | −29.5 | −7.9 || Harbor Log. | −17.4 | −4.8 || Summit Retail | +5.1 | +1.6 || Atlas Freight | +9.8 | +3.4 || Total | −136.6 | −4.1 |Chart: diverging bar chart of thegap (%) by key account.Notes: real invoices only · completemonths, Jan to Jul.unit ↓Total row: kept in the table, dropped from the chartnegatives in a gap column → diverging barsOver MCP: text and tables only3 of 5 key accounts arebehind budgetGap to budget, Jan to Jul (%)Public Sector−8.2%Orbital Systems−7.9%Harbor Logistics−4.8%Summit Retail+1.6%Atlas Freight+3.4%Source: invoices, real invoices only,complete months Jan to JulChartTable
From answer to chart

The answer arrives as text

Over MCP, a data agent returns markdown: a headline, a few bullets, a table, and a couple of labelled lines. No chart. Because the agent instructions ask for a fixed shape, the app knows where everything is.

The headline becomes the title

The first sentence is the finding. The app counts the rows behind it and writes the chart title as a sentence: 3 of 5 key accounts are behind budget.

The table is found, and its units read

The parser finds the markdown table, takes the first text column as the labels, and reads the unit from each header. That is how it knows Gap (%) is a percentage and Gap (EUR m) is money.

Clean up before drawing

The Total row stays in the table but leaves the chart, because it would flatten every other bar. The gap column has negative values, so the chart is diverging bars, whatever the agent's own Chart line says.

Draw it the app's way

Red below plan, blue above, labels on the bars, the Notes line as the source. And a toggle back to the table, because some readers trust the numbers more than the bars.

1. Ask for a Shape

Nothing downstream works unless every answer has the same structure. That structure belongs in the agent instructions, in the How to answer section, and it is worth being specific:

## How to answer (agent instructions)
Use this template, in this order.
1. Answer: one sentence with the headline number, the period and the unit.
2. Key points: two to four bullets. Key figures in bold.
3. Table: a markdown table of the rows behind the answer.
- First column is the label; then values, with the unit in each header,
e.g. "Net sales (USD)", "Gap (%)".
- Sort it the way the question asks. At most 15 rows; say how many you left out.
- Add a Total row when the rows add up to a meaningful whole.
4. Chart: one line naming the best chart for the table.
5. Notes: one line with the period, filters and definitions you applied.
A single-number question gets the Answer and Notes only.

Each rule exists because of a specific way charts go wrong:

Rule Without it
Unit in every headerCode cannot tell a currency column from a percentage, so axes and labels are wrong
Sort as the question asks"Who is furthest behind" draws as an alphabetical list
At most 15 rowsA 200-bar chart nobody can read, in a drawer that is 400 pixels wide
A Total rowReaders want the total. The chart just has to know to leave it out
Answer first, Notes lastNo title for the chart, and no source line under it

One more benefit: this shape is also better for people reading the answer without a chart. The format that code can parse is the same format a busy manager can scan.

2. Parse It

The parser is about 80 lines of TypeScript. It walks the answer line by line and sorts each line into the five parts: markdown table rows become tables, a line starting with Chart: is the suggestion, Notes: is the source line, bullets are key points, and the first remaining sentence is the headline. Agents often bold the template labels ("**Notes**:"), so it strips that first.

The part that needs care is turning cells into numbers. Agents write numbers for people, not for code:

// "€1,168,869,267" → 1168869267 "−8.2%" → -8.2 "(1,234)" → -1234
export function toNumber(cell: string): number {
let s = cell.replace(/\*\*/g, "").trim();
let neg = false;
if (/^\(.*\)$/.test(s)) { neg = true; s = s.slice(1, -1); } // accounting negatives
s = s.replace(/[\u2212\u2013]/g, "-") // typographic minus signs
.replace(/[€$£\s,%]/g, "") // symbols and separators
.replace(/^\+/, "");
if (!/^-?\d+(\.\d+)?$/.test(s)) return NaN; // not a number: a label column
return neg ? -parseFloat(s) : parseFloat(s);
}

The typographic minus sign is the one that bites. Agents often write −8.2 with a real minus (U+2212), not a hyphen, and a naive parseFloat quietly returns NaN. A column is numeric when at least 80% of its cells parse; the first column that is not numeric becomes the labels.

3. Let the Table Choose the Chart

The agent's Chart: line is a useful hint and a poor command. It is written before the agent sees the shape of its own result, and it varies from run to run. The table, on the other hand, is ground truth. So the app decides from the table and keeps the agent's suggestion as a tie-breaker:

If the table... Draw Because
has month labels in most rowsA line (or columns, for monthly totals)Time reads left to right
has a gap, variance, growth, or change column with negativesDiverging barsBelow and above plan are the story
anything elseRanked horizontal barsLong labels fit, and order is visible

Three forms sound limiting. In practice they covered nearly every answer from a team of three agents, and the restraint is the point: the reader learns three shapes once, and every answer after that reads instantly. Before charting, drop the Total row, and cap the bars at 15 even if the agent sent more.

4. Draw It by the App's Rules

An answer chart should be indistinguishable from the charts the app already draws. These are the rules that mattered most for answers specifically:

The title is a sentence

"3 of 5 key accounts are behind budget", computed from the rows, not "Gap by key account". The agent's headline usually supplies the sentence; counting the rows makes it exact.

Red below plan, blue above

Diverging bars from a zero line, sorted worst first. Red and blue stay distinguishable for colour-blind readers, which red and green do not.

Label the bars, skip the legend

Values sit on the bars, with a sign for gaps. In a narrow answer panel there is no room for a legend, and no need for one.

Notes become the source line

The agent's Notes say what was counted and for which period. Under the chart, that line is what lets a reader trust it.

The full set of eight chart rules is in the Day of Data write-up, and the repo includes a gallery that draws each chart form from real data, offline, as a reference.

5. Know When Not to Chart

Plenty of good answers should not become charts, and the template makes them easy to detect:

  • A single number ("net sales were $9.0bn this year") has no table. Show it as a large figure with the Notes line.
  • A clarifying question comes back as one sentence with options. Render the options as buttons that ask again.
  • A polite refusal that names another agent is a hand-off. Render it as a button that asks that agent.
  • A table that will not parse (two rows, no numeric column, an odd format) falls back to the markdown as written. Never draw a chart you are not sure about.

What About the Agent's Own Charts?

Data agent visualizations went GA at FabCon Europe, so it is fair to ask why an app should draw its own. It depends on where the answer is read:

Agent visuals App-drawn charts
Where they renderIn the Fabric data agent experienceAnywhere your app runs
Over MCP or the SDKNot rendered; the chart specification is in the run stepsBuilt from the text answer
StylingPreset colours, titles, and labelsYour design system and chart rules
Rows chartedUp to 200Whatever you decide; 15 reads best

For people working inside Fabric, the built-in visuals are a real improvement and need no code. For an app, the text answer plus your own drawing is still the better path. If you need the agent's exact choice of chart, the specification in the run steps is an option worth exploring, but the table-first approach keeps working whichever client asks.

Test the Shape Like the Numbers

The format is an interface, so it needs tests like any other interface. After every instruction change, run the parser over the evaluation answers: every multi-row answer must produce a table, every value header must carry a unit, and the Chart and Notes lines must be present. That check slots straight into the agents-as-code pipeline from the previous post, next to the accuracy gate. A correct answer that the app cannot read is still a broken answer.

Further Reading

Tags

Microsoft FabricData AgentsData VisualizationTypeScriptEmbedded Analytics