Skip to content

Commit

Permalink
PR feedback - cover the other gl2d plot types
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera committed Oct 4, 2016
1 parent 9f77c11 commit e78c2c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
15 changes: 9 additions & 6 deletions src/traces/contourgl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,23 @@ function Contour(scene, uid) {
var proto = Contour.prototype;

proto.handlePick = function(pickResult) {
var index = pickResult.pointId,
options = this.heatmapOptions,
shape = options.shape;
var shape = this.options.shape,
index = pickResult.pointId,
xIndex = index % shape[0],
yIndex = Math.floor(index / shape[0]),
zIndex = index;

return {
trace: this,
dataCoord: pickResult.dataCoord,
traceCoord: [
options.x[index % shape[0]],
options.y[Math.floor(index / shape[0])],
options.z[index]
this.options.x[xIndex],
this.options.y[yIndex],
this.options.z[zIndex]
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex, zIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
14 changes: 9 additions & 5 deletions src/traces/heatmapgl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,23 @@ function Heatmap(scene, uid) {
var proto = Heatmap.prototype;

proto.handlePick = function(pickResult) {
var index = pickResult.pointId,
shape = this.options.shape;
var shape = this.options.shape,
index = pickResult.pointId,
xIndex = index % shape[0],
yIndex = Math.floor(index / shape[0]),
zIndex = index;

return {
trace: this,
dataCoord: pickResult.dataCoord,
traceCoord: [
this.options.x[index % shape[0]],
this.options.y[Math.floor(index / shape[0])],
this.options.z[index]
this.options.x[xIndex],
this.options.y[yIndex],
this.options.z[zIndex]
],
textLabel: this.textLabels[index],
name: this.name,
pointIndex: [xIndex, yIndex, zIndex],
hoverinfo: this.hoverinfo
};
};
Expand Down
1 change: 1 addition & 0 deletions src/traces/pointcloud/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ proto.handlePick = function(pickResult) {
this.textLabels,
color: this.color,
name: this.name,
pointIndex: index,
hoverinfo: this.hoverinfo
};
};
Expand Down

0 comments on commit e78c2c0

Please sign in to comment.