0

I am working with the Overview and Detail Vega-Lite sample at https://vega.github.io/vega-lite/examples/interactive_overview_detail.html

I am trying to set default values for the brushed data on the Overview Chart x-axis.

Default selection Open the Chart in the Vega Editor

I have done this for a point selection and dates like this:

      "params": [{
        "name": "index",
        "value": [{"x": {"year": 2008, "month": 2, "date": 1}}],
        "select": {
          "type": "point",
          "encodings": ["x"],
          "on": "mouseover",
          "nearest": true
        }
      }],

But I can't seem to get the syntax right for a time interval.

TheRizza
  • 1,577
  • 1
  • 10
  • 23

1 Answers1

1

Use an array for the specified "X" value. You can go to whatever timeunit level you want.

      "params": [
        {
          "name": "brush", 
          "value": 
            {"x": [{"year": 2007, "month": 7},
                   {"year": 2009, "month": 6}]}
          ,
          "select": {
            "type": "interval", 
            "encodings": ["x"]
          }
        }
      ],

Working chart

Open the Chart in the Vega Editor

TheRizza
  • 1,577
  • 1
  • 10
  • 23