cabana: tooltip won't extend past bounds of plot
parent
ecb3cba536
commit
afcf25cfe4
|
@ -8,6 +8,11 @@ export function swapKeysAndValues(obj, f) {
|
|||
export function fromArray(arr) {
|
||||
// arr is an array of array key-value pairs
|
||||
// like [['a', 1], ['b', 2]]
|
||||
|
||||
const pairs = arr.map( ([k,v]) => ({[k]: v}));
|
||||
return Object.assign(...pairs);
|
||||
if(pairs.length > 0) {
|
||||
return Object.assign(...pairs);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
|
@ -237,12 +237,14 @@ export default createClassFromSpec('CanPlot', {
|
|||
"type": "group",
|
||||
"from": {"data": "tooltip"},
|
||||
"interactive": false,
|
||||
"name": "tooltipGroup",
|
||||
"encode": {
|
||||
"update": {
|
||||
"x": {"scale": "xrelscale", "field": "argmin.xRel"},
|
||||
"x": [{"test": "inrange(datum.argmin.xRel + 80, domain('xrelscale'))", "scale": "xrelscale", "field": "argmin.xRel"},
|
||||
{"scale": "xrelscale", "field": "argmin.xRel", "offset": -80}],
|
||||
"y": {"scale": "yscale", "field": "argmin.y"},
|
||||
"height": {"value": 20},
|
||||
"width": {"value": 150},
|
||||
"width": {"value": 80},
|
||||
"fill": {"value": "#fff"},
|
||||
"fillOpacity": {"value": 0.85},
|
||||
"stroke": {"value": "#aaa"},
|
||||
|
|
Loading…
Reference in New Issue