Skip to content
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

Histogram autobin #3044

Merged
merged 10 commits into from
Oct 4, 2018
14 changes: 7 additions & 7 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,17 +438,17 @@ plots.supplyDefaults = function(gd, opts) {
plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData);

// Special cases that introduce interactions between traces.
// This is after relinkPrivateKeys so we can use those in cleanData
// This is after relinkPrivateKeys so we can use those in crossTraceDefaults
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grepping for cleanData in streambed, I found:

image

@VeraZab does this ring a bell? Is that line still getting used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 157351 - looks like it's pulling in a whole plotly.js bundle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👁️ , false alarm.

// and after layout module defaults, so we can use eg barmode
var _modules = newFullLayout._visibleModules;
var cleanDataFuncs = [];
var crossTraceDefaultsFuncs = [];
for(i = 0; i < _modules.length; i++) {
var _module = _modules[i];
// some trace types share cleanData (ie histogram2d, histogram2dcontour)
if(_module.cleanData) Lib.pushUnique(cleanDataFuncs, _module.cleanData);
var funci = _modules[i].crossTraceDefaults;
// some trace types share crossTraceDefaults (ie histogram2d, histogram2dcontour)
if(funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci);
}
for(i = 0; i < cleanDataFuncs.length; i++) {
cleanDataFuncs[i](newFullData, newFullLayout);
for(i = 0; i < crossTraceDefaultsFuncs.length; i++) {
crossTraceDefaultsFuncs[i](newFullData, newFullLayout);
}

// turn on flag to optimize large splom-only graphs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var BINATTRS = {
};

// handle bin attrs and relink auto-determined values so fullData is complete
module.exports = function cleanData(fullData, fullLayout) {
module.exports = function crossTraceDefaults(fullData, fullLayout) {
var allBinOpts = fullLayout._histogramBinOpts = {};
var isOverlay = fullLayout.barmode === 'overlay';
var i, j, traceOut, traceIn, binDirection, group, binOpts;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/histogram/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
if(hasAggregationData) coerce('histfunc');
coerce('histnorm');

// Note: bin defaults are now handled in Histogram.cleanData
// Note: bin defaults are now handled in Histogram.crossTraceDefaults
// autobin(x|y) are only included here to appease Plotly.validate
coerce('autobin' + sampleLetter);

Expand Down
2 changes: 1 addition & 1 deletion src/traces/histogram/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var Histogram = {};
Histogram.attributes = require('./attributes');
Histogram.layoutAttributes = require('../bar/layout_attributes');
Histogram.supplyDefaults = require('./defaults');
Histogram.cleanData = require('./clean_data');
Histogram.crossTraceDefaults = require('./cross_trace_defaults');
Histogram.supplyLayoutDefaults = require('../bar/layout_defaults');
Histogram.calc = require('./calc');
Histogram.crossTraceCalc = require('../bar/cross_trace_calc').crossTraceCalc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var BINDIRECTIONS = ['x', 'y'];
// Handle bin attrs and relink auto-determined values so fullData is complete
// does not have cross-trace coupling, but moved out here so we have axis types
// and relinked trace._autoBin
module.exports = function cleanData(fullData, fullLayout) {
module.exports = function crossTraceDefaults(fullData, fullLayout) {
var i, j, traceOut, binDirection;

function coerce(attr) {
Expand Down
2 changes: 1 addition & 1 deletion src/traces/histogram2d/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Histogram2D = {};

Histogram2D.attributes = require('./attributes');
Histogram2D.supplyDefaults = require('./defaults');
Histogram2D.cleanData = require('./clean_data');
Histogram2D.crossTraceDefaults = require('./cross_trace_defaults');
Histogram2D.calc = require('../heatmap/calc');
Histogram2D.plot = require('../heatmap/plot');
Histogram2D.layerName = 'heatmaplayer';
Expand Down
2 changes: 1 addition & 1 deletion src/traces/histogram2d/sample_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout
if(hasAggregationData) coerce('histfunc');
coerce('histnorm');

// Note: bin defaults are now handled in Histogram2D.cleanData
// Note: bin defaults are now handled in Histogram2D.crossTraceDefaults
// autobin(x|y) are only included here to appease Plotly.validate
coerce('autobinx');
coerce('autobiny');
Expand Down
2 changes: 1 addition & 1 deletion src/traces/histogram2dcontour/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Histogram2dContour = {};

Histogram2dContour.attributes = require('./attributes');
Histogram2dContour.supplyDefaults = require('./defaults');
Histogram2dContour.cleanData = require('../histogram2d/clean_data');
Histogram2dContour.crossTraceDefaults = require('../histogram2d/cross_trace_defaults');
Histogram2dContour.calc = require('../contour/calc');
Histogram2dContour.plot = require('../contour/plot').plot;
Histogram2dContour.layerName = 'contourlayer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


// remove opacity for any trace that has a fill or is filled to
module.exports = function cleanData(fullData) {
module.exports = function crossTraceDefaults(fullData) {
for(var i = 0; i < fullData.length; i++) {
var tracei = fullData[i];
if(tracei.type !== 'scatter') continue;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/scatter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Scatter.isBubble = subtypes.isBubble;

Scatter.attributes = require('./attributes');
Scatter.supplyDefaults = require('./defaults');
Scatter.cleanData = require('./clean_data');
Scatter.crossTraceDefaults = require('./cross_trace_defaults');
Scatter.calc = require('./calc').calc;
Scatter.crossTraceCalc = require('./cross_trace_calc');
Scatter.arraysToCalcdata = require('./arrays_to_calcdata');
Expand Down
2 changes: 1 addition & 1 deletion src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ module.exports = {

attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
cleanData: require('../scatter/clean_data'),
crossTraceDefaults: require('../scatter/cross_trace_defaults'),
colorbar: require('../scatter/marker_colorbar'),
calc: calc,
plot: plot,
Expand Down