Skip to content

Commit 4382fc7

Browse files
committed
Merge branch 'master' into scatterpolargl-2-scatterpolar
2 parents cab319d + 7ae6fd6 commit 4382fc7

File tree

80 files changed

+628
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+628
-153
lines changed

Diff for: .circleci/config.yml

+27
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
command: ./.circleci/test.sh image
8989
- store_artifacts:
9090
path: build
91+
destination: /
9192

9293
test-image2:
9394
docker:
@@ -107,6 +108,7 @@ jobs:
107108
command: ./.circleci/test.sh image2
108109
- store_artifacts:
109110
path: build
111+
destination: /
110112

111113
test-syntax:
112114
docker:
@@ -120,6 +122,24 @@ jobs:
120122
name: Run syntax tests
121123
command: ./.circleci/test.sh syntax
122124

125+
publish:
126+
docker:
127+
- image: circleci/node:10.9.0
128+
working_directory: ~/plotly.js
129+
steps:
130+
- checkout
131+
- attach_workspace:
132+
at: ~/plotly.js
133+
- store_artifacts:
134+
path: build/plotly.js
135+
destination: /plotly.js
136+
- store_artifacts:
137+
path: dist/plotly.min.js
138+
destination: /plotly.min.js
139+
- store_artifacts:
140+
path: dist/plot-schema.json
141+
destination: /plot-schema.json
142+
123143
workflows:
124144
version: 2
125145
build-and-test:
@@ -140,3 +160,10 @@ workflows:
140160
- test-syntax:
141161
requires:
142162
- build
163+
- publish:
164+
requires:
165+
- test-jasmine
166+
- test-jasmine2
167+
- test-image
168+
- test-image2
169+
- test-syntax

Diff for: devtools/test_dashboard/server.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var PORT = process.argv[2] || 3000;
1616
var server = http.createServer(ecstatic({
1717
root: constants.pathToRoot,
1818
cache: 0,
19-
gzip: true
19+
gzip: true,
20+
cors: true
2021
}));
2122

2223
// Make watchified bundle for plotly.js

Diff for: package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"gl-mat4": "^1.2.0",
7979
"gl-mesh3d": "^2.0.0",
8080
"gl-plot2d": "^1.3.1",
81-
"gl-plot3d": "^1.5.6",
81+
"gl-plot3d": "^1.5.10",
8282
"gl-pointcloud2d": "^1.0.1",
8383
"gl-scatter3d": "^1.0.11",
8484
"gl-select-box": "^1.0.2",

