Author a custom visual with AI
The Studio for a custom visual tile has an assistant column that writes and edits the visual's code for you. Use it to start a visual from a description, rework code you already have, or fix something a check has flagged; every change it makes lands in the editor for you to review first. If you are new to custom visuals, start with Custom visuals and the visual library.
Ask the assistant to write the code
- Open the tile's Studio from Edit code. The assistant column sits on the right; it is open by default when you may use it, and the Studio remembers whether you keep it open. While it loads, the column reads Loading assistant.
- Describe what the visual should do: the fields to show, the way it should look, and anything to avoid. The assistant reads the tile before it writes, so it starts from its code, fields and data.
- Read the reply and the steps it took. How each step appears is explained in Building custom visuals with the assistant.
- Review the change in the editor, then choose Apply or press Ctrl+Enter. Apply puts the code on the tile; saving the report shares it.
What the assistant can do
- Read the tile. It can inspect the visual's code and settings, its data roles, the size it renders at, and the fields bound to it, with a profile of their values. It can also list the report's assets, including files the code references that are not uploaded yet.
- Write the code. It can replace the whole source, patch a passage by search and replace, or replace a range of lines, in either source tier, Template or HTML + JS.
- A patch finds its text byte for byte, whitespace included, and expects it exactly as many times as it declares, once by default. When the text is not found the way it expects, nothing changes and the step's card reads No change:. A line range comes from the last read of the file, and a range outside the file is refused.
- Set fields and behaviour. It can declare data roles and bind the tile's fields to them, change the visual's options, and change interactions such as selection and link opening. Options it adds appear as controls in the options panel.
- Options values are plain JSON: no functions, and no colour literals. A colour is stored as a theme token name, such as
accent or chart-3, and the code resolves it, so the visual follows the report's theme. By default, the values it writes merge over the ones already there.
- Check its work. Every write runs the same authoring checks and size caps as hand-written code, and files the code references are attached to the visual automatically. A write that breaks a rule comes back as a refusal with the reason, and nothing changes.
Review before the tile changes
- A write lands in the editor as a change you have not applied; the tile updates only when you choose Apply. See The custom visual Studio for the apply and save flow.
- While a turn runs, the code is locked: the editor is read-only and shows AI is editing - the editor is read-only until the turn finishes. Apply, undo and redo wait until the turn finishes.
- The assistant works from the applied code. With edits in the editor that you have not applied, it shows You have unapplied edits; the AI works from the applied code; apply your edits first if you want it to build on them.
- Code the assistant wrote is tagged as AI-made. In the Studio's version history, a version whose code the assistant wrote carries the Mind origin chip; your own edits read You, and a restored earlier version reads Restored.
Previews the assistant can run
- It can render the visual at one of three sizes: tile, wide or narrow.
- It can draw from three datasets: your live rows (up to 200 for a preview), an empty dataset, or a hostile dataset that swaps values for awkward ones, such as long text, odd numbers, empty values and text that looks like code, to see how the code copes.
- A successful render can be attached to the conversation as a small picture: a JPEG no more than 1024 pixels on its long edge.
- The preview reports how the run went, including a render that failed, stopped, could not start or timed out. The chips and the report on the preview card are explained in Building custom visuals with the assistant.
What the checks look for
- Static rules: forbidden browser calls, addresses outside the sandbox allowlist, missing readiness calls, fixed colours instead of theme tokens, and code that looks like it asks for a password. The rule list is on Sandbox, network and the allowlist.
- Render checks, from the last run of the code: whether anything was painted for the rows it got, whether the content overflows the tile, render errors, and resources the sandbox blocked.
- Numbers on screen must come from the data. A number shown as fixed text that no row and no option supplies is flagged, so you can derive it from the rows or the options instead.
- After a failed preview or a check with errors, the assistant repairs the code and runs again, at most three automatic repair rounds in one turn. It then stops and reports the last error, and a Try to fix again chip is offered.
- Findings come back with errors first.
Limits while it works
- Each step has a short deadline, about 20 seconds; a preview that cannot finish in time reports a timeout.
- One turn can make at most 60 operations on one visual. Past the limit, further operations wait for your next message, and the next turn has a fresh budget.
- A step travels to the Studio tab that holds your tile; with no Studio open on that tile, the assistant cannot reach the code, so open the tile again and ask.
- A preview runs on at most 200 rows, and a field profile keeps up to three sample values per field.
- A check shows up to 40 findings, or up to 200 when a fuller list is asked for; field suggestions return up to 8 by default and up to 40.
- A preview picture is capped at 1024 pixels on its long edge, and one result carries at most three preview pictures.
Start from a chart you already have
When a native chart is converted into a custom visual, the assistant's first turn comes seeded: it receives the chart's configuration, the fields it used, and, when the chart could be captured, a picture of how it renders today. Ask it to improve the visual from there. The conversion itself is described in Convert a chart to a custom visual.
Questions, answered
Who can use the assistant while building a custom visual?
You need the DataPrism Custom Visual Author permission, which also brings Use DataPrism AI, and edit access to the report. Without it the assistant column is not available; ask an administrator to add the permission to your role. See Who can do what in DataPrism.
Do the assistant's changes go straight onto the tile?
No. Every change lands in the editor as an unapplied edit, and the tile changes only when you choose Apply. See The custom visual Studio for the apply and save flow.
Why can I not edit the code while the assistant is working?
A turn is running, so the code is locked: the editor is read-only and shows AI is editing - the editor is read-only until the turn finishes. Apply, undo and redo also wait for the turn to finish. Let it finish, then review what changed.
The banner says the AI works from the applied code. What does that mean?
The assistant reads the code applied to the tile, not edits still sitting in the editor. With unapplied edits you see You have unapplied edits; the AI works from the applied code. Apply your edits first if you want the assistant to build on them.
Can the assistant bind fields and set options for me?
Yes. It can declare the visual's data roles and bind the tile's fields to them, change the visual's options, and change interactions such as selection and link opening. New options it writes are added to the options schema, so they appear as controls in the options panel.
Can the assistant preview the visual on my real data before I apply?
Yes. It can render the visual at tile, wide or narrow size against up to 200 of your live rows, and it can attach a small picture of the render to the conversation.
What is a hostile data preview for?
It replaces your rows with awkward values: long text, odd numbers, empty values and text that looks like code. It shows how the visual copes with messy data that tidy demo rows hide. Ask for a hostile preview when you want to stress the code.
How much of my data does the assistant read?
The tile's code and settings, the fields bound to it, and a profile of those fields that keeps up to three sample values per field. Previews draw at most 200 rows. It works on the tile open in the Studio.
How do I tell which code the assistant wrote?
Assistant code is tagged as AI-made. In the Studio's version history, a version whose code the assistant wrote carries the Mind origin chip; your own edits read You, and a restored earlier version reads Restored.
Does the assistant rewrite the whole file for a small fix?
No. It can work in small strokes: it can replace the whole source, patch one passage by search and replace, or replace a range of lines. Ask for a small change and only that part is written.