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

add 'tickformatstops' #1965

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

Merged
merged 17 commits into from
Oct 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
robustify tickformatstops supplydefaults
  • Loading branch information
alexcjohnson committed Oct 9, 2017
commit 0b48a3380376438a1b8821789e42f8e1106858c5
8 changes: 4 additions & 4 deletions 8 src/plots/cartesian/tick_label_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ function getShowAttrDflt(containerIn) {
}

function tickformatstopsDefaults(tickformatIn, tickformatOut) {
var valuesIn = tickformatIn.tickformatstops || [],
valuesOut = tickformatOut.tickformatstops = [];
var valuesIn = tickformatIn.tickformatstops;
var valuesOut = tickformatOut.tickformatstops = [];

if(!Array.isArray(valuesIn)) return;

var valueIn, valueOut;

Expand All @@ -101,6 +103,4 @@ function tickformatstopsDefaults(tickformatIn, tickformatOut) {

valuesOut.push(valueOut);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nicely done. Thanks!

🎉

}

return valuesOut;
}
15 changes: 15 additions & 0 deletions 15 test/jasmine/tests/tickformatstops_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,19 @@ describe('Test tickformatstops:', function() {
.then(done);
});

it('doesn\'t fail on bad input', function(done) {
var promise = Plotly.plot(gd, mockCopy.data, mockCopy.layout);

[1, {a: 1, b: 2}, 'boo'].forEach(function(v) {
promise = promise.then(function() {
return Plotly.relayout(gd, {'xaxis.tickformatstops': v});
}).then(function() {
expect(gd._fullLayout.xaxis.tickformatstops).toEqual([]);
});
});

promise
.catch(fail)
.then(done);
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.