Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a55cadd

Browse filesBrowse files
authored
Merge pull request plotly#1949 from plotly/fix-gl3d-hover
Fix hover label exponent hiding or gl3d log hover
2 parents cb2d3d1 + 709b058 commit a55cadd
Copy full SHA for a55cadd

File tree

Expand file treeCollapse file tree

2 files changed

+31
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+31
-0
lines changed

‎src/plots/cartesian/axes.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/axes.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,17 @@ function formatDate(ax, out, hover, extraPrecision) {
12981298
function formatLog(ax, out, hover, extraPrecision, hideexp) {
12991299
var dtick = ax.dtick,
13001300
x = out.x;
1301+
1302+
if(hideexp === 'never') {
1303+
// If this is a hover label, then we must *never* hide the exponent
1304+
// for the sake of display, which could give the wrong value by
1305+
// potentially many orders of magnitude. If hideexp was 'never', then
1306+
// it's now succeeded by preventing the other condition from automating
1307+
// this choice. Thus we can unset it so that the axis formatting takes
1308+
// precedence.
1309+
hideexp = '';
1310+
}
1311+
13011312
if(extraPrecision && ((typeof dtick !== 'string') || dtick.charAt(0) !== 'L')) dtick = 'L3';
13021313

13031314
if(ax.tickformat || (typeof dtick === 'string' && dtick.charAt(0) === 'L')) {

‎test/jasmine/tests/hover_label_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/hover_label_test.js
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ describe('hover info', function() {
199199
});
200200
});
201201

202+
describe('hover info y on log axis', function() {
203+
var mockCopy = Lib.extendDeep({}, mock);
204+
205+
mockCopy.data[0].hoverinfo = 'y';
206+
207+
beforeEach(function(done) {
208+
for(var i = 0; i < mockCopy.data[0].y.length; i++) {
209+
mockCopy.data[0].y[i] *= 1e9;
210+
}
211+
212+
Plotly.plot(createGraphDiv(), mockCopy.data, mockCopy.layout).then(done);
213+
});
214+
215+
it('responds to hover y+text', function() {
216+
Fx.hover('graph', evt, 'xy');
217+
218+
expect(d3.selectAll('g.hovertext').selectAll('text.nums').node().innerHTML).toEqual('1e+9');
219+
});
220+
});
221+
202222
describe('hover info y+text', function() {
203223
var mockCopy = Lib.extendDeep({}, mock);
204224

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.