Skip to content

Refactor traces index exports #3804

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 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 34 additions & 36 deletions src/traces/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,39 @@

'use strict';

var Box = {};
module.exports = {
attributes: require('./attributes'),
layoutAttributes: require('./layout_attributes'),
supplyDefaults: require('./defaults').supplyDefaults,
crossTraceDefaults: require('./defaults').crossTraceDefaults,
supplyLayoutDefaults: require('./layout_defaults').supplyLayoutDefaults,
calc: require('./calc'),
crossTraceCalc: require('./cross_trace_calc').crossTraceCalc,
plot: require('./plot').plot,
style: require('./style').style,
styleOnSelect: require('./style').styleOnSelect,
hoverPoints: require('./hover').hoverPoints,
eventData: require('./event_data'),
selectPoints: require('./select'),

Box.attributes = require('./attributes');
Box.layoutAttributes = require('./layout_attributes');
Box.supplyDefaults = require('./defaults').supplyDefaults;
Box.crossTraceDefaults = require('./defaults').crossTraceDefaults;
Box.supplyLayoutDefaults = require('./layout_defaults').supplyLayoutDefaults;
Box.calc = require('./calc');
Box.crossTraceCalc = require('./cross_trace_calc').crossTraceCalc;
Box.plot = require('./plot').plot;
Box.style = require('./style').style;
Box.styleOnSelect = require('./style').styleOnSelect;
Box.hoverPoints = require('./hover').hoverPoints;
Box.eventData = require('./event_data');
Box.selectPoints = require('./select');

Box.moduleType = 'trace';
Box.name = 'box';
Box.basePlotModule = require('../../plots/cartesian');
Box.categories = ['cartesian', 'svg', 'symbols', 'oriented', 'box-violin', 'showLegend', 'boxLayout', 'zoomScale'];
Box.meta = {
description: [
'In vertical (horizontal) box plots,',
'statistics are computed using `y` (`x`) values.',
'By supplying an `x` (`y`) array, one box per distinct x (y) value',
'is drawn',
'If no `x` (`y`) {array} is provided, a single box is drawn.',
'That box position is then positioned with',
'with `name` or with `x0` (`y0`) if provided.',
'Each box spans from quartile 1 (Q1) to quartile 3 (Q3).',
'The second quartile (Q2) is marked by a line inside the box.',
'By default, the whiskers correspond to the box\' edges',
'+/- 1.5 times the interquartile range (IQR = Q3-Q1),',
'see *boxpoints* for other options.'
].join(' ')
moduleType: 'trace',
name: 'box',
basePlotModule: require('../../plots/cartesian'),
categories: ['cartesian', 'svg', 'symbols', 'oriented', 'box-violin', 'showLegend', 'boxLayout', 'zoomScale'],
meta: {
description: [
'In vertical (horizontal) box plots,',
'statistics are computed using `y` (`x`) values.',
'By supplying an `x` (`y`) array, one box per distinct x (y) value',
'is drawn',
'If no `x` (`y`) {array} is provided, a single box is drawn.',
'That box position is then positioned with',
'with `name` or with `x0` (`y0`) if provided.',
'Each box spans from quartile 1 (Q1) to quartile 3 (Q3).',
'The second quartile (Q2) is marked by a line inside the box.',
'By default, the whiskers correspond to the box\' edges',
'+/- 1.5 times the interquartile range (IQR: Q3-Q1),',
'see *boxpoints* for other options.'
].join(' ')
}
};

module.exports = Box;
45 changes: 21 additions & 24 deletions src/traces/carpet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,29 @@
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var Carpet = {};

Carpet.attributes = require('./attributes');
Carpet.supplyDefaults = require('./defaults');
Carpet.plot = require('./plot');
Carpet.calc = require('./calc');
Carpet.animatable = true;
Carpet.isContainer = true; // so carpet traces get `calc` before other traces
module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
plot: require('./plot'),
calc: require('./calc'),
animatable: true,
isContainer: true, // so carpet traces get `calc` before other traces

Carpet.moduleType = 'trace';
Carpet.name = 'carpet';
Carpet.basePlotModule = require('../../plots/cartesian');
Carpet.categories = ['cartesian', 'svg', 'carpet', 'carpetAxis', 'notLegendIsolatable', 'noMultiCategory'];
Carpet.meta = {
description: [
'The data describing carpet axis layout is set in `y` and (optionally)',
'also `x`. If only `y` is present, `x` the plot is interpreted as a',
'cheater plot and is filled in using the `y` values.',
moduleType: 'trace',
name: 'carpet',
basePlotModule: require('../../plots/cartesian'),
categories: ['cartesian', 'svg', 'carpet', 'carpetAxis', 'notLegendIsolatable', 'noMultiCategory'],
meta: {
description: [
'The data describing carpet axis layout is set in `y` and (optionally)',
'also `x`. If only `y` is present, `x` the plot is interpreted as a',
'cheater plot and is filled in using the `y` values.',

'`x` and `y` may either be 2D arrays matching with each dimension matching',
'that of `a` and `b`, or they may be 1D arrays with total length equal to',
'that of `a` and `b`.'
].join(' ')
'`x` and `y` may either be 2D arrays matching with each dimension matching',
'that of `a` and `b`, or they may be 1D arrays with total length equal to',
'that of `a` and `b`.'
].join(' ')
}
};

module.exports = Carpet;
49 changes: 23 additions & 26 deletions src/traces/choropleth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,30 @@
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var Choropleth = {};

Choropleth.attributes = require('./attributes');
Choropleth.supplyDefaults = require('./defaults');
Choropleth.colorbar = require('../heatmap/colorbar');
Choropleth.calc = require('./calc');
Choropleth.plot = require('./plot');
Choropleth.style = require('./style').style;
Choropleth.styleOnSelect = require('./style').styleOnSelect;
Choropleth.hoverPoints = require('./hover');
Choropleth.eventData = require('./event_data');
Choropleth.selectPoints = require('./select');
module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
colorbar: require('../heatmap/colorbar'),
calc: require('./calc'),
plot: require('./plot'),
style: require('./style').style,
styleOnSelect: require('./style').styleOnSelect,
hoverPoints: require('./hover'),
eventData: require('./event_data'),
selectPoints: require('./select'),

Choropleth.moduleType = 'trace';
Choropleth.name = 'choropleth';
Choropleth.basePlotModule = require('../../plots/geo');
Choropleth.categories = ['geo', 'noOpacity'];
Choropleth.meta = {
description: [
'The data that describes the choropleth value-to-color mapping',
'is set in `z`.',
'The geographic locations corresponding to each value in `z`',
'are set in `locations`.'
].join(' ')
moduleType: 'trace',
name: 'choropleth',
basePlotModule: require('../../plots/geo'),
categories: ['geo', 'noOpacity'],
meta: {
description: [
'The data that describes the choropleth value-to-color mapping',
'is set in `z`.',
'The geographic locations corresponding to each value in `z`',
'are set in `locations`.'
].join(' ')
}
};

module.exports = Choropleth;
49 changes: 23 additions & 26 deletions src/traces/contour/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,31 @@
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var Contour = {};

Contour.attributes = require('./attributes');
Contour.supplyDefaults = require('./defaults');
Contour.calc = require('./calc');
Contour.plot = require('./plot').plot;
Contour.style = require('./style');
Contour.colorbar = require('./colorbar');
Contour.hoverPoints = require('./hover');
module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
calc: require('./calc'),
plot: require('./plot').plot,
style: require('./style'),
colorbar: require('./colorbar'),
hoverPoints: require('./hover'),

Contour.moduleType = 'trace';
Contour.name = 'contour';
Contour.basePlotModule = require('../../plots/cartesian');
Contour.categories = ['cartesian', 'svg', '2dMap', 'contour', 'showLegend'];
Contour.meta = {
description: [
'The data from which contour lines are computed is set in `z`.',
'Data in `z` must be a {2D array} of numbers.',
moduleType: 'trace',
name: 'contour',
basePlotModule: require('../../plots/cartesian'),
categories: ['cartesian', 'svg', '2dMap', 'contour', 'showLegend'],
meta: {
description: [
'The data from which contour lines are computed is set in `z`.',
'Data in `z` must be a {2D array} of numbers.',

'Say that `z` has N rows and M columns, then by default,',
'these N rows correspond to N y coordinates',
'(set in `y` or auto-generated) and the M columns',
'correspond to M x coordinates (set in `x` or auto-generated).',
'By setting `transpose` to *true*, the above behavior is flipped.'
].join(' ')
'Say that `z` has N rows and M columns, then by default,',
'these N rows correspond to N y coordinates',
'(set in `y` or auto-generated) and the M columns',
'correspond to M x coordinates (set in `x` or auto-generated).',
'By setting `transpose` to *true*, the above behavior is flipped.'
].join(' ')
}
};

module.exports = Contour;
42 changes: 20 additions & 22 deletions src/traces/contourcarpet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@

'use strict';

var ContourCarpet = {};
module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
colorbar: require('../contour/colorbar'),
calc: require('./calc'),
plot: require('./plot'),
style: require('../contour/style'),

ContourCarpet.attributes = require('./attributes');
ContourCarpet.supplyDefaults = require('./defaults');
ContourCarpet.colorbar = require('../contour/colorbar');
ContourCarpet.calc = require('./calc');
ContourCarpet.plot = require('./plot');
ContourCarpet.style = require('../contour/style');

ContourCarpet.moduleType = 'trace';
ContourCarpet.name = 'contourcarpet';
ContourCarpet.basePlotModule = require('../../plots/cartesian');
ContourCarpet.categories = ['cartesian', 'svg', 'carpet', 'contour', 'symbols', 'showLegend', 'hasLines', 'carpetDependent'];
ContourCarpet.meta = {
hrName: 'contour_carpet',
description: [
'Plots contours on either the first carpet axis or the',
'carpet axis with a matching `carpet` attribute. Data `z`',
'is interpreted as matching that of the corresponding carpet',
'axis.'
].join(' ')
moduleType: 'trace',
name: 'contourcarpet',
basePlotModule: require('../../plots/cartesian'),
categories: ['cartesian', 'svg', 'carpet', 'contour', 'symbols', 'showLegend', 'hasLines', 'carpetDependent'],
meta: {
hrName: 'contour_carpet',
description: [
'Plots contours on either the first carpet axis or the',
'carpet axis with a matching `carpet` attribute. Data `z`',
'is interpreted as matching that of the corresponding carpet',
'axis.'
].join(' ')
}
};

module.exports = ContourCarpet;
37 changes: 17 additions & 20 deletions src/traces/contourgl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,25 @@
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var overrideAll = require('../../plot_api/edit_types').overrideAll;

var ContourGl = {};

ContourGl.attributes = overrideAll(require('../contour/attributes'), 'calc', 'nested');
ContourGl.supplyDefaults = require('../contour/defaults');
ContourGl.colorbar = require('../contour/colorbar');

ContourGl.calc = require('../contour/calc');
ContourGl.plot = require('./convert');

ContourGl.moduleType = 'trace';
ContourGl.name = 'contourgl';
ContourGl.basePlotModule = require('../../plots/gl2d');
ContourGl.categories = ['gl', 'gl2d', '2dMap'];
ContourGl.meta = {
description: [
'WebGL contour (beta)'
].join(' ')
module.exports = {
attributes: overrideAll(require('../contour/attributes'), 'calc', 'nested'),
supplyDefaults: require('../contour/defaults'),
colorbar: require('../contour/colorbar'),

calc: require('../contour/calc'),
plot: require('./convert'),

moduleType: 'trace',
name: 'contourgl',
basePlotModule: require('../../plots/gl2d'),
categories: ['gl', 'gl2d', '2dMap'],
meta: {
description: [
'WebGL contour (beta)'
].join(' ')
}
};

module.exports = ContourGl;
Loading