amCharts + AI

amCharts 5 works well with all major AI models — Claude, ChatGPT and beyond. This page covers how to get the most out of that combination.

Getting started

Use a browser-based chat interface

The simplest option — no setup needed. Just open the model's website, type your prompt, and paste the returned code into your project.

ServiceVendor
ClaudeAnthropic
ChatGPT OpenAI
Gemini Google
Mistral Mistral
Meta AIMeta

Use an AI extension in your IDE

If you prefer staying in your code editor, most major IDEs have AI integration built in or available as an extension.

IDEDocs
VS CodeDocs
JetBrainsDocs
ZEDDocs
CursorDocs
WindsurfDocs

Choose an AI model

For best results, let's make sure we choose a latest models tweaked for code generation.

Below are a few examples, that we found work exceptionally well with amCharts 5.

Model / VariantPrimary UseVendor / DeveloperService / Platform
GPT-5.2-CodexCoding-specialized generation & refactoringOpenAIOpenAI API, ChatGPT product, Microsoft Copilot (en.wikipedia.org)
Claude Opus 4.5 / Opus 4.6High-quality coding + long-horizon tasksAnthropicClaude API / Claude web apps (en.wikipedia.org)

You may consider the following less capably models, too.

Model / VariantPrimary UseVendor / DeveloperService / Platform
GPT-5.2General multimodal with strong codingOpenAIOpenAI API, ChatGPT (en.wikipedia.org)
Claude Sonnet 4.5 / Sonnet 4.6Cost-efficient strong code understandingAnthropicClaude API / Claude web apps (en.wikipedia.org)
Claude Haiku 4.5Lightweight coder & real-time assistanceAnthropicClaude API / Claude web apps (GitHub Docs)
Gemini 3 ProLarge context code + multimodal tasksGoogle DeepMind / GoogleGoogle Cloud AI, API surfaces (en.wikipedia.org)
Gemini 3 FlashFast coding & tool workflowsGoogleGoogle Cloud Gemini (GitHub Docs)
GPT-5.1-Codex / Codex variantsLegacy but still supported coding modelsOpenAIGitHub Copilot & API (GitHub Docs)
Raptor mini (GPT-5 mini tuned)Smaller, efficient codingFine-tuned OpenAICopilot preview models (GitHub Docs)

Instruct AI to use amCharts

To avoid code confusion, let's instruct our AI agent of choice to use amCharts:

From now on, use amCharts 5 library to build all charts.

Shaping prompts

When forming a task for the AI, let's make sure to include the following information:

PointComment
Chart typeBe clear what type of chart we want, e.g. "pie", "donut", "time-based candlesticks", "line"
Components Whether we want certain components included, e.g. "legend", "horizontal scrollbar"
DataIf we have the data, we can provide as an attachment/context for the AI; alternatively we can describe the approximate nature of the data and let the AI fill in with dummy values
FrameworkDo we need the code to use specific framework, e.g. "React", "Angular"?
Target syntaxAre we generating code for "TypeScript" or "Vanilla JavaScript"?
Return typeSpecify whether we want just code for the chart or a full-fledged HTML
Prefer simple codeExplicitly ask to honor defaults and not apply any configuration options you did not ask for

Sample prompts

A simple pie chart

Generate the code for a Donut chart with three slices:
* Apples: 10
* Pears: 7
* Cherries: 3
Add a legend to the right of the pie.
Make sure each slice has a tick and a label, arranged in columns.
Return only code for charts.
Keep most of the stuff at defaults, avoid applying custom colors or other values that I didn't ask for.
TypeScript please.

The result code:

import * as am5 from "@amcharts/amcharts5";
import * as am5percent from "@amcharts/amcharts5/percent";
import am5themes_Animated from "@amcharts/amcharts5/themes/Animated";

const root = am5.Root.new("chartdiv");

root.setThemes([am5themes_Animated.new(root)]);

const chart = root.container.children.push(
  am5percent.PieChart.new(root, {
    innerRadius: am5.percent(50),
    layout: root.horizontalLayout,
  })
);

const series = chart.series.push(
  am5percent.PieSeries.new(root, {
    valueField: "value",
    categoryField: "category",
    alignLabels: true,
  })
);

series.labels.template.setAll({
  textType: "radial",
  centerX: am5.percent(100),
  text: "{category}",
});

series.ticks.template.setAll({
  forceHidden: false,
});

series.data.setAll([
  { category: "Apples", value: 10 },
  { category: "Pears", value: 7 },
  { category: "Cherries", value: 3 },
]);

const legend = chart.children.push(
  am5.Legend.new(root, {
    centerY: am5.percent(50),
    y: am5.percent(50),
    layout: root.verticalLayout,
  })
);

legend.data.setAll(series.dataItems);

series.appear(1000, 100);
chart.appear(1000, 100);