# JSON to chart

> Paste a Chart.js config, a simple {"label": value} object or an array of {label, value} records, and you get a chart right away.

URL: https://render.cuelark.com/json-to-chart

## Accepted JSON shapes
```json
// 1. Shorthand object
{ "type": "bar", "data": { "Mon": 3, "Tue": 5, "Wed": 2 } }

// 2. Array of records
{ "type": "pie", "data": [{ "label": "Yes", "value": 61 }, { "label": "No", "value": 39 }] }

// 3. Chart.js-style config
{
  "type": "line",
  "data": { "labels": ["Q1","Q2","Q3"], "datasets": [{ "label": "Revenue", "data": [12, 19, 27] }] },
  "options": { "plugins": { "title": { "text": "Revenue" } } }
}
```

## What Chart.js options are supported
The renderer reads the parts that change how a chart looks as a static image: type, labels, datasets (label, data, backgroundColor or borderColor), indexAxis: "y" for horizontal bars, stacked scales, axis titles and the title and subtitle plugins. Options that only affect interaction, like tooltips, hover and animation, are ignored.

## FAQ
### Is this compatible with QuickChart?
It accepts the same Chart.js-style config for the common chart types, so most simple QuickChart configs render here too. Plugins and JavaScript callbacks aren't supported.

### Can I send JSON from code instead?
Yes. POST the same JSON to https://render.cuelark.com/v1/chart and you get a PNG or SVG back. See the Chart image API page.

### What if my JSON has strings like "$1,200"?
Numbers given as strings are cleaned. Commas, $, % and spaces are stripped before plotting.
