Reputation: 2632
I can't for the life of my figure out what is going on here. Basically, I have a vega chart and I want to only enable clicking on the points, not the lines (because it seems that when I enable clicking on the lines, the timestamp is off - I end up with the timestamp of the beginning of the chart instead of that segment for some reason). I have separate layers for my points and my lines. It seems to me that it should be easy - simply create a click event for each of the point layers, and do nothing to the line layers. However, I have found that the click events created on any one layer are actually applied to ALL the layers for some reason. i.e. if I create a click event param for each point layer, all three of them fire whenever you click on any of the points. So I decided to just create one click event on one of the layers instead. However, this event also fires when you click on the lines! I somehow can't disable the line clicking no matter what I try. Worse, there is no way to distinguish between the line clicks and the point clicks in the frontend, so I can't even filter them out. Desperate for a solution.
Here is my Vega-lite json: Open the Chart in the Vega Editor
Upvotes: 0
Views: 101
Reputation: 2632
Haven't figured out why the events are being applied to all layers. However, I was finally able to disable clicking on the lines by changing the param to the following:
"params": [
{
"name": "click",
"select": {
"type": "point",
"fields": ["group", "ts"],
"on": {
"type": "click",
"source": "scope",
"marktype": "symbol"
}
}
}
]
Upvotes: 0