Black Lives Matter. Please consider donating to Black Girls Code today.

Only scatter bundle

Hi folks,

the plotly basic bundle, with scatter, bar and pie is still very big.
Does somebody knows, how to custom bundle plotly with only scatter traces and how much smaller this would be?

Kind regards,
Zacharias

From https://github.com/plotly/plotly.js#modules, for example using CommonJS syntax:

// in custom-plotly.js
var Plotly = require('plotly.js/lib/core');

// this includes only the scatter trace module
module.exports = Plotly;

Then elsewhere in your code:

var Plotly = require('./path/to/custom-plotly');

Hello there,

I’m using plotly to build an RMARDOWN FLEXDASHBOARD, and I would like to improve its speed. I’ve read about the partial_bundle() function. Unfortunately, there’s no bundle defined for the traces I use: scatter, heatmat, and sunburst.

So I guess I should need to go this way, as seen in https://github.com/plotly/plotly.js#modules:

// in custom-plotly.js var Plotly = require(‘plotly.js/lib/core’);
// Load in the trace types
Plotly.register([
require(‘plotly.js/lib/scatter’),
require(‘plotly.js/lib/sunburst’)
require(‘plotly.js/lib/heatmap’)
]);
module.exports = Plotly;

Then elsewhere in your code:

var Plotly = require(’./path/to/custom-plotly’);

… Ooops…

I don’t know how to make that work!!! Must I include this in my Rmardown code? Or perform it somewhere else? Sorry, no experience with JavaScript!

Thanks a lot!
Alain.