-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Expose trace modules #202
Expose trace modules #202
Conversation
…to expose-trace-modules
We likely should add some tests for making sure the trace modules remain independent from one another. I'm not sure of a better way to do this other than to just have tests using custom bundles with a single trace, and testing accordingly. |
pinging @bpostlethwaite @alexcjohnson @cldougl @cpsievert @alexander-daniel This is a very important PR. |
@@ -1,4 +1,4 @@ | |||
var Plotly = require('@src'); | |||
var Plotly = require('@lib/index'); |
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.
Yes. We should test we expose to users. 🍻
outta the park! ⚾ 💃 |
- add modules to TOC - add info about version cdn URL - generalize path to `custom-plotly.js` - add info about cwise transform
Good additions to the README @etpinard . |
Hi guys. Thanks for the wonderful work. Please forgive my lack of experience with the build tools, but I can't wrap my head around this apparently simple process.
I have forked Plotly.js and checked out the sources, Question:
npm run-script bundle it always builds the standard plotly.js "fully-fledged" bundle. Again, sorry for my lack of experience in the field. Any help is greatly appreciated. Alessandro |
Hi Allesandro, To create your own bundle, you'll need to be making your own custom version within your own project. Ideally, you can make a new file somewhere in your own source directory, and inside it: // Load in the plotly core (named custom here because
// it's going to be our own custom build
var customPlotly = require('plotly.js/lib/core');
// load the traces you need
var pie = require('plotly.js/lib/pie');
// register the traces
customPlotly.register([pie]);
// export your custom plotly
module.exports = customPlotly; Then, wherever you need to use plotly, you would use:
Bear in mind that with this method, you still will need to use browserify or webpack to resolve the Hope that helps! |
Thanks! Yes, I read that, but i was assuming that there was something like: npm run-script bundle my-custom-plotly as npm run-script bundle |
Correct. There was discussion of a built-in tool for creating custom bundles, but ultimately we decided it best to leave the task to the end user - all the npm scripts included in plotly.js are for internal development use. |
Oh, I see. Thanks, I'll see what I can do starting from the internal scripts. It's all very new to me. Again, congrats for the tremendous job you did with Plotly. |
@mdtusz, thanks for the example. Is something like this possible for people using react-plotly.js? |
The trace modules now can all be registered using
Plotly.register
andrequire('plotly.js/lib/<TRACE_TYPE>');
.I've added a brief change to the readme, but we will need to add more detailed documentation on the main docs site as well.
The one issue that will remain here is the requirement for users to add
to their code to avoid errors with special characters used in d3.