Skip to content

Commit 60df466

Browse files
committed
Add basic hover indexes calc
1 parent d02f572 commit 60df466

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/components/fx/hover.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
340340
if(['carpet', 'contourcarpet'].indexOf(trace._module.name) !== -1) continue;
341341

342342
subplotId = helpers.getSubplot(trace);
343-
subploti = subplots.indexOf(subplotId);
343+
344+
// FIXME: detect proper subplot index for splom
345+
subploti = trace.type === 'splom' ? 0 : subplots.indexOf(subplotId);
344346

345347
// within one trace mode can sometimes be overridden
346348
mode = hovermode;

src/traces/splom/index.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,24 +183,42 @@ function plotOne(gd, cd0) {
183183
viewOpts.domains[i] = [xa.domain[0], ya.domain[0], xa.domain[1], ya.domain[1]];
184184
}
185185

186-
viewOpts.viewport = [gs.l, gs.b, fullLayout.width - gs.r, fullLayout.height - gs.t];
186+
viewOpts.viewport = [gs.l, gs.b, gs.w + gs.l, gs.h + gs.b];
187187

188188
if(scene.matrix === true) {
189189
scene.matrix = createMatrix(regl);
190190
}
191191

192+
// FIXME: generate multiple options for single update
192193
scene.matrix.update(scene.matrixOptions);
193194
scene.matrix.update(viewOpts);
194195
scene.matrix.draw();
195196
}
196197

197198
// TODO splom 'needs' the grid component, register it here?
198199

199-
function hoverPoints() {
200+
function hoverPoints(pointData, xval, yval, hovermode) {
201+
var cd = pointData.cd;
202+
var stash = cd[0].t;
203+
var trace = cd[0].trace;
204+
var xa = pointData.xa;
205+
var ya = pointData.ya;
206+
var xpx = xa.c2p(xval);
207+
var ypx = ya.c2p(yval);
208+
var maxDistance = pointData.distance;
209+
var dimLength = trace.dimensions.length;
210+
211+
// TODO: get data for xa, ya
212+
var xi, yi;
213+
for(var i = 0; i < dimLength; i++) {
214+
if(trace.xaxes[i] === xa._id) xi = i;
215+
if(trace.yaxes[i] === ya._id) yi = i;
216+
}
200217

218+
console.log(xi, yi);
201219
}
202220

203-
function selectPoints() {
221+
function selectPoints(searchInfo, polygon) {
204222

205223
}
206224

0 commit comments

Comments
 (0)