Back to blog
Guides

How to replace Google Image Charts with a modern API

Josselin Liebe
Josselin Liebe

Google Image Charts was deprecated in 2012 and officially shut down in 2019. If you're still relying on the old chart.googleapis.com URLs or looking for an alternative to drop-in replacements like QuickChart, ChartQuery offers a modern, more powerful path forward.

Here are a few things to know before getting started:

  • ChartQuery uses a JSON API, not URL parameters. Instead of encoding chart options as cryptic URL fragments (cht=bvg&chd=t:5,5,5), you send a clean JSON object. The learning curve is near zero because ChartQuery speaks Chart.js v4 -- the most widely used open-source charting library.
  • No account required. The chart API works without an API key. Anonymous requests are rate-limited to 60/hour per IP and include a small watermark. Sign up for a free key to remove both.
  • Not just charts. Unlike Google Image Charts or QuickChart, ChartQuery also generates diagrams (28 languages), barcodes (25+ formats), QR codes and thermal label previews from the same API.
  • AI generation. Describe a chart in plain English and get a rendered image back -- no JSON configuration needed. Try it in the Playground.

Before and after

Google Image Charts (deprecated)

The old Google Image Charts URL for a grouped bar chart looked like this:

https://chart.googleapis.com/chart?cht=bvg&chs=300x200&chd=t:5,5,5|10,10,10|15,15,15&chco=4d89f9,c6d9fd,00B88A&chds=0,20&chbh=a&chxs=0,000000,0,0,_&chxt=y&chm=N,000000,0,,10|N,000000,1,,10|N,000000,2,,10

Hard to read, hard to maintain, and no longer functional.

ChartQuery equivalent

The same chart with ChartQuery:

curl -X POST https://api.chartquery.com/v1/chart \
  -H "Content-Type: application/json" \
  -d '{
    "type": "bar",
    "width": 300,
    "height": 200,
    "data": {
      "labels": ["A", "B", "C"],
      "datasets": [
        { "label": "Series 1", "data": [5, 5, 5], "backgroundColor": "#4d89f9" },
        { "label": "Series 2", "data": [10, 10, 10], "backgroundColor": "#c6d9fd" },
        { "label": "Series 3", "data": [15, 15, 15], "backgroundColor": "#00B88A" }
      ]
    },
    "scales": { "y": { "min": 0, "max": 20 } }
  }' \
  --output chart.png

Readable, self-documenting, and easy to generate from any programming language.

As a GET URL (embeddable)

If you need a direct image URL for an <img> tag or Markdown, use the GET endpoint with the config as a URL-encoded query parameter:

https://api.chartquery.com/v1/chart?query={"type":"bar","width":300,"height":200,"data":{"labels":["A","B","C"],"datasets":[{"data":[5,5,5],"backgroundColor":"#4d89f9"},{"data":[10,10,10],"backgroundColor":"#c6d9fd"},{"data":[15,15,15],"backgroundColor":"#00B88A"}]},"scales":{"y":{"min":0,"max":20}}}

Embed it directly:

<img src="https://api.chartquery.com/v1/chart?query={...}" alt="Bar chart" />

Parameter mapping

The table below maps Google Image Charts parameters to ChartQuery equivalents. Instead of a flat list of URL params, everything lives inside a structured JSON body.

Google Image Charts Description ChartQuery equivalent
cht=bvg Chart type (vertical bar) "type": "bar"
cht=lc Chart type (line) "type": "line"
cht=p Chart type (pie) "type": "pie"
cht=p3 Chart type (3D pie) "type": "doughnut" (3D is not supported; use doughnut as a modern alternative)
cht=r Chart type (radar) "type": "radar"
cht=s Chart type (scatter) "type": "scatter"
chs=800x400 Chart size "width": 800, "height": 400
chd=t:10,20,30 Data values "data": { "datasets": [{ "data": [10, 20, 30] }] }
chd=t:10,20|30,40 Multiple data series Multiple objects in "datasets": [...]
chdl=Sales|Revenue Legend labels "datasets": [{ "label": "Sales" }, { "label": "Revenue" }]
chco=4d89f9,ff0000 Series colors "backgroundColor": "#4d89f9" per dataset
chtt=My+Chart Chart title "title": "My Chart"
chts=000000,16 Title style "options": { "plugins": { "title": { "font": { "size": 16 }, "color": "#000" } } }
chxt=x,y Visible axes Axes are visible by default. Hide with "scales": { "x": { "display": false } }
chxl=0:|Jan|Feb|Mar Axis labels "data": { "labels": ["Jan", "Feb", "Mar"] }
chxr=1,0,100 Axis range "scales": { "y": { "min": 0, "max": 100 } }
chg=20,20 Grid lines Grid is shown by default. Configure with "scales": { "y": { "grid": { ... } } }
chf=bg,s,ffffff Background fill "background": "#ffffff"
chm=N,000000,0,,10 Data value markers "options": { "plugins": { "datalabels": { ... } } }
chl=A|B|C Pie slice labels "data": { "labels": ["A", "B", "C"] }
chds=0,100 Data scaling "scales": { "y": { "min": 0, "max": 100 } }
chbh=a Bar width Automatic by default. Override with "barPercentage" and "categoryPercentage" in dataset.

