简体   繁体   中英

Set default values of brushed data on x-axis with dates

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.

默认选择 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.

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"]
          }
        }
      ],

工作图

Open the Chart in the Vega Editor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM