简体   繁体   中英

vega-lite: Adjustable selection?

Is there a way to get a adjustable selection in vega-lite?

I found this example but I think this is made with plain vega.

在此处输入图片说明

Vega-Lite does not provide any way to create an interval selection with a size that is adjustable by clicking and dragging on the edges.

Available configuration properties are listed in the interval selection docs . The only configurable interactions are translate , which enables moving the selection by clicking and dragging, and zoom , which enables changing the selection's size by zooming on its interior; both of these are True by default.

Here is a simple specification that lets you see the effect of these configurations ( open in editor ):

{
  "data": {"url": "data/sp500.csv"},
  "mark": "area",
  "selection": {
    "brush": {
      "type": "interval",
      "encodings": ["x"],
      "zoom": true,
      "translate": true
    }
  },
  "encoding": {
    "x": {"field": "date", "type": "temporal"},
    "y": {"field": "price", "type": "quantitative"}
  },
  "width": 400
}

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