How to define JSON for Bubble chart in workspace for Manual Data source

NarsimhaMurty1
Tera Expert

Hi Everyone,

I wanted to populate Bubble chart using option "Define data manually" in workspace.
I tried different JSON formats by referring to OOTB workspaces which used Bubble chart, but no success.

NarsimhaMurty1_0-1724240136574.png

 

1 REPLY 1

olgaredkina
ServiceNow Employee
ServiceNow Employee

Hi, 

 

If you select chart type first and then toggle "Define data manually" - you will see the example json for manual data.

 

Like this:

 

[
    {
        "data": [
            {
                "cost": "$2,499.99",
                "quantity": "1",
                "value": "145"
            },
            {
                "cost": "$2,160.00",
                "quantity": "2",
                "value": "13"
            },
            {
                "cost": "$3,665.00",
                "quantity": "4",
                "value": "9"
            },
            {
                "cost": "$2,839.99",
                "quantity": "1",
                "value": "8"
            },
            {
                "cost": "$8,999.95",
                "quantity": "5",
                "value": "8"
            },
            {
                "cost": "$4,950.00",
                "quantity": "6",
                "value": "4"
            },
            {
                "cost": "$9,344.00",
                "quantity": "1",
                "value": "4"
            },
            {
                "cost": "$9,599.99",
                "quantity": "1",
                "value": "4"
            },
            {
                "cost": "$2,250.00",
                "quantity": "8",
                "value": "3"
            },
            {
                "cost": "$2,249.99",
                "quantity": "1",
                "value": "2"
            },
            {
                "cost": "$2,249.99",
                "quantity": "1",
                "value": "1"
            }
        ],
        "metadata": {
            "aggregateBy": 4,
            "eventData": {
                "table": "alm_asset",
                "query": "department=5d7f17f03710200044e0bfc8bcbe5d43^ORdepartment=221db0edc611228401760aec06c9d929^ORdepartmentISEMPTY^costBETWEENjavascript:global.getCurrencyFilter('alm_asset','cost','USD;2000')@javascript:global.getCurrencyFilter('alm_asset','cost','USD;10000')"
            },
            "dataSourceLabel": "Asset",
            "groupBy": [
                {
                    "format": {
                        "precision": 2,
                        "unitFormat": "€{0}"
                    },
                    "label": "Cost",
                    "elements": [
                        {
                            "eventData": {
                                "query": "cost=4950"
                            },
                            "label": "$4,950.00",
                            "id": "4950"
                        },
                        {
                            "eventData": {
                                "query": "cost=3665"
                            },
                            "label": "$3,665.00",
                            "id": "3665"
                        },
                        {
                            "eventData": {
                                "query": "cost=9344"
                            },
                            "label": "$9,344.00",
                            "id": "9344"
                        },
                        {
                            "eventData": {
                                "query": "cost=9599.99"
                            },
                            "label": "$9,599.99",
                            "id": "9599.99"
                        },
                        {
                            "eventData": {
                                "query": "cost=2249.99"
                            },
                            "label": "$2,249.99",
                            "id": "2249.99"
                        },
                        {
                            "eventData": {
                                "query": "cost=2160"
                            },
                            "label": "$2,160.00",
                            "id": "2160"
                        },
                        {
                            "eventData": {
                                "query": "cost=2839.99"
                            },
                            "label": "$2,839.99",
                            "id": "2839.99"
                        },
                        {
                            "eventData": {
                                "query": "cost=8999.95"
                            },
                            "label": "$8,999.95",
                            "id": "8999.95"
                        },
                        {
                            "eventData": {
                                "query": "cost=2499.99"
                            },
                            "label": "$2,499.99",
                            "id": "2499.99"
                        },
                        {
                            "eventData": {
                                "query": "cost=2250"
                            },
                            "label": "$2,250.00",
                            "id": "2250"
                        }
                    ],
                    "id": "cost",
                    "fieldType": "currency"
                },
                {
                    "label": "Quantity",
                    "format": {
                        "precision": 0,
                        "unitFormat": "{0}"
                    },
                    "elements": [
                        {
                            "eventData": {
                                "query": "quantity=1"
                            },
                            "label": "1",
                            "id": "1"
                        },
                        {
                            "eventData": {
                                "query": "quantity=2"
                            },
                            "label": "2",
                            "id": "2"
                        },
                        {
                            "eventData": {
                                "query": "quantity=3"
                            },
                            "label": "3",
                            "id": "3"
                        },
                        {
                            "eventData": {
                                "query": "quantity=4"
                            },
                            "label": "4",
                            "id": "4"
                        },
                        {
                            "eventData": {
                                "query": "quantity=5"
                            },
                            "label": "5",
                            "id": "5"
                        },
                        {
                            "eventData": {
                                "query": "quantity=6"
                            },
                            "label": "6",
                            "id": "6"
                        }
                    ],
                    "id": "quantity",
                    "fieldType": "integer"
                }
            ],
            "filterQuery": "department=5d7f17f03710200044e0bfc8bcbe5d43^ORdepartment=221db0edc611228401760aec06c9d929^ORdepartmentISEMPTY^costBETWEENjavascript:global.getCurrencyFilter('alm_asset','cost','USD;2000')@javascript:global.getCurrencyFilter('alm_asset','cost','USD;10000')",
            "format": {
                "unitFormat": "{0}"
            },
            "metricId": "ZEdGaWJHVmhiRzFmWVhOelpYUXhOall5TXpjM01EWXhNak0xMTY2MjM3NzA2MjE2Mw=="
        }
    }
]

 

This is the output for this json:

 

olgaredkina_0-1724243207015.png

 

Regards,

Olga