Add bound parameters to mouseover and click_functions.
Currently 'click' lets you define a function on datum, but 'mouseover' just creates a tooltip that is unaware of the local styling environment.
mouseover should instead accept a function-defining string with the arguments (datum, event, $), as in arquero, where $ refers to a bindable context on plot to allow safe (non-eval) materialization of the strings, and event is the d3 event context.
So
plot.params.select = d3.select
plot.params.make_tooltips = function(data, selector) {
const values = [...Object.entries(datum)];
const dl = d3.select(selector).selectAll("dl").data([1])
[... yadda yadda yadda ... populate <dt> <dl> items.
}
"mouseover": '$.select(".tooltip").style("transform", "translate(${datum.x}, ${datum.y}"); $.make_tooltips('
Actually, it isn't even necessary to use "$" magic. By adding the param scope to the function creation, you can have the function.
"mouseover": 'select(".tooltip").style("transform", \translate(${datum.x}, ${datum.y}`); make_tooltips(SOMETHING)"`
Name changed to reflect narrowing scope. Currently both these functions accept only a single argument (the datum). If there were a strong case for accepting some kind of bound parameters (e.g., the current state of the plot query) I could see baking this access in.