Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix hovermode default logic for stacked scatter traces#3646

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
etpinard merged 1 commit intomasterfromisHoriz-fix-for-stacked-scatter-traces
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletionssrc/components/fx/layout_defaults.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
} else {
// flag for 'horizontal' plots:
// determines the state of the mode bar 'compare' hovermode button
layoutOut._isHoriz = isHoriz(fullData);
layoutOut._isHoriz = isHoriz(fullData, layoutOut);
hovermodeDflt = layoutOut._isHoriz ? 'y' : 'x';
}
}
Expand All@@ -55,17 +55,19 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
}
};

function isHoriz(fullData) {
varout =true;
function isHoriz(fullData, fullLayout) {
varstackOpts =fullLayout._scatterStackOpts || {};

for(var i = 0; i < fullData.length; i++) {
var trace = fullData[i];
var subplot = trace.xaxis + trace.yaxis;
var subplotStackOpts = stackOpts[subplot] || {};
var groupOpts = subplotStackOpts[trace.stackgroup] || {};

if(trace.orientation !== 'h') {
out = false;
break;
if(trace.orientation !== 'h' && groupOpts.orientation !== 'h') {
return false;
}
}

returnout;
returntrue;
}
18 changes: 18 additions & 0 deletionstest/jasmine/tests/fx_test.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,6 +58,24 @@ describe('Fx defaults', function() {
expect(layoutOut._isHoriz).toBe(true, 'isHoriz to true');
});

it('should default (cartesian horizontal version, stacked scatter)', function() {
var layoutOut = _supply([{
orientation: 'h',
stackgroup: '1',
x: [1, 2, 3],
y: [1, 2, 1]
}, {
stackgroup: '1',
x: [1, 2, 3],
y: [1, 2, 1]
}])
.layout;

expect(layoutOut.hovermode).toBe('y', 'hovermode to y');
expect(layoutOut.dragmode).toBe('zoom', 'dragmode to zoom');
expect(layoutOut._isHoriz).toBe(true, 'isHoriz to true');
});

it('should default (gl3d version)', function() {
var layoutOut = _supply([{
type: 'scatter3d',
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp