Reputation: 11
Link to minimal working example. Here is the part of the code I am dealing with:
"params": [
{
"name": "Supervisor",
"value": "Amy",
"bind": {"input": "radio", "options": ["Amy", "John"]}
},
{
"name": "Name",
"value": "",
"bind": {"input": "select", "options": ["Jane", "Sam", "Bill"]}
}
I would like the input for Name
to be conditional based on the current value of Supervisor
:
If Supervisor == Amy
, display "Jane", "Sam"
under "Name"
. If Supervisor == John
, display "Bill"
under "Name"
.
I tried to use the Vega Lite "condition" property, but it works only within mark
channels. This was my idea:
"params": [
{
"name": "Supervisor",
"value": "Amy",
"bind": {"input": "radio", "options": ["Amy", "John"]}
},
{
"name": "Name",
"value": "",
"bind": {"input": "select",
"options":
[
"condition":
[
{
"test": "Supervisor === 'Amy'",
"value": ["Jane", "Sam"]
},
{
"test": "Supervisor === 'John'",
"value": ["Bill"]
}
]
}
]
I then tried exchanging params
for signals
, but found that "transform": [{"filter": "datum['Supervisor'] == Supervisor"}]
would not work when Supervisor is not a parameter.
Will I have to progress to Vega for this functionality?
Upvotes: 1
Views: 169