This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-21
Channels
- # admin-announcements (1)
- # announcements (6)
- # babashka (8)
- # beginners (134)
- # calva (18)
- # chlorine-clover (1)
- # cider (6)
- # circleci (6)
- # clj-commons (111)
- # cljsrn (13)
- # clojure (95)
- # clojure-australia (2)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-spec (52)
- # clojure-uk (17)
- # clojurescript (4)
- # datavis (9)
- # datomic (8)
- # docker (2)
- # emacs (15)
- # events (7)
- # fulcro (6)
- # graphql (1)
- # gratitude (1)
- # introduce-yourself (2)
- # kaocha (8)
- # meander (87)
- # minecraft (2)
- # music (2)
- # off-topic (20)
- # portal (119)
- # releases (1)
- # reveal (55)
- # shadow-cljs (34)
- # sql (36)
- # tools-deps (9)
- # vim (8)
- # xtdb (39)
This is probably trivial I can't figure out the right way to do it in vega(lite)
How do I add a selection of a set of values and filter the [:data :values]
such that they are equal to the selection
i.e.
datum.field == param.field
@metasoarous
Hey @ben.sless. Are you trying to do this using a dropdown selection, or a brush selection?
This is kind of a nice example cause it combines both (click the bars below to select by single value, and draw a region above for brush select)
Hah! Forgot to add the link... https://vega.github.io/vega-lite/examples/interactive_seattle_weather.html
In short, you add a filter transform with param set to whatever the selection name is.
I think that's what I did, but it's not filtering it. Wanted to start with something super simple, just filter the dataset by one parameter https://gist.github.com/bsless/505af2f15a1bf4ccf58983a9576105a9
Specifically
"encoding": {
"x": {
"field": "*percentile",
"type": "quantitative",
"axis": {
"values": [
-0.47712125471966244,
0,
0.954242509439325,
1.9956351945975495,
2.999565488225982,
3.9999565683802403,
4.999995657035442,
5.9999995656928125
]
}
},
"y": {"field": "latency", "type": "quantitative"},
"transform": [
{
"filter": "datum.rate == selection_rate"
}
],
"color": {
"field": "rate",
"type": "nominal",
"condition": {
"param": "selection",
"field": "rate",
"type": "nominal"
}
}
},
"mark": "line",
"params": [
{
"name": "selection",
"value": 30,
"select": {
"type": "point",
"fields": ["rate"]
},
"bind": {
"rate": {
"input": "select",
"field": "rate",
"value": 30,
"options": [30, 50, 60]
}
}
}
]
Hah! Forgot to add the link... https://vega.github.io/vega-lite/examples/interactive_seattle_weather.html
Try something like {:filter {:param :selection}}
Here's another pretty simple example: https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate