Add charts and structured content

How to get the best chart, table, and structured visual results from the Gamma API.

The Gamma API can generate charts, tables, and infographics as part of your output. Generation is non-deterministic — results may vary across runs, even with identical inputs. There are no API parameters to directly control chart type, styling, or data formatting, but you can steer the output through your prompts.

Quick reference

  • Charts are prompted through inputText and additionalInstructions, not through dedicated API parameters.

  • Provide explicit data values and chart type for best results.

  • Use the Create from Template API for consistent chart layouts across repeated generations.

  • Output varies between runs -- test a few generations to calibrate your prompts.

How to prompt for charts

You influence chart output through inputText and additionalInstructions. The more specific you are, the better the results.

{
  "inputText": "Revenue data for 2024",
  "additionalInstructions": "Include a chart"
}

Tips for better results

  • Specify the chart type. "Bar chart comparing X and Y" produces more predictable output than "include a chart."

  • Provide structured data. Explicit values (tables, bullet points with numbers) give the AI clear data to work with.

  • Use additionalInstructions to reinforce preferences: "Use bar charts for comparisons, pie charts for proportions."

  • Keep data labels unambiguous. Labels that resemble numeric values (e.g. $100 as a category name) may be interpreted as data.

  • Test a few runs. Since output varies, run a few generations to see the range and refine your prompts accordingly.

Using templates for more consistent output

If you need predictable chart layouts, the Create from Template API is a better fit. Design a gamma in the app with the exact chart types and layouts you want, then use the API to generate new content into that structure.

Tables and infographics

The same prompting principles apply:

  • Provide structured data (rows, columns, key-value pairs) in your input for best table results

  • Infographics such as timelines and process flows can be prompted for, but the AI determines the final layout

  • Your theme controls styling for all structured content

Last updated

Was this helpful?