Skip to content

Commit f17367f

Browse files
committed
implement appendArrayPointValue in gl3d and gl2d
1 parent 0b898e9 commit f17367f

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

src/components/fx/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = {
3535
getDistanceFunction: helpers.getDistanceFunction,
3636
getClosest: helpers.getClosest,
3737
inbox: helpers.inbox,
38+
appendArrayPointValue: helpers.appendArrayPointValue,
3839

3940
castHoverOption: castHoverOption,
4041
castHoverinfo: castHoverinfo,

src/plots/gl2d/scene2d.js

+15-12
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ proto.updateTraces = function(fullData, calcData) {
512512

513513
proto.emitPointAction = function(nextSelection, eventType) {
514514
var uid = nextSelection.trace.uid;
515+
var ptNumber = nextSelection.pointIndex;
515516
var trace;
516517

517518
for(var i = 0; i < this.fullData.length; i++) {
@@ -520,18 +521,20 @@ proto.emitPointAction = function(nextSelection, eventType) {
520521
}
521522
}
522523

523-
this.graphDiv.emit(eventType, {
524-
points: [{
525-
x: nextSelection.traceCoord[0],
526-
y: nextSelection.traceCoord[1],
527-
curveNumber: trace.index,
528-
pointNumber: nextSelection.pointIndex,
529-
data: trace._input,
530-
fullData: this.fullData,
531-
xaxis: this.xaxis,
532-
yaxis: this.yaxis
533-
}]
534-
});
524+
var pointData = {
525+
x: nextSelection.traceCoord[0],
526+
y: nextSelection.traceCoord[1],
527+
curveNumber: trace.index,
528+
pointNumber: ptNumber,
529+
data: trace._input,
530+
fullData: this.fullData,
531+
xaxis: this.xaxis,
532+
yaxis: this.yaxis
533+
};
534+
535+
Fx.appendArrayPointValue(pointData, trace, ptNumber);
536+
537+
this.graphDiv.emit(eventType, {points: [pointData]});
535538
};
536539

537540
proto.draw = function() {

src/plots/gl3d/scene.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,20 @@ function render(scene) {
102102
});
103103
}
104104

105-
var eventData = {
106-
points: [{
107-
x: selection.traceCoordinate[0],
108-
y: selection.traceCoordinate[1],
109-
z: selection.traceCoordinate[2],
110-
data: trace._input,
111-
fullData: trace,
112-
curveNumber: trace.index,
113-
pointNumber: ptNumber
114-
}]
105+
var pointData = {
106+
x: selection.traceCoordinate[0],
107+
y: selection.traceCoordinate[1],
108+
z: selection.traceCoordinate[2],
109+
data: trace._input,
110+
fullData: trace,
111+
curveNumber: trace.index,
112+
pointNumber: ptNumber
115113
};
116114

115+
Fx.appendArrayPointValue(pointData);
116+
117+
var eventData = {points: [pointData]};
118+
117119
if(selection.buttons && selection.distance < 5) {
118120
scene.graphDiv.emit('plotly_click', eventData);
119121
}

0 commit comments

Comments
 (0)