Populating a Pie-Chart from a JSON Object / Dictionary?

Hey all,

My structured logging framworks indexes the documents with the following structure fragment:

{
    "ZoneId": "abc",
    "Results": {
        "a": 5,
        "b": 14,
        "c": 22
    }
}
{
    "ZoneId": "def",
    "Results": {
        "a": 5,
        "g": 14,
        "h": 22
    }
}

I'm looking to create a pie-chart visualization that would be capable of displaying the Results node (values = pie chart arcs and keys as labels)

Is this achievable? How should one approach it?
From the above input I'd expect to have a pie chart with 5 segments (a,b ,c ,g, h) with apropriate value aggregations.
Please note that if the above input structure won't work, I'm open to modifying it

I don't see a way to do it with the current structure, easiest way to do it would be to have separate documents for each keys, something like this for the first document (it would be split in 3 documents):

{
    "ZoneId": "abc",
    "Results_key": "a",
   "Results_value": 5
}
{
    "ZoneId": "abc",
    "Results_key": "b",
   "Results_value": 14
}
{
    "ZoneId": "abc",
    "Results_key": "c",
   "Results_value": 22
}

Then you could do a Pie Chart with Split by Terms on Results_key field and Using Average or whatever metric you need on the field Results_value.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.