-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix bar lengths in milliseconds from base #4900
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4a0b877
add image test for bar with x in milisecond and base
archmoj 2087766
fix milliseconds not to depend on timezone
archmoj 6155965
apply UTC time only to bar length for now
archmoj 118dc82
add Gantt chart mock
archmoj bff79dc
add jasmine test to lock down issue 4558
archmoj 2ae0fdf
fixups thanks to AJ review
archmoj bb5bec3
add simple early return
archmoj 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"base": [ | ||
"2020-02-02 00:00" | ||
], | ||
"orientation": "h", | ||
"type": "bar", | ||
"x": [ | ||
86400000 | ||
], | ||
"y": [ | ||
1 | ||
], | ||
"yaxis": "y" | ||
}, | ||
{ | ||
"base": [ | ||
"2020-02-02 00:00" | ||
], | ||
"orientation": "h", | ||
"type": "bar", | ||
"x": [ | ||
"1970-01-02 00:00" | ||
], | ||
"y": [ | ||
1 | ||
], | ||
"yaxis": "y2" | ||
} | ||
], | ||
"layout": { | ||
"width": 800, | ||
"height": 400, | ||
"xaxis": { | ||
"type": "date" | ||
}, | ||
"yaxis": { | ||
"domain": [ | ||
0, | ||
0.45 | ||
] | ||
}, | ||
"yaxis2": { | ||
"domain": [ | ||
0.55, | ||
1 | ||
] | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"base": [ | ||
"2020-03-01", | ||
"2020-03-05", | ||
"2020-03-05", | ||
"2020-03-01", | ||
"2020-03-06", | ||
"2020-03-01", | ||
"2020-03-07", | ||
"2020-03-08", | ||
"2020-03-09" | ||
], | ||
"orientation": "h", | ||
"type": "bar", | ||
"x": [ | ||
345600000, | ||
172800000, | ||
259200000, | ||
432000000, | ||
86400000, | ||
518400000, | ||
302400000, | ||
86400000, | ||
172800000 | ||
], | ||
"marker": { | ||
"colorscale": "Portland", | ||
"color": [ | ||
1, | ||
0, | ||
1, | ||
0, | ||
0, | ||
0.9, | ||
0.3, | ||
1, | ||
1 | ||
] | ||
}, | ||
"y": [ | ||
"Activity A", | ||
"Activity B", | ||
"Activity C", | ||
"Activity D", | ||
"Activity E", | ||
"Activity F", | ||
"Activity X", | ||
"Activity Y", | ||
"Activity Z" | ||
], | ||
"text": [ | ||
"4 days", | ||
"2 days", | ||
"3 days", | ||
"5 days", | ||
"1 day", | ||
"6 days", | ||
"3½ days", | ||
"1 day", | ||
"2 days" | ||
], | ||
"textfont": { "size": 16 }, | ||
"textposition": "inside", | ||
"insidetextanchor": "middle", | ||
"hovertemplate": "%{y}<br>start: %{base}<br>duration: %{text}<br>end: %{x}" | ||
} | ||
], | ||
"layout": { | ||
"width": 1000, | ||
"height": 500, | ||
"title": { | ||
"text": "Gantt chart using Plotly.js bar" | ||
}, | ||
"xaxis": { | ||
"gridwidth": 5, | ||
"tickwidth": 5, | ||
"ticklen": 10, | ||
"type": "date" | ||
}, | ||
"yaxis": { | ||
"tickfont": { | ||
"family": "Times New Roman", | ||
"size": 16 | ||
}, | ||
"autorange": "reversed" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2600,6 +2600,26 @@ describe('bar hover', function() { | |
}); | ||
}); | ||
}); | ||
|
||
describe('gantt chart using milliseconds from base', function() { | ||
beforeAll(function(done) { | ||
gd = createGraphDiv(); | ||
|
||
var mock = Lib.extendDeep({}, require('@mocks/bar-with-milliseconds.json')); | ||
|
||
Plotly.newPlot(gd, mock.data, mock.layout) | ||
.catch(failTest) | ||
.then(done); | ||
}); | ||
|
||
it('should display the correct bar length passed in milliseconds from base', function() { | ||
var out = _hover(gd, 0.5, 0.75, 'y'); | ||
|
||
var xEnd = out.style[2]; | ||
expect(xEnd).not.toBe(1580670000000); | ||
expect(xEnd).toBe(1580688000000); | ||
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. If you're testing 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. Just to ensure no one change the test. |
||
}); | ||
}); | ||
}); | ||
|
||
describe('Text templates on bar traces:', function() { | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.