Diff for: src/lib/loggers.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,24 @@ loggers.error = function() {
6161
* apply like other functions do
6262
*/
6363
function apply(f, args) {
64-
if(f.apply) {
65-
f.apply(f, args);
64+
if(f && f.apply) {
65+
try {
66+
// `this` should always be console, since here we're always
67+
// applying a method of the console object.
68+
f.apply(console, args);
69+
return;
70+
}
71+
catch(e) { /* in case apply failed, fall back on the code below */ }
6672
}
67-
else {
68-
for(var i = 0; i < args.length; i++) {
73+
74+
// no apply - just try calling the function on each arg independently
75+
for(var i = 0; i < args.length; i++) {
76+
try {
6977
f(args[i]);
7078
}
79+
catch(e) {
80+
// still fails - last resort simple console.log
81+
console.log(args[i]);
82+
}
7183
}
7284
}

Diff for: src/lib/search.js

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ exports.roundUp = function(val, arrayIn, reverse) {
118118
/**
119119
* Tweak to Array.sort(sortFn) that improves performance for pre-sorted arrays
120120
*
121+
* Note that newer browsers (such as Chrome v70+) are starting to pick up
122+
* on pre-sorted arrays which may render the following optimization unnecessary
123+
* in the future.
124+
*
121125
* Motivation: sometimes we need to sort arrays but the input is likely to
122126
* already be sorted. Browsers don't seem to pick up on pre-sorted arrays,
123127
* and in fact Chrome is actually *slower* sorting pre-sorted arrays than purely

Diff for: src/plot_api/helpers.js

+11
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,17 @@ exports.coerceTraceIndices = function(gd, traceIndices) {
490490
else if(!Array.isArray(traceIndices) || !traceIndices.length) {
491491
return gd.data.map(function(_, i) { return i; });
492492
}
493+
else if(Array.isArray(traceIndices)) {
494+
var traceIndicesOut = [];
495+
for(var i = 0; i < traceIndices.length; i++) {
496+
if(Lib.isIndex(traceIndices[i], gd.data.length)) {
497+
traceIndicesOut.push(traceIndices[i]);
498+
} else {
499+
Lib.warn('trace index (', traceIndices[i], ') is not a number or is out of bounds');
500+
}
501+
}
502+
return traceIndicesOut;
503+
}
493504

494505
return traceIndices;
495506
};

Diff for: src/plot_api/plot_api.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -1922,8 +1922,24 @@ function _relayout(gd, aobj) {
19221922
// back to its initial value as computed during the first pass in Plots.plotAutoSize.
19231923
//
19241924
// To do so, we must manually set them back here using the _initialAutoSize cache.
1925-
if(['width', 'height'].indexOf(ai) !== -1 && vi === null) {
1926-
fullLayout[ai] = gd._initialAutoSize[ai];
1925+
// can't use impliedEdits for this because behavior depends on vi
1926+
if(['width', 'height'].indexOf(ai) !== -1) {
1927+
if(vi) {
1928+
doextra('autosize', null);
1929+
// currently we don't support autosize one dim only - so
1930+
// explicitly set the other one. Note that doextra will
1931+
// ignore this if the same relayout call also provides oppositeAttr
1932+
var oppositeAttr = ai === 'height' ? 'width' : 'height';
1933+
doextra(oppositeAttr, fullLayout[oppositeAttr]);
1934+
}
1935+
else {
1936+
fullLayout[ai] = gd._initialAutoSize[ai];
1937+
}
1938+
}
1939+
else if(ai === 'autosize') {
1940+
// depends on vi here too, so again can't use impliedEdits
1941+
doextra('width', vi ? null : fullLayout.width);
1942+
doextra('height', vi ? null : fullLayout.height);
19271943
}
19281944
// check autorange vs range
19291945
else if(pleafPlus.match(AX_RANGE_RE)) {
@@ -2625,6 +2641,7 @@ function diffConfig(oldConfig, newConfig) {
26252641
var key;
26262642

26272643
for(key in oldConfig) {
2644+
if(key.charAt(0) === '_') continue;
26282645
var oldVal = oldConfig[key];
26292646
var newVal = newConfig[key];
26302647
if(oldVal !== newVal) {

Diff for: src/plot_api/template_api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var dfltConfig = require('./plot_config');
3131
* `layout.template` in another figure.
3232
*/
3333
exports.makeTemplate = function(figure) {
34-
figure = Lib.extendDeep({_context: dfltConfig}, figure);
34+
figure = Lib.extendDeep({_context: dfltConfig}, {data: figure.data, layout: figure.layout});
3535
Plots.supplyDefaults(figure);
3636
var data = figure.data || [];
3737
var layout = figure.layout || {};

Diff for: src/plots/gl3d/layout/convert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ function AxesOptions() {
3232
this.labelEnable = [ true, true, true ];
3333
this.labelFont = ['Open Sans', 'Open Sans', 'Open Sans'];
3434
this.labelSize = [ 20, 20, 20 ];
35-
this.labelAngle = [ 0, 0, 0 ];
3635
this.labelColor = [ [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1] ];
3736
this.labelPad = [ 30, 30, 30 ];
3837

@@ -119,9 +118,10 @@ proto.merge = function(sceneLayout) {
119118
if('tickwidth' in axes) opts.lineTickWidth[i] = axes.tickwidth;
120119
if('tickangle' in axes) {
121120
opts.tickAngle[i] = (axes.tickangle === 'auto') ?
122-
0 :
121+
-3600 : // i.e. special number to set auto option
123122
Math.PI * -axes.tickangle / 180;
124123
}
124+
125125
// tick labels
126126
if('showticklabels' in axes) opts.tickEnable[i] = axes.showticklabels;
127127
if('tickfont' in axes) {

Diff for: src/plots/plots.js

+13
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
951951
fullTrace._expandedIndex = cnt;
952952

953953
if(fullTrace.transforms && fullTrace.transforms.length) {
954+
var sdInvisible = trace.visible !== false && fullTrace.visible === false;
955+
954956
var expandedTraces = applyTransforms(fullTrace, dataOut, layout, fullLayout);
955957

956958
for(var j = 0; j < expandedTraces.length; j++) {
@@ -964,6 +966,17 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
964966
// to promote consistency between update calls
965967
uid: fullTrace.uid + j
966968
};
969+
970+
// If the first supplyDefaults created `visible: false`,
971+
// clear it before running supplyDefaults a second time,
972+
// because sometimes there are items we still want to coerce
973+
// inside trace modules before determining that the trace is
974+
// again `visible: false`, for example partial visibilities
975+
// in `splom` traces.
976+
if(sdInvisible && expandedTrace.visible === false) {
977+
delete expandedTrace.visible;
978+
}
979+
967980
plots.supplyTraceDefaults(expandedTrace, fullExpandedTrace, cnt, fullLayout, i);
968981

969982
// relink private (i.e. underscore) keys expanded trace to full expanded trace so

Diff for: src/plots/polar/layout_defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
5151
}
5252

5353
var axIn = contIn[axName];
54-
var axOut = contOut[axName] = Template.newContainer(contOut, axName);
54+
var axOut = Template.newContainer(contOut, axName);
5555
axOut._id = axOut._name = axName;
5656
axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; });
5757

Diff for: src/traces/carpet/ab_defaults.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'use strict';
1010

1111
var handleAxisDefaults = require('./axis_defaults');
12+
var Template = require('../../plot_api/plot_template');
1213

1314
module.exports = function handleABDefaults(traceIn, traceOut, fullLayout, coerce, dfltColor) {
1415
var a = coerce('a');
@@ -34,7 +35,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
3435
axesList.forEach(function(axName) {
3536
var axLetter = axName.charAt(0);
3637
var axIn = traceIn[axName] || {};
37-
var axOut = {};
38+
var axOut = Template.newContainer(traceOut, axName);
3839

3940
var defaultOptions = {
4041
tickfont: 'x',
@@ -50,11 +51,8 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
5051
};
5152

5253
handleAxisDefaults(axIn, axOut, defaultOptions);
53-
5454
axOut._categories = axOut._categories || [];
5555

56-
traceOut[axName] = axOut;
57-
5856
// so we don't have to repeat autotype unnecessarily,
5957
// copy an autotype back to traceIn
6058
if(!traceIn[axName] && axIn.type !== '-') {

Diff for: src/traces/parcoords/parcoords.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,18 @@ module.exports = function(root, svg, parcoordsLineLayers, styledData, layout, ca
456456

457457
parcoordsLineLayer
458458
.each(function(d) {
459+
459460
if(d.viewModel) {
460461
if(d.lineLayer) d.lineLayer.update(d);
461462
else d.lineLayer = lineLayerMaker(this, d);
462463

463464
d.viewModel[d.key] = d.lineLayer;
464-
d.lineLayer.render(d.viewModel.panels, !d.context);
465+
466+
var setChanged = ((d.key) &&
467+
(((d.key !== 'contextLayer') || (callbacks)) || // unless there is callback on this line layer
468+
(!d.context))); // don't update background
469+
470+
d.lineLayer.render(d.viewModel.panels, setChanged);
465471
}
466472
});
467473

Diff for: src/traces/sankey/attributes.js

+28-8
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@
99
'use strict';
1010

1111
var fontAttrs = require('../../plots/font_attributes');
12-
var plotAttrs = require('../../plots/attributes');
1312
var colorAttrs = require('../../components/color/attributes');
1413
var fxAttrs = require('../../components/fx/attributes');
1514
var domainAttrs = require('../../plots/domain').attributes;
1615

17-
var extendFlat = require('../../lib/extend').extendFlat;
1816
var overrideAll = require('../../plot_api/edit_types').overrideAll;
1917

20-
module.exports = overrideAll({
21-
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
22-
flags: ['label', 'text', 'value', 'percent', 'name'],
23-
}),
24-
hoverlabel: fxAttrs.hoverlabel, // needs editType override
25-
18+
var attrs = module.exports = overrideAll({
2619
domain: domainAttrs({name: 'sankey', trace: true}),
2720

2821
orientation: {
@@ -127,6 +120,18 @@ module.exports = overrideAll({
127120
role: 'style',
128121
description: 'Sets the thickness (in px) of the `nodes`.'
129122
},
123+
hoverinfo: {
124+
valType: 'enumerated',
125+
values: ['all', 'none', 'skip'],
126+
dflt: 'all',
127+
role: 'info',
128+
description: [
129+
'Determines which trace information appear when hovering nodes.',
130+
'If `none` or `skip` are set, no information is displayed upon hovering.',
131+
'But, if `none` is set, click and hover events are still fired.'
132+
].join(' ')
133+
},
134+
hoverlabel: fxAttrs.hoverlabel, // needs editType override,
130135
description: 'The nodes of the Sankey plot.'
131136
},
132137

@@ -185,6 +190,21 @@ module.exports = overrideAll({
185190
role: 'info',
186191
description: 'A numeric value representing the flow volume value.'
187192
},
193+
hoverinfo: {
194+
valType: 'enumerated',
195+
values: ['all', 'none', 'skip'],
196+
dflt: 'all',
197+
role: 'info',
198+
description: [
199+
'Determines which trace information appear when hovering links.',
200+
'If `none` or `skip` are set, no information is displayed upon hovering.',
201+
'But, if `none` is set, click and hover events are still fired.'
202+
].join(' ')
203+
},
204+
hoverlabel: fxAttrs.hoverlabel, // needs editType override,
188205
description: 'The links of the Sankey plot.'
189206
}
190207
}, 'calc', 'nested');
208+
// hide unsupported top-level properties from plot-schema
209+
attrs.hoverinfo = undefined;
210+
attrs.hoverlabel = undefined;

0 commit comments

Comments
 (0)