Issue transforming data for Vega visualization

I have the following response:

aggregations" : {
  "a" : {...},
  "b" : {...},
  "c" : {...},
  "d" : {
    "value" : 5
  },
  "e" : {
    "value" : 6
  },
  "f" : {
    "value" : 7
  }
}

d, e and f are sum_bucket aggregations on a,b, and c respectively.
I need to transform it into a format that can be parsed by Vega's encoding block - specifically, Vega should display d,e, and f on one axis, with the respective values on the other axis.

I was unable to use transform to manipulate the data. I've tried several different syntaxes, but looking at the debugger either I got an error trying to retrieve the data or the data returned the same as before despite going through a transformation. I'm not even entirely sure which transformation would work for this scenario (though I suspect i need to use calculate).

Thanks,
Shai

Hi Shai,

This one had me scratching my head, too. I think you can accomplish what you're describing by way of the Vega-Lite "fold" transform.

Here's a working example.

Let me know if I got this right!

That was it!
Thanks Andrew!

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