Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayOk hoverinfo fixups #2055

Merged
merged 13 commits into from
Oct 5, 2017
Merged
2 changes: 1 addition & 1 deletion src/traces/scattercarpet/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
var tj = ij[1] - j0;

var xy = carpet.evalxy([], i0, j0, ti, tj);
text.push('y: ' + xy[1].toFixed(3));
text.push('y = ' + xy[1].toFixed(3));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @rreusser unless that y: was on purpose? This here turns it into y = just like the a = and b = rows

peek 2017-10-03 17-01

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most other places (heatmap/contour, 3d, ternary) we use : - perhaps we should standardize on that here too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thank you. That seems correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Haha, my mistake then. Perhaps it's the a/b = that are the odd ones out. Need to check the consistent choice here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, to be less vague, : seems correct. = seems incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 2fe641d


newPointData.extraText = text.join('<br>');

Expand Down
39 changes: 39 additions & 0 deletions test/jasmine/tests/carpet_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
var fail = require('../assets/fail_test');

var mouseEvent = require('../assets/mouse_event');
var assertHoverLabelContent = require('../assets/custom_assertions').assertHoverLabelContent;

describe('carpet supplyDefaults', function() {
'use strict';

Expand Down Expand Up @@ -565,3 +568,39 @@ describe('scattercarpet array attributes', function() {
.then(done);
});
});

describe('scattercarpet hover labels', function() {
var gd;

afterEach(destroyGraphDiv);

function run(pos, fig, content) {
gd = createGraphDiv();

return Plotly.plot(gd, fig).then(function() {
mouseEvent('mousemove', pos[0], pos[1]);
assertHoverLabelContent([content, null]);
});
}

it('should generate hover label (base)', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/scattercarpet.json'));

run(
[200, 200], fig,
[['a = 0.200', 'b = 3.500', 'y = 2.900'], 'a = 0.2']
)
.then(done);
});

it('should generate hover label with \'hoverinfo\' set', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/scattercarpet.json'));
fig.data[5].hoverinfo = 'a+y';

run(
[200, 200], fig,
[['a = 0.200', 'y = 2.900'], null]
)
.then(done);
});
});