Spanish Total.js
English
Documentation For AI agents
Contents

Chart data

POST /reports/ with "chart": true returns the chart data of a report.

.md GitHub
On this page

Returns the data of a report as chart series. The report needs chart settings.

Request

curl -X POST -H "x-token: YOUR_TOKEN" -H "Content-Type: application/json" \
  -d '{"id":"JapNSY1c161f","chart":true}' \
  http://localhost:8000/reports/

You can add filter as in Load a report. If the report has no chart settings, you get rows instead.

Response without series

One series, named after the report, with one point for each row: x from the X axis field and y from the Y axis field.

[
    {
        "id": "JapNSY1c161f",
        "name": "Sales by product",
        "icon": "ti ti-chart-pie",
        "color": "#4285F4",
        "data": [
            { "x": "Office chair", "y": 596 },
            { "x": "Desk lamp", "y": 209.3 },
            { "x": "Monitor stand", "y": 159.6 },
            { "x": "Notebook", "y": 97.5 }
        ]
    }
]

Response with series

With Series for, you get one series for each value of that field. Its name is the value.

[
    {
        "id": "JapNIj1uE61f_3275293922",
        "name": "Slovakia",
        "icon": "",
        "color": "",
        "data": [
            { "x": "Desk lamp", "y": 89.7 },
            { "x": "Notebook", "y": 50 }
        ]
    },
    {
        "id": "JapNIj1uE61f_2112320571",
        "name": "France",
        "icon": "",
        "color": "",
        "data": [
            { "x": "Desk lamp", "y": 29.9 },
            { "x": "Monitor stand", "y": 39.9 }
        ]
    }
]
Made in Europe