Help with Parallel Coordinates in vega

Hello.

I am trying to achieve Parallel Coordinates in vega (kibana 7.1.1) but having trouble with field referencing.

I found similar post but it's not working in my code.

My Data

  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 0.0,
    "hits" : [
      {
        "_index" : "general",
        "_type" : "_doc",
        "_id" : "_bbDIWwBn-LEgyijCPaK",
        "_score" : 0.0,
        "_source" : {
          "timeofday" : "night",
          "weather" : "clear",
          "scene" : "highway"
        }
      },
      {
        "_index" : "general",
        "_type" : "_doc",
        "_id" : "_rbDIWwBn-LEgyijCPaK",
        "_score" : 0.0,
        "_source" : {
          "timeofday" : "daytime",
          "weather" : "overcast",
          "scene" : "city street"
        }
      },

My Code

{
  "$schema": "https://vega.github.io/schema/vega/v3.json",
  "data": [
    {
      "name": "general",
      "url": {
        "format": {"property": "hits.hits"},
        "index": general,
        "body": {
          "size": 1000,
          "_source": {
            "includes": ["weather", "timeofday", "scene"]
          },
          "query": {
            "bool": {
              "must_not": [
                { "match": { "weather": "undefined" }},
                { "match": { "timeofday": "undefined" }},
                { "match": { "scene": "undefined" }}
              ]
            }
          }
        }
      },
      "transform": [
        {type: "formula", "as": "weather", "expr": "datum._source.weather"},
        {type: "formula", "as": "timeofday", "expr": "datum._source.timeofday"},
        {type: "formula", "as": "scene", "expr": "datum._source.scene"}
      ]
    },
    {
      "name": "fields",
      "values": [
        "weather",
        "timeofday",
        "scene"
      ]
    },
    {
      "name": "generaltrans", "source": "general"
    }
  ],

  "scales": [
    {
      "name": "ord", "type": "point",
      "range": "width", "round": true,
      "domain": {"data": "fields", "field": "data"}
    },
    {
      "name": "weather", "type": "point",
      "range": "height", "round": true, 
      "domain": {"data": "generaltrans", "field": "weather"}
    },
        {
      "name": "timeofday", "type": "point",
      "range": "height", "round": true,
      "domain": {"data": "generaltrans", "field": "timeofday"}
    },
    {
      "name": "scene", "type": "point",
      "range": "height", "round": true,
      "domain": {"data": "generaltrans", "field": "scene"}
    }
  ],

  "axes": [
    {
      "orient": "left", "zindex": 1,
      "scale": "weather", "title": "weather"
      "offset": {"scale": "ord", "value": "weather", "mult": -1}
    },
    {
      "orient": "left", "zindex": 1,
      "scale": "timeofday", "title": "timeofday"
      "offset": {"scale": "ord", "value": "timeofday", "mult": -1}
    },
    {
      "orient": "left", "zindex": 1,
      "scale": "scene", "title": "scene"
      "offset": {"scale": "ord", "value": "scene", "mult": -1}
    }
  ],

  "marks": [
    {
      "type": "group",
      "from": {"data": "generaltrans"},
      "marks": [
        {
          "type": "line",
          "from": {"data": "fields"},
          "encode": {
            "enter": {
              "x": {"scale": "ord", "field": "data"},
              "y": {
                "scale": {"datum": "data"},
                "field": {"parent": {"datum": "data"}}
              },
              "stroke": {"value": "steelblue"},
              "strokeWidth": {"value": 1.01},
              "strokeOpacity": {"value": 0.3}
            }
          }
        }
      ]
    }
  ]
}

Error I get is below.

I appreciate if I could get help to solve this error.

Thanks,
Yu Watanabe

Hey @YuWatanabe
The problem reside on the "format": {"property": "hits.hits"}, that should be moved outside the url object.
I've tested it locally, moving format just above the url object it works correctly

@markov00
Oh no! How embarrassing ...

Thank you for the help.

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