-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Sankey feature branch #1591
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
Sankey feature branch #1591
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1656c5b
squashed Sankey feature branch for 1st look
monfera e7892fe
PR feedback and other updates to Sankey
monfera 65b2d57
fix up bundle files
monfera aa41f28
removed colorbar leftover
monfera dec701a
unit shown in attribute doc
monfera 1fb7cbd
removed vestigial attribs
monfera 426b50d
flipping attrib representation to columnar
monfera dab87ae
circularity detection
monfera fdf9849
Revert "removed colorbar leftover"
monfera 62257b4
restore dist to what was before
monfera 4ea240f
mock update
monfera 4e98b12
working around image gen sensitivity
monfera 747eb23
Alex's suggestion for checking self-links too
monfera 1cbc2f2
attribute work:
monfera e69e3a2
attribute work:
monfera 90c003a
having published our d3-sankey fork under the @plotly scope
monfera 3d10714
using traceOut in defaults for downstream default generation
monfera a2a416e
jasmine tests for Sankey
monfera 3e2a455
jasmine tests for Sankey - warning / error test (and defaults.js improv)
monfera b91aa25
default empty arrays in attributes.js
monfera 223421e
warning message update (PR feedback, thanks Alex!)
monfera 4c3521a
removed unused colorbar
monfera af1c43b
PR feedback: noOpacity; no need to add toSVG; no empty line after fun…
monfera 9214c92
PR feedback: moved circularity check into calc.js
monfera aa83612
PR feedback: testing lifecycle methods and visible; file rename
monfera 7427284
PR feedback: hover tooltip tests; switching to addTraces
monfera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
var Plotly = require('@lib/index'); | ||
var attributes = require('@src/traces/sankey/attributes'); | ||
var Lib = require('@src/lib'); | ||
var mock = require('@mocks/energy.json'); | ||
var d3 = require('d3'); | ||
var mock = require('@mocks/sankey_energy.json'); | ||
var mockDark = require('@mocks/sankey_energy_dark.json'); | ||
var Plots = require('@src/plots/plots'); | ||
var Sankey = require('@src/traces/sankey'); | ||
|
||
var createGraphDiv = require('../assets/create_graph_div'); | ||
var destroyGraphDiv = require('../assets/destroy_graph_div'); | ||
|
||
describe('sankey tests', function() { | ||
|
||
'use strict'; | ||
|
@@ -248,4 +254,61 @@ describe('sankey tests', function() { | |
}); | ||
}); | ||
}); | ||
|
||
describe('lifecycle methods', function() { | ||
|
||
afterEach(destroyGraphDiv); | ||
|
||
it('Plotly.deleteTraces with two traces removes the deleted plot', function(done) { | ||
|
||
var gd = createGraphDiv(); | ||
var mockCopy = Lib.extendDeep({}, mock); | ||
var mockCopy2 = Lib.extendDeep({}, mockDark); | ||
|
||
Plotly.plot(gd, mockCopy) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
expect(d3.selectAll('.sankey').size()).toEqual(1); | ||
return Plotly.plot(gd, mockCopy2); | ||
}) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(2); | ||
expect(d3.selectAll('.sankey').size()).toEqual(2); | ||
return Plotly.deleteTraces(gd, [0]); | ||
}) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
expect(d3.selectAll('.sankey').size()).toEqual(1); | ||
return Plotly.deleteTraces(gd, 0); | ||
}) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(0); | ||
expect(d3.selectAll('.sankey').size()).toEqual(0); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Plotly.plot does not show Sankey if \'visible\' is false', function(done) { | ||
|
||
var gd = createGraphDiv(); | ||
var mockCopy = Lib.extendDeep({}, mock); | ||
|
||
Plotly.plot(gd, mockCopy) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good! |
||
.then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
expect(d3.selectAll('.sankey').size()).toEqual(1); | ||
return Plotly.restyle(gd, 'visible', false); | ||
}) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
expect(d3.selectAll('.sankey').size()).toEqual(0); | ||
return Plotly.restyle(gd, 'visible', true); | ||
}) | ||
.then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
expect(d3.selectAll('.sankey').size()).toEqual(1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing
addTraces
would be better. SequentialPlotly.plot
calls is a deprecated pattern.