DEV Community

Cover image for Stacked Graph API
Sohail Pathan
Sohail Pathan

Posted on

Stacked Graph API

Hey Devs,

An application's ability to display data to its users is super important. After all, what good are all of your data if you can’t visualize them in a compelling way? If you want your application to provide visual data to your customers/users in an accessible format, then stacked graphs might be the answer.

While there are various tools out there, but you <3 code.

ApyHub's Stacked Graph API can help to transform your JSON data into dynamic, informative graphs that can be suitable for generating analytics and dashboards.

Here's a sample code & output:



curl --location 'https://api.apyhub.com/generate/charts/stacked/file?output=sample.png' \
--header 'Content-Type: application/json' \
--header 'apy-token: 'secret-token' \
--data '{
    "title": "Quarterly Sales Fluctuations - Jan to March",
    "theme": "Light",
    "data": [
        {
            "name": "January",
            "values": [
                {
                    "label": "Electronics",
                    "value": 15
                },
                {
                    "label": "Clothing",
                    "value": 25
                },
                {
                    "label": "Toys",
                    "value": 18
                }
            ]
        },
        {
            "name": "February",
            "values": [
                {
                    "label": "Electronics",
                    "value": 10
                },
                {
                    "label": "Clothing",
                    "value": 30
                },
                {
                    "label": "Toys",
                    "value": 12
                }
            ]
        },
        {
            "name": "March",
            "values": [
                {
                    "label": "Electronics",
                    "value": 20
                },
                {
                    "label": "Clothing",
                    "value": 22
                },
                {
                    "label": "Toys",
                    "value": 16
                }
            ]
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Output:

output

Top comments (0)