Migrating common chart types

Bar chart

Google Image Charts:

cht=bvg&chd=t:42,58,37,65&chl=Jan|Feb|Mar|Apr&chco=6366f1&chs=600x300

ChartQuery:

{
  "type": "bar",
  "width": 600,
  "height": 300,
  "data": {
    "labels": ["Jan", "Feb", "Mar", "Apr"],
    "datasets": [{
      "data": [42, 58, 37, 65],
      "backgroundColor": "#6366f1"
    }]
  }
}

Line chart

Google Image Charts:

cht=lc&chd=t:12,18,15,21,9,17&chl=Jan|Feb|Mar|Apr|May|Jun&chco=6366f1&chs=600x300

ChartQuery:

{
  "type": "line",
  "width": 600,
  "height": 300,
  "data": {
    "labels": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    "datasets": [{
      "data": [12, 18, 15, 21, 9, 17],
      "borderColor": "#6366f1",
      "tension": 0.4
    }]
  }
}

Pie chart

Google Image Charts:

cht=p&chd=t:38,24,18,12,8&chl=Organic|Paid|Direct|Referral|Social&chco=6366f1,f97316,22c55e,ef4444,eab308&chs=400x300

ChartQuery:

{
  "type": "pie",
  "width": 400,
  "height": 300,
  "data": {
    "labels": ["Organic", "Paid", "Direct", "Referral", "Social"],
    "datasets": [{
      "data": [38, 24, 18, 12, 8],
      "backgroundColor": ["#6366f1", "#f97316", "#22c55e", "#ef4444", "#eab308"]
    }]
  }
}

Multiple series

Google Image Charts:

cht=bvg&chd=t:42,58,37|51,67,44&chdl=2025|2026&chco=6366f1,f97316&chs=600x300

ChartQuery:

{
  "type": "bar",
  "width": 600,
  "height": 300,
  "legend": "bottom",
  "data": {
    "labels": ["Jan", "Feb", "Mar"],
    "datasets": [
      { "label": "2025", "data": [42, 58, 37], "backgroundColor": "#6366f1" },
      { "label": "2026", "data": [51, 67, 44], "backgroundColor": "#f97316" }
    ]
  }
}

Why not a drop-in URL replacement?

QuickChart and similar services let you swap chart.googleapis.com with their domain and keep the same URL parameters. That's convenient for a quick fix, but it locks you into a format that was designed in 2007 and deprecated for good reason:

  • Unreadable URLs. chd=t:5,5,5|10,10,10 is hard to debug, version-control, or generate programmatically.
  • Limited chart types. Google Image Charts supported about 10 chart types. ChartQuery supports everything Chart.js v4 offers, including mixed charts, stacked area, polar area, and bubble charts.
  • No customization. The old format has no way to express modern features like dual Y-axes, custom tooltips, gradient fills, smooth curve tension, or dataset stacking.
  • Dead ecosystem. No documentation updates, no community, no bug fixes. You're building on a frozen API.

ChartQuery takes a different approach: adopt the Chart.js standard that millions of developers already know, and add server-side rendering on top. The migration takes a bit more effort upfront, but the result is a modern, flexible, well-documented API you can rely on.

Beyond charts

Once you migrate to ChartQuery, you get access to more than just charts from the same API:

What Endpoint Use case
Diagrams /v1/diagram Flowcharts, sequence diagrams, ER diagrams, architecture diagrams -- 28 languages including Mermaid, PlantUML, D2 and GraphViz.
AI generation /v1/chart/ai, /v1/diagram/ai Describe what you want in plain English. No JSON needed.
Barcodes /v1/barcode EAN-13, Code 128, GS1-128, ITF-14 and 25+ other formats.
QR codes /v1/qrcode Styled QR codes with 11 dot types, gradients and custom corners.
Labels /v1/label Thermal label previews for 9 printer languages.

Quick migration checklist

  1. Identify all Google Image Charts URLs in your codebase, email templates and dashboards. Search for chart.googleapis.com or chart.apis.google.com.

  2. Map each URL to a JSON config. Use the parameter mapping table above. For each chart, create a JSON object with type, data, and any styling options.

  3. Test in the Playground. Paste your JSON into the ChartQuery Playground, click Run, and verify the result looks correct.

  4. Replace the URLs. Switch from the old Google URL to either:

    • A POST request to https://api.chartquery.com/v1/chart (recommended for server-side generation).
    • A GET request with ?query={...} for direct embedding in <img> tags.
  5. Optional: get an API key. Sign up at app.chartquery.com to remove the watermark and raise rate limits.

  6. Optional: use Share for static embeds. If your old setup embedded a static image URL, add "share": true to get a permanent render_url you can use as a drop-in replacement.

Or let AI do the migration

If you have a lot of charts to migrate, use the AI endpoint. Describe what each chart should look like in English and let the AI generate the configuration:

curl -X POST https://api.chartquery.com/v1/chart/ai \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "prompt": "A grouped bar chart with 3 series (5,5,5 / 10,10,10 / 15,15,15), blue, light blue and green colors, Y axis from 0 to 20",
    "format": "png"
  }' \
  --output chart.png

No parameter mapping required.