GraphQL, name, id

I am making progress in creating a customized multi-line chart with Vega-lite (not Vega). I noticed that on the GraphQL page, that “name” and “id” are always available. If wanted to do a groupby by name, how would that be accomplished? Would I use datum.name? Would I have to use quotation marks, like "datum.name"? Any information would be appreciated. Thanks.

Hey @erlebacher, you can groupby within the UI itself by going to the following page:

If you want to edit the Vegalite script directly, you can use something similar to the following:

"transform": [
    {
      "calculate": "if('${field:groupKeys}' === ''  || datum['${field:groupKeys}'] === '', false, true)",
      "as": "grouped"
    },
    {
      "calculate": "if('${field:groupKeys}' === ''  || datum['${field:groupKeys}'] === '', datum.name, datum['${field:groupKeys}'])",
      "as": "newGroupKeys"
    },
    {
      "calculate": "if('${field:groupKeys}' === ''  || datum['${field:groupKeys}'] === '', datum.color, datum['${field:groupKeys}'])",
      "as": "color"
    },
  {
    "joinaggregate": [
      {
      "op" : "average",
      "field": "${field:y}",
      "as": "groupedY"
      }
    ],
    "groupby": ["${field:x}", "newGroupKeys", "color", "grouped"]
  }
]

Thanks! I will look into it.

Hi Gordon,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,

Uma

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