-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Load plotly.js from plotly.py #2610
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
17 commits
Select commit
Hold shift + click to select a range
5d632f6
Load plotly.js from plotly.py
T4rk1n 72ac574
External plotly.js from cdn.plot.ly
T4rk1n 57ae31b
New plotlyjs external_url
T4rk1n 6f94f38
Fix test tooltip
T4rk1n 9c6aebd
Fix test_scripts
T4rk1n e03eacb
Fix test old dcc
T4rk1n 5374e93
Merge branch 'dev' into feat/pjs-from-ppy
T4rk1n 4c2bcff
fix test_grva002
T4rk1n 09f5171
Merge branch 'dev' into feat/pjs-from-ppy
T4rk1n 79ee66f
Merge branch 'dev' into feat/pjs-from-ppy
T4rk1n d501d63
Merge branch 'dev' into feat/pjs-from-ppy
T4rk1n 81d2c52
Fix plotly.js url on the window at initial mount.
T4rk1n 91f6c2c
Delay get plotlyjs version
T4rk1n 32cbddf
Update changelog.
T4rk1n b5ae1fc
Remove async-plotlyjs from js_dist.
T4rk1n 5ec9eb8
Remove plotly.js from dcc node modules.
T4rk1n f3f03cd
build
T4rk1n 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
"test": "run-s -c lint test:intg test:pyimport", | ||
"test:intg": "pytest --nopercyfinalize --headless tests/integration ", | ||
"test:pyimport": "python -m unittest tests/test_dash_import.py", | ||
"prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js", | ||
"build:js": "webpack --mode production", | ||
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json -k RangeSlider,Slider,Dropdown,RadioItems,Checklist,DatePickerSingle,DatePickerRange,Input,Link --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components", | ||
"build": "run-s prepublishOnly build:js build:backends", | ||
|
@@ -49,7 +48,6 @@ | |
"mathjax": "^3.2.2", | ||
"moment": "^2.29.4", | ||
"node-polyfill-webpack-plugin": "^2.0.1", | ||
"plotly.js-dist-min": "2.25.2", | ||
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. Good call! |
||
"prop-types": "^15.8.1", | ||
"ramda": "^0.29.0", | ||
"rc-slider": "^9.7.5", | ||
|
29 changes: 24 additions & 5 deletions
29
components/dash-core-components/src/utils/LazyLoader/plotly.js
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,6 +1,25 @@ | ||
export default () => Promise.resolve(window.Plotly || | ||
import(/* webpackChunkName: "plotlyjs" */ 'plotly.js-dist-min').then(({ default: Plotly }) => { | ||
window.Plotly = Plotly; | ||
return Plotly; | ||
})); | ||
export default () => { | ||
return Promise.resolve(window.Plotly || new Promise((resolve, reject) => { | ||
/* eslint-disable prefer-const */ | ||
let timeoutId; | ||
|
||
const element = document.createElement('script'); | ||
element.src = window._dashPlotlyJSURL; | ||
element.async = true; | ||
element.onload = () => { | ||
clearTimeout(timeoutId); | ||
resolve(); | ||
}; | ||
element.onerror = (error) => { | ||
clearTimeout(timeoutId); | ||
reject(error); | ||
}; | ||
|
||
timeoutId = setTimeout(() => { | ||
element.src = ''; | ||
reject(new Error(`plotly.js did not load after 30 seconds`)); | ||
}, 3 * 10 * 1000); | ||
|
||
document.querySelector('body').appendChild(element); | ||
})); | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ def filter_dir(package): | |
"package_name", | ||
"f", | ||
"express", | ||
"get_plotlyjs_version", | ||
] | ||
return sorted( | ||
[ | ||
|
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.
Can we also delete the following two entries,
async-plotlyjs.js
and its.map
? And I guess we can remove theprebuild:js
command in dcc'spackage.json
that creates theplotly.min.js
file referenced here, right?