plotly.js 1.52.1 → 1.52.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.fossa.yml +58 -0
  2. package/.ignore +3 -0
  3. package/CHANGELOG.md +21 -0
  4. package/dist/README.md +25 -25
  5. package/dist/plot-schema.json +8 -8
  6. package/dist/plotly-basic.js +187 -54
  7. package/dist/plotly-basic.min.js +2 -2
  8. package/dist/plotly-cartesian.js +187 -54
  9. package/dist/plotly-cartesian.min.js +2 -2
  10. package/dist/plotly-finance.js +187 -54
  11. package/dist/plotly-finance.min.js +2 -2
  12. package/dist/plotly-geo-assets.js +2 -2
  13. package/dist/plotly-geo.js +168 -49
  14. package/dist/plotly-geo.min.js +2 -2
  15. package/dist/plotly-gl2d.js +173 -51
  16. package/dist/plotly-gl2d.min.js +2 -2
  17. package/dist/plotly-gl3d.js +668 -449
  18. package/dist/plotly-gl3d.min.js +2 -2
  19. package/dist/plotly-mapbox.js +170 -50
  20. package/dist/plotly-mapbox.min.js +2 -2
  21. package/dist/plotly-with-meta.js +823 -533
  22. package/dist/plotly.js +814 -525
  23. package/dist/plotly.min.js +2 -2
  24. package/package.json +24 -23
  25. package/src/assets/geo_assets.js +1 -1
  26. package/src/components/annotations/attributes.js +1 -1
  27. package/src/core.js +1 -1
  28. package/src/lib/index.js +6 -3
  29. package/src/plot_api/subroutines.js +6 -0
  30. package/src/plot_api/validate.js +4 -3
  31. package/src/plots/cartesian/axes.js +6 -2
  32. package/src/plots/cartesian/constants.js +1 -2
  33. package/src/plots/cartesian/layout_defaults.js +112 -27
  34. package/src/plots/gl3d/scene.js +361 -323
  35. package/src/plots/layout_attributes.js +2 -2
  36. package/src/plots/mapbox/layers.js +2 -1
  37. package/src/plots/plots.js +30 -9
  38. package/src/traces/bar/hover.js +6 -1
  39. package/src/traces/bar/plot.js +13 -4
  40. package/src/traces/mesh3d/convert.js +9 -5
  41. package/src/traces/pie/attributes.js +7 -6
  42. package/src/traces/treemap/plot.js +2 -0
  43. package/tasks/test_syntax.js +1 -1
package/dist/plotly.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js v1.52.1
2
+ * plotly.js v1.52.2
3
3
  * Copyright 2012-2020, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -19044,12 +19044,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
19044
19044
  })));
19045
19045
 
19046
19046
  },{}],156:[function(_dereq_,module,exports){
19047
- // https://d3js.org/d3-color/ v1.2.3 Copyright 2018 Mike Bostock
19047
+ // https://d3js.org/d3-color/ v1.4.0 Copyright 2019 Mike Bostock
19048
19048
  (function (global, factory) {
19049
19049
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
19050
19050
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
19051
- (factory((global.d3 = global.d3 || {})));
19052
- }(this, (function (exports) { 'use strict';
19051
+ (global = global || self, factory(global.d3 = global.d3 || {}));
19052
+ }(this, function (exports) { 'use strict';
19053
19053
 
19054
19054
  function define(constructor, factory, prototype) {
19055
19055
  constructor.prototype = factory.prototype = prototype;
@@ -19070,8 +19070,7 @@ var brighter = 1 / darker;
19070
19070
  var reI = "\\s*([+-]?\\d+)\\s*",
19071
19071
  reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
19072
19072
  reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
19073
- reHex3 = /^#([0-9a-f]{3})$/,
19074
- reHex6 = /^#([0-9a-f]{6})$/,
19073
+ reHex = /^#([0-9a-f]{3,8})$/,
19075
19074
  reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
19076
19075
  reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
19077
19076
  reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
@@ -19231,29 +19230,46 @@ var named = {
19231
19230
  };
19232
19231
 
19233
19232
  define(Color, color, {
19233
+ copy: function(channels) {
19234
+ return Object.assign(new this.constructor, this, channels);
19235
+ },
19234
19236
  displayable: function() {
19235
19237
  return this.rgb().displayable();
19236
19238
  },
19237
- hex: function() {
19238
- return this.rgb().hex();
19239
- },
19240
- toString: function() {
19241
- return this.rgb() + "";
19242
- }
19239
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
19240
+ formatHex: color_formatHex,
19241
+ formatHsl: color_formatHsl,
19242
+ formatRgb: color_formatRgb,
19243
+ toString: color_formatRgb
19243
19244
  });
19244
19245
 
19246
+ function color_formatHex() {
19247
+ return this.rgb().formatHex();
19248
+ }
19249
+
19250
+ function color_formatHsl() {
19251
+ return hslConvert(this).formatHsl();
19252
+ }
19253
+
19254
+ function color_formatRgb() {
19255
+ return this.rgb().formatRgb();
19256
+ }
19257
+
19245
19258
  function color(format) {
19246
- var m;
19259
+ var m, l;
19247
19260
  format = (format + "").trim().toLowerCase();
19248
- return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00
19249
- : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
19261
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
19262
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
19263
+ : l === 8 ? new Rgb(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
19264
+ : l === 4 ? new Rgb((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
19265
+ : null) // invalid hex
19250
19266
  : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
19251
19267
  : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
19252
19268
  : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
19253
19269
  : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
19254
19270
  : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
19255
19271
  : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
19256
- : named.hasOwnProperty(format) ? rgbn(named[format])
19272
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
19257
19273
  : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
19258
19274
  : null;
19259
19275
  }
@@ -19298,24 +19314,30 @@ define(Rgb, rgb, extend(Color, {
19298
19314
  return this;
19299
19315
  },
19300
19316
  displayable: function() {
19301
- return (0 <= this.r && this.r <= 255)
19302
- && (0 <= this.g && this.g <= 255)
19303
- && (0 <= this.b && this.b <= 255)
19317
+ return (-0.5 <= this.r && this.r < 255.5)
19318
+ && (-0.5 <= this.g && this.g < 255.5)
19319
+ && (-0.5 <= this.b && this.b < 255.5)
19304
19320
  && (0 <= this.opacity && this.opacity <= 1);
19305
19321
  },
19306
- hex: function() {
19307
- return "#" + hex(this.r) + hex(this.g) + hex(this.b);
19308
- },
19309
- toString: function() {
19310
- var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
19311
- return (a === 1 ? "rgb(" : "rgba(")
19312
- + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
19313
- + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
19314
- + Math.max(0, Math.min(255, Math.round(this.b) || 0))
19315
- + (a === 1 ? ")" : ", " + a + ")");
19316
- }
19322
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
19323
+ formatHex: rgb_formatHex,
19324
+ formatRgb: rgb_formatRgb,
19325
+ toString: rgb_formatRgb
19317
19326
  }));
19318
19327
 
19328
+ function rgb_formatHex() {
19329
+ return "#" + hex(this.r) + hex(this.g) + hex(this.b);
19330
+ }
19331
+
19332
+ function rgb_formatRgb() {
19333
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
19334
+ return (a === 1 ? "rgb(" : "rgba(")
19335
+ + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
19336
+ + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
19337
+ + Math.max(0, Math.min(255, Math.round(this.b) || 0))
19338
+ + (a === 1 ? ")" : ", " + a + ")");
19339
+ }
19340
+
19319
19341
  function hex(value) {
19320
19342
  value = Math.max(0, Math.min(255, Math.round(value) || 0));
19321
19343
  return (value < 16 ? "0" : "") + value.toString(16);
@@ -19391,6 +19413,14 @@ define(Hsl, hsl, extend(Color, {
19391
19413
  return (0 <= this.s && this.s <= 1 || isNaN(this.s))
19392
19414
  && (0 <= this.l && this.l <= 1)
19393
19415
  && (0 <= this.opacity && this.opacity <= 1);
19416
+ },
19417
+ formatHsl: function() {
19418
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
19419
+ return (a === 1 ? "hsl(" : "hsla(")
19420
+ + (this.h || 0) + ", "
19421
+ + (this.s || 0) * 100 + "%, "
19422
+ + (this.l || 0) * 100 + "%"
19423
+ + (a === 1 ? ")" : ", " + a + ")");
19394
19424
  }
19395
19425
  }));
19396
19426
 
@@ -19405,7 +19435,7 @@ function hsl2rgb(h, m1, m2) {
19405
19435
  var deg2rad = Math.PI / 180;
19406
19436
  var rad2deg = 180 / Math.PI;
19407
19437
 
19408
- // https://beta.observablehq.com/@mbostock/lab-and-rgb
19438
+ // https://observablehq.com/@mbostock/lab-and-rgb
19409
19439
  var K = 18,
19410
19440
  Xn = 0.96422,
19411
19441
  Yn = 1,
@@ -19417,11 +19447,7 @@ var K = 18,
19417
19447
 
19418
19448
  function labConvert(o) {
19419
19449
  if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
19420
- if (o instanceof Hcl) {
19421
- if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
19422
- var h = o.h * deg2rad;
19423
- return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
19424
- }
19450
+ if (o instanceof Hcl) return hcl2lab(o);
19425
19451
  if (!(o instanceof Rgb)) o = rgbConvert(o);
19426
19452
  var r = rgb2lrgb(o.r),
19427
19453
  g = rgb2lrgb(o.g),
@@ -19491,7 +19517,7 @@ function rgb2lrgb(x) {
19491
19517
  function hclConvert(o) {
19492
19518
  if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
19493
19519
  if (!(o instanceof Lab)) o = labConvert(o);
19494
- if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity);
19520
+ if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
19495
19521
  var h = Math.atan2(o.b, o.a) * rad2deg;
19496
19522
  return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
19497
19523
  }
@@ -19511,6 +19537,12 @@ function Hcl(h, c, l, opacity) {
19511
19537
  this.opacity = +opacity;
19512
19538
  }
19513
19539
 
19540
+ function hcl2lab(o) {
19541
+ if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
19542
+ var h = o.h * deg2rad;
19543
+ return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
19544
+ }
19545
+
19514
19546
  define(Hcl, hcl, extend(Color, {
19515
19547
  brighter: function(k) {
19516
19548
  return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
@@ -19519,7 +19551,7 @@ define(Hcl, hcl, extend(Color, {
19519
19551
  return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
19520
19552
  },
19521
19553
  rgb: function() {
19522
- return labConvert(this).rgb();
19554
+ return hcl2lab(this).rgb();
19523
19555
  }
19524
19556
  }));
19525
19557
 
@@ -19582,17 +19614,17 @@ define(Cubehelix, cubehelix, extend(Color, {
19582
19614
  }));
19583
19615
 
19584
19616
  exports.color = color;
19585
- exports.rgb = rgb;
19617
+ exports.cubehelix = cubehelix;
19618
+ exports.gray = gray;
19619
+ exports.hcl = hcl;
19586
19620
  exports.hsl = hsl;
19587
19621
  exports.lab = lab;
19588
- exports.hcl = hcl;
19589
19622
  exports.lch = lch;
19590
- exports.gray = gray;
19591
- exports.cubehelix = cubehelix;
19623
+ exports.rgb = rgb;
19592
19624
 
19593
19625
  Object.defineProperty(exports, '__esModule', { value: true });
19594
19626
 
19595
- })));
19627
+ }));
19596
19628
 
19597
19629
  },{}],157:[function(_dereq_,module,exports){
19598
19630
  // https://d3js.org/d3-dispatch/ Version 1.0.3. Copyright 2017 Mike Bostock.
@@ -20354,12 +20386,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
20354
20386
  })));
20355
20387
 
20356
20388
  },{"d3-collection":155,"d3-dispatch":157,"d3-quadtree":162,"d3-timer":164}],159:[function(_dereq_,module,exports){
20357
- // https://d3js.org/d3-hierarchy/ v1.1.8 Copyright 2018 Mike Bostock
20389
+ // https://d3js.org/d3-hierarchy/ v1.1.9 Copyright 2019 Mike Bostock
20358
20390
  (function (global, factory) {
20359
20391
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
20360
20392
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
20361
- (factory((global.d3 = global.d3 || {})));
20362
- }(this, (function (exports) { 'use strict';
20393
+ (global = global || self, factory(global.d3 = global.d3 || {}));
20394
+ }(this, function (exports) { 'use strict';
20363
20395
 
20364
20396
  function defaultSeparation(a, b) {
20365
20397
  return a.parent === b.parent ? 1 : 2;
@@ -21628,30 +21660,30 @@ var resquarify = (function custom(ratio) {
21628
21660
  exports.cluster = cluster;
21629
21661
  exports.hierarchy = hierarchy;
21630
21662
  exports.pack = index;
21631
- exports.packSiblings = siblings;
21632
21663
  exports.packEnclose = enclose;
21664
+ exports.packSiblings = siblings;
21633
21665
  exports.partition = partition;
21634
21666
  exports.stratify = stratify;
21635
21667
  exports.tree = tree;
21636
21668
  exports.treemap = index$1;
21637
21669
  exports.treemapBinary = binary;
21638
21670
  exports.treemapDice = treemapDice;
21671
+ exports.treemapResquarify = resquarify;
21639
21672
  exports.treemapSlice = treemapSlice;
21640
21673
  exports.treemapSliceDice = sliceDice;
21641
21674
  exports.treemapSquarify = squarify;
21642
- exports.treemapResquarify = resquarify;
21643
21675
 
21644
21676
  Object.defineProperty(exports, '__esModule', { value: true });
21645
21677
 
21646
- })));
21678
+ }));
21647
21679
 
21648
21680
  },{}],160:[function(_dereq_,module,exports){
21649
- // https://d3js.org/d3-interpolate/ v1.3.2 Copyright 2018 Mike Bostock
21681
+ // https://d3js.org/d3-interpolate/ v1.4.0 Copyright 2019 Mike Bostock
21650
21682
  (function (global, factory) {
21651
21683
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-color')) :
21652
21684
  typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) :
21653
- (factory((global.d3 = global.d3 || {}),global.d3));
21654
- }(this, (function (exports,d3Color) { 'use strict';
21685
+ (global = global || self, factory(global.d3 = global.d3 || {}, global.d3));
21686
+ }(this, function (exports, d3Color) { 'use strict';
21655
21687
 
21656
21688
  function basis(t1, v0, v1, v2, v3) {
21657
21689
  var t2 = t1 * t1, t3 = t2 * t1;
@@ -21770,7 +21802,26 @@ function rgbSpline(spline) {
21770
21802
  var rgbBasis = rgbSpline(basis$1);
21771
21803
  var rgbBasisClosed = rgbSpline(basisClosed);
21772
21804
 
21805
+ function numberArray(a, b) {
21806
+ if (!b) b = [];
21807
+ var n = a ? Math.min(b.length, a.length) : 0,
21808
+ c = b.slice(),
21809
+ i;
21810
+ return function(t) {
21811
+ for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
21812
+ return c;
21813
+ };
21814
+ }
21815
+
21816
+ function isNumberArray(x) {
21817
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
21818
+ }
21819
+
21773
21820
  function array(a, b) {
21821
+ return (isNumberArray(b) ? numberArray : genericArray)(a, b);
21822
+ }
21823
+
21824
+ function genericArray(a, b) {
21774
21825
  var nb = b ? b.length : 0,
21775
21826
  na = a ? Math.min(nb, a.length) : 0,
21776
21827
  x = new Array(na),
@@ -21788,14 +21839,14 @@ function array(a, b) {
21788
21839
 
21789
21840
  function date(a, b) {
21790
21841
  var d = new Date;
21791
- return a = +a, b -= a, function(t) {
21792
- return d.setTime(a + b * t), d;
21842
+ return a = +a, b = +b, function(t) {
21843
+ return d.setTime(a * (1 - t) + b * t), d;
21793
21844
  };
21794
21845
  }
21795
21846
 
21796
21847
  function number(a, b) {
21797
- return a = +a, b -= a, function(t) {
21798
- return a + b * t;
21848
+ return a = +a, b = +b, function(t) {
21849
+ return a * (1 - t) + b * t;
21799
21850
  };
21800
21851
  }
21801
21852
 
@@ -21891,7 +21942,8 @@ function value(a, b) {
21891
21942
  : t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb) : string)
21892
21943
  : b instanceof d3Color.color ? rgb
21893
21944
  : b instanceof Date ? date
21894
- : Array.isArray(b) ? array
21945
+ : isNumberArray(b) ? numberArray
21946
+ : Array.isArray(b) ? genericArray
21895
21947
  : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
21896
21948
  : number)(a, b);
21897
21949
  }
@@ -21912,8 +21964,8 @@ function hue$1(a, b) {
21912
21964
  }
21913
21965
 
21914
21966
  function round(a, b) {
21915
- return a = +a, b -= a, function(t) {
21916
- return Math.round(a + b * t);
21967
+ return a = +a, b = +b, function(t) {
21968
+ return Math.round(a * (1 - t) + b * t);
21917
21969
  };
21918
21970
  }
21919
21971
 
@@ -22094,9 +22146,9 @@ function zoom(p0, p1) {
22094
22146
  return i;
22095
22147
  }
22096
22148
 
22097
- function hsl(hue$$1) {
22149
+ function hsl(hue) {
22098
22150
  return function(start, end) {
22099
- var h = hue$$1((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
22151
+ var h = hue((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
22100
22152
  s = nogamma(start.s, end.s),
22101
22153
  l = nogamma(start.l, end.l),
22102
22154
  opacity = nogamma(start.opacity, end.opacity);
@@ -22127,9 +22179,9 @@ function lab(start, end) {
22127
22179
  };
22128
22180
  }
22129
22181
 
22130
- function hcl(hue$$1) {
22182
+ function hcl(hue) {
22131
22183
  return function(start, end) {
22132
- var h = hue$$1((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
22184
+ var h = hue((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
22133
22185
  c = nogamma(start.c, end.c),
22134
22186
  l = nogamma(start.l, end.l),
22135
22187
  opacity = nogamma(start.opacity, end.opacity);
@@ -22146,12 +22198,12 @@ function hcl(hue$$1) {
22146
22198
  var hcl$1 = hcl(hue);
22147
22199
  var hclLong = hcl(nogamma);
22148
22200
 
22149
- function cubehelix(hue$$1) {
22201
+ function cubehelix(hue) {
22150
22202
  return (function cubehelixGamma(y) {
22151
22203
  y = +y;
22152
22204
 
22153
22205
  function cubehelix(start, end) {
22154
- var h = hue$$1((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
22206
+ var h = hue((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
22155
22207
  s = nogamma(start.s, end.s),
22156
22208
  l = nogamma(start.l, end.l),
22157
22209
  opacity = nogamma(start.opacity, end.opacity);
@@ -22192,32 +22244,33 @@ exports.interpolate = value;
22192
22244
  exports.interpolateArray = array;
22193
22245
  exports.interpolateBasis = basis$1;
22194
22246
  exports.interpolateBasisClosed = basisClosed;
22247
+ exports.interpolateCubehelix = cubehelix$1;
22248
+ exports.interpolateCubehelixLong = cubehelixLong;
22195
22249
  exports.interpolateDate = date;
22196
22250
  exports.interpolateDiscrete = discrete;
22251
+ exports.interpolateHcl = hcl$1;
22252
+ exports.interpolateHclLong = hclLong;
22253
+ exports.interpolateHsl = hsl$1;
22254
+ exports.interpolateHslLong = hslLong;
22197
22255
  exports.interpolateHue = hue$1;
22256
+ exports.interpolateLab = lab;
22198
22257
  exports.interpolateNumber = number;
22258
+ exports.interpolateNumberArray = numberArray;
22199
22259
  exports.interpolateObject = object;
22260
+ exports.interpolateRgb = rgb;
22261
+ exports.interpolateRgbBasis = rgbBasis;
22262
+ exports.interpolateRgbBasisClosed = rgbBasisClosed;
22200
22263
  exports.interpolateRound = round;
22201
22264
  exports.interpolateString = string;
22202
22265
  exports.interpolateTransformCss = interpolateTransformCss;
22203
22266
  exports.interpolateTransformSvg = interpolateTransformSvg;
22204
22267
  exports.interpolateZoom = zoom;
22205
- exports.interpolateRgb = rgb;
22206
- exports.interpolateRgbBasis = rgbBasis;
22207
- exports.interpolateRgbBasisClosed = rgbBasisClosed;
22208
- exports.interpolateHsl = hsl$1;
22209
- exports.interpolateHslLong = hslLong;
22210
- exports.interpolateLab = lab;
22211
- exports.interpolateHcl = hcl$1;
22212
- exports.interpolateHclLong = hclLong;
22213
- exports.interpolateCubehelix = cubehelix$1;
22214
- exports.interpolateCubehelixLong = cubehelixLong;
22215
22268
  exports.piecewise = piecewise;
22216
22269
  exports.quantize = quantize;
22217
22270
 
22218
22271
  Object.defineProperty(exports, '__esModule', { value: true });
22219
22272
 
22220
- })));
22273
+ }));
22221
22274
 
22222
22275
  },{"d3-color":156}],161:[function(_dereq_,module,exports){
22223
22276
  // https://d3js.org/d3-path/ v1.0.7 Copyright 2018 Mike Bostock
@@ -43755,7 +43808,7 @@ var createShader = _dereq_('gl-shader')
43755
43808
 
43756
43809
  var vertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n vec4 startPoint = project(position);\n vec4 endPoint = project(nextPosition);\n\n vec2 A = startPoint.xy / startPoint.w;\n vec2 B = endPoint.xy / endPoint.w;\n\n float clipAngle = atan(\n (B.y - A.y) * screenShape.y,\n (B.x - A.x) * screenShape.x\n );\n\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(\n sin(clipAngle),\n -cos(clipAngle)\n ) / screenShape;\n\n gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n"])
43757
43810
  var forwardFrag = glslify(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n"])
43758
- var pickFrag = glslify(["precision highp float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1604150559(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1604150559(pixelArcLength).xyz);\n}"])
43811
+ var pickFrag = glslify(["precision highp float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1540259130(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1540259130(pixelArcLength).xyz);\n}"])
43759
43812
 
43760
43813
  var ATTRIBUTES = [
43761
43814
  {name: 'position', type: 'vec3'},
@@ -45339,6 +45392,7 @@ function SimplicialMesh(gl
45339
45392
  this.contourColor = [0,0,0]
45340
45393
  this.contourEnable = true
45341
45394
 
45395
+ this.pickVertex = true;
45342
45396
  this.pickId = 1
45343
45397
  this.bounds = [
45344
45398
  [ Infinity, Infinity, Infinity],
@@ -45420,21 +45474,6 @@ function genColormap(param, opacityscale) {
45420
45474
  return ndarray(result, [256,256,4], [4,0,1])
45421
45475
  }
45422
45476
 
45423
- function unpackIntensity(cells, numVerts, cellIntensity) {
45424
- var result = new Array(numVerts)
45425
- for(var i=0; i<numVerts; ++i) {
45426
- result[i] = 0
45427
- }
45428
- var numCells = cells.length
45429
- for(var i=0; i<numCells; ++i) {
45430
- var c = cells[i]
45431
- for(var j=0; j<c.length; ++j) {
45432
- result[c[j]] = cellIntensity[i]
45433
- }
45434
- }
45435
- return result
45436
- }
45437
-
45438
45477
  function takeZComponent(array) {
45439
45478
  var n = array.length
45440
45479
  var result = new Array(n)
@@ -45625,11 +45664,13 @@ proto.update = function(params) {
45625
45664
  if(vertexIntensity) {
45626
45665
  this.intensity = vertexIntensity
45627
45666
  } else if(cellIntensity) {
45628
- this.intensity = unpackIntensity(cells, positions.length, cellIntensity)
45667
+ this.intensity = cellIntensity
45629
45668
  } else {
45630
45669
  this.intensity = takeZComponent(positions)
45631
45670
  }
45632
45671
 
45672
+ this.pickVertex = !(cellIntensity || cellColors)
45673
+
45633
45674
  //Point size
45634
45675
  var pointSizes = params.pointSizes
45635
45676
  var meshPointSize = params.pointSize || 1.0
@@ -46071,9 +46112,34 @@ proto.pick = function(pickData) {
46071
46112
  simplex[i] = positions[cell[i]]
46072
46113
  }
46073
46114
 
46115
+ var x = pickData.coord[0];
46116
+ var y = pickData.coord[1];
46117
+
46118
+ if(!this.pickVertex) {
46119
+ var A = this.positions[cell[0]];
46120
+ var B = this.positions[cell[1]];
46121
+ var C = this.positions[cell[2]];
46122
+
46123
+ var dataCoordinate = [
46124
+ (A[0] + B[0] + C[0]) / 3,
46125
+ (A[1] + B[1] + C[1]) / 3,
46126
+ (A[2] + B[2] + C[2]) / 3
46127
+ ]
46128
+
46129
+ return {
46130
+ _cellCenter : true,
46131
+ position: [x, y],
46132
+ index: cellId,
46133
+ cell: cell,
46134
+ cellId: cellId,
46135
+ intensity: this.intensity[cellId],
46136
+ dataCoordinate: dataCoordinate
46137
+ }
46138
+ }
46139
+
46074
46140
  var data = closestPoint(
46075
46141
  simplex,
46076
- [pickData.coord[0], this._resolution[1]-pickData.coord[1]],
46142
+ [x * this.pixelRatio, this._resolution[1] - y * this.pixelRatio],
46077
46143
  this._model,
46078
46144
  this._view,
46079
46145
  this._projection,
@@ -47964,6 +48030,10 @@ function createScene(options) {
47964
48030
 
47965
48031
  var gl = options.gl
47966
48032
  if(!gl) {
48033
+ if(options.glOptions) {
48034
+ isMobile = !!options.glOptions.preserveDrawingBuffer
48035
+ }
48036
+
47967
48037
  gl = getContext(canvas,
47968
48038
  options.glOptions || {
47969
48039
  premultipliedAlpha: true,
@@ -47983,7 +48053,7 @@ function createScene(options) {
47983
48053
 
47984
48054
  //Accumulation buffer
47985
48055
  var accumBuffer = createFBO(gl,
47986
- [gl.drawingBufferWidth, gl.drawingBufferHeight], {
48056
+ gl.drawingBufferWidth, gl.drawingBufferHeight, {
47987
48057
  preferFloat: !isMobile
47988
48058
  })
47989
48059
 
@@ -48031,7 +48101,7 @@ function createScene(options) {
48031
48101
  view: null,
48032
48102
  projection: projection,
48033
48103
  model: model,
48034
- _ortho: false
48104
+ _ortho: false
48035
48105
  }
48036
48106
 
48037
48107
  var pickDirty = true
@@ -48086,6 +48156,29 @@ function createScene(options) {
48086
48156
  this.aspect[0] = aspectratio.x
48087
48157
  this.aspect[1] = aspectratio.y
48088
48158
  this.aspect[2] = aspectratio.z
48159
+ },
48160
+
48161
+ setBounds: function(axisIndex, range) {
48162
+ this.bounds[0][axisIndex] = range.min
48163
+ this.bounds[1][axisIndex] = range.max
48164
+ },
48165
+
48166
+ setClearColor: function(clearColor) {
48167
+ this.clearColor = clearColor
48168
+ },
48169
+
48170
+ clearRGBA: function() {
48171
+ this.gl.clearColor(
48172
+ this.clearColor[0],
48173
+ this.clearColor[1],
48174
+ this.clearColor[2],
48175
+ this.clearColor[3]
48176
+ )
48177
+
48178
+ this.gl.clear(
48179
+ this.gl.COLOR_BUFFER_BIT |
48180
+ this.gl.DEPTH_BUFFER_BIT
48181
+ )
48089
48182
  }
48090
48183
  }
48091
48184
 
@@ -48484,48 +48577,7 @@ function createScene(options) {
48484
48577
  pickShape[1] = Math.max(height/scene.pixelRatio, 1)|0
48485
48578
 
48486
48579
  //Compute camera parameters
48487
-
48488
- if(isOrtho) {
48489
- ortho(projection,
48490
- -width/height,
48491
- width/height,
48492
- -1,
48493
- 1,
48494
- scene.zNear,
48495
- scene.zFar
48496
- )
48497
- cameraParams._ortho = true
48498
- } else {
48499
- perspective(projection,
48500
- scene.fovy,
48501
- width/height,
48502
- scene.zNear,
48503
- scene.zFar
48504
- )
48505
- cameraParams._ortho = false
48506
- }
48507
-
48508
- //Compute model matrix
48509
- for(var i=0; i<16; ++i) {
48510
- model[i] = 0
48511
- }
48512
- model[15] = 1
48513
-
48514
- var maxS = 0
48515
- for(var i=0; i<3; ++i) {
48516
- maxS = Math.max(maxS, bounds[1][i] - bounds[0][i])
48517
- }
48518
-
48519
- for(var i=0; i<3; ++i) {
48520
- if(scene.autoScale) {
48521
- model[5*i] = scene.aspect[i] / (bounds[1][i] - bounds[0][i])
48522
- } else {
48523
- model[5*i] = 1 / maxS
48524
- }
48525
- if(scene.autoCenter) {
48526
- model[12+i] = -model[5*i] * 0.5 * (bounds[0][i] + bounds[1][i])
48527
- }
48528
- }
48580
+ calcCameraParams(scene, isOrtho)
48529
48581
 
48530
48582
  //Apply axes/clip bounds
48531
48583
  for(var i=0; i<numObjs; ++i) {
@@ -48573,9 +48625,8 @@ function createScene(options) {
48573
48625
  // 3. composite final scene
48574
48626
 
48575
48627
  //Clear FBO
48576
- var clearColor = scene.clearColor
48577
- gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3])
48578
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
48628
+ scene.clearRGBA()
48629
+
48579
48630
  gl.depthMask(true)
48580
48631
  gl.colorMask(true, true, true, true)
48581
48632
  gl.enable(gl.DEPTH_TEST)
@@ -48695,6 +48746,63 @@ function createScene(options) {
48695
48746
  return scene
48696
48747
  }
48697
48748
 
48749
+ function calcCameraParams(scene, isOrtho) {
48750
+ var bounds = scene.bounds
48751
+ var cameraParams = scene.cameraParams
48752
+ var projection = cameraParams.projection
48753
+ var model = cameraParams.model
48754
+
48755
+ var width = scene.gl.drawingBufferWidth
48756
+ var height = scene.gl.drawingBufferHeight
48757
+ var zNear = scene.zNear
48758
+ var zFar = scene.zFar
48759
+ var fovy = scene.fovy
48760
+
48761
+ var r = width / height
48762
+
48763
+ if(isOrtho) {
48764
+ ortho(projection,
48765
+ -r,
48766
+ r,
48767
+ -1,
48768
+ 1,
48769
+ zNear,
48770
+ zFar
48771
+ )
48772
+ cameraParams._ortho = true
48773
+ } else {
48774
+ perspective(projection,
48775
+ fovy,
48776
+ r,
48777
+ zNear,
48778
+ zFar
48779
+ )
48780
+ cameraParams._ortho = false
48781
+ }
48782
+
48783
+ //Compute model matrix
48784
+ for(var i=0; i<16; ++i) {
48785
+ model[i] = 0
48786
+ }
48787
+ model[15] = 1
48788
+
48789
+ var maxS = 0
48790
+ for(var i=0; i<3; ++i) {
48791
+ maxS = Math.max(maxS, bounds[1][i] - bounds[0][i])
48792
+ }
48793
+
48794
+ for(var i=0; i<3; ++i) {
48795
+ if(scene.autoScale) {
48796
+ model[5*i] = scene.aspect[i] / (bounds[1][i] - bounds[0][i])
48797
+ } else {
48798
+ model[5*i] = 1 / maxS
48799
+ }
48800
+ if(scene.autoCenter) {
48801
+ model[12+i] = -model[5*i] * 0.5 * (bounds[0][i] + bounds[1][i])
48802
+ }
48803
+ }
48804
+ }
48805
+
48698
48806
  },{"./camera.js":291,"./lib/shader":292,"a-big-triangle":62,"gl-axes3d":236,"gl-axes3d/properties":243,"gl-fbo":252,"gl-mat4/ortho":271,"gl-mat4/perspective":272,"gl-select-static":303,"gl-spikes3d":313,"is-mobile":422,"mouse-change":437}],294:[function(_dereq_,module,exports){
48699
48807
  var glslify = _dereq_('glslify')
48700
48808
 
@@ -50285,8 +50393,11 @@ proto.dispose = function() {
50285
50393
  }
50286
50394
 
50287
50395
  function createSelectBuffer(gl, shape) {
50288
- var fbo = createFBO(gl, shape)
50289
- var buffer = pool.mallocUint8(shape[0]*shape[1]*4)
50396
+ var width = shape[0]
50397
+ var height = shape[1]
50398
+ var options = {}
50399
+ var fbo = createFBO(gl, width, height, options)
50400
+ var buffer = pool.mallocUint8(width*height*4)
50290
50401
  return new SelectBuffer(gl, fbo, buffer)
50291
50402
  }
50292
50403
 
@@ -102766,7 +102877,7 @@ exports.svgAttrs = {
102766
102877
  'use strict';
102767
102878
 
102768
102879
  // package version injected by `npm run preprocess`
102769
- exports.version = '1.52.1';
102880
+ exports.version = '1.52.2';
102770
102881
 
102771
102882
  // inject promise polyfill
102772
102883
  _dereq_('es6-promise').polyfill();
@@ -106995,11 +107106,14 @@ lib.templateString = function(string, obj) {
106995
107106
  var getterCache = {};
106996
107107
 
106997
107108
  return string.replace(lib.TEMPLATE_STRING_REGEX, function(dummy, key) {
107109
+ var v;
106998
107110
  if(SIMPLE_PROPERTY_REGEX.test(key)) {
106999
- return obj[key] || '';
107111
+ v = obj[key];
107112
+ } else {
107113
+ getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get;
107114
+ v = getterCache[key]();
107000
107115
  }
107001
- getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get;
107002
- return getterCache[key]() || '';
107116
+ return lib.isValidTextValue(v) ? v : '';
107003
107117
  });
107004
107118
  };
107005
107119
 
@@ -117376,6 +117490,7 @@ exports.doAutoRangeAndConstraints = function(gd) {
117376
117490
  var fullLayout = gd._fullLayout;
117377
117491
  var axList = Axes.list(gd, '', true);
117378
117492
  var matchGroups = fullLayout._axisMatchGroups || [];
117493
+ var axLookup = {};
117379
117494
  var ax;
117380
117495
  var axRng;
117381
117496
 
@@ -117383,6 +117498,7 @@ exports.doAutoRangeAndConstraints = function(gd) {
117383
117498
  ax = axList[i];
117384
117499
  cleanAxisConstraints(gd, ax);
117385
117500
  doAutoRange(gd, ax);
117501
+ axLookup[ax._id] = 1;
117386
117502
  }
117387
117503
 
117388
117504
  enforceAxisConstraints(gd);
@@ -117395,6 +117511,10 @@ exports.doAutoRangeAndConstraints = function(gd) {
117395
117511
 
117396
117512
  for(id in group) {
117397
117513
  ax = Axes.getFromId(gd, id);
117514
+
117515
+ // skip over 'missing' axes which do not pass through doAutoRange
117516
+ if(!axLookup[ax._id]) continue;
117517
+ // if one axis has autorange false, we're done
117398
117518
  if(ax.autorange === false) continue groupLoop;
117399
117519
 
117400
117520
  axRng = Lib.simpleMap(ax.range, ax.r2l);
@@ -118272,13 +118392,14 @@ function crawl(objIn, objOut, schema, list, base, path) {
118272
118392
  var valOut = objOut[k];
118273
118393
 
118274
118394
  var nestedSchema = getNestedSchema(schema, k);
118275
- var isInfoArray = (nestedSchema || {}).valType === 'info_array';
118276
- var isColorscale = (nestedSchema || {}).valType === 'colorscale';
118395
+ var nestedValType = (nestedSchema || {}).valType;
118396
+ var isInfoArray = nestedValType === 'info_array';
118397
+ var isColorscale = nestedValType === 'colorscale';
118277
118398
  var items = (nestedSchema || {}).items;
118278
118399
 
118279
118400
  if(!isInSchema(schema, k)) {
118280
118401
  list.push(format('schema', base, p));
118281
- } else if(isPlainObject(valIn) && isPlainObject(valOut)) {
118402
+ } else if(isPlainObject(valIn) && isPlainObject(valOut) && nestedValType !== 'any') {
118282
118403
  crawl(valIn, valOut, nestedSchema, list, base, p);
118283
118404
  } else if(isInfoArray && isArray(valIn)) {
118284
118405
  if(valIn.length > valOut.length) {
@@ -121083,10 +121204,14 @@ axes.drawOne = function(gd, ax, opts) {
121083
121204
  var axId = ax._id;
121084
121205
  var axLetter = axId.charAt(0);
121085
121206
  var counterLetter = axes.counterLetter(axId);
121086
- var mainLinePosition = ax._mainLinePosition;
121087
- var mainMirrorPosition = ax._mainMirrorPosition;
121088
121207
  var mainPlotinfo = fullLayout._plots[ax._mainSubplot];
121208
+
121209
+ // this happens when updating matched group with 'missing' axes
121210
+ if(!mainPlotinfo) return;
121211
+
121089
121212
  var mainAxLayer = mainPlotinfo[axLetter + 'axislayer'];
121213
+ var mainLinePosition = ax._mainLinePosition;
121214
+ var mainMirrorPosition = ax._mainMirrorPosition;
121090
121215
 
121091
121216
  var vals = ax._vals = axes.calcTicks(ax);
121092
121217
 
@@ -123045,11 +123170,10 @@ exports.tick0 = function(tick0, axType, calendar, dtick) {
123045
123170
  */
123046
123171
 
123047
123172
  'use strict';
123048
- var counterRegex = _dereq_('../../lib/regex').counter;
123049
123173
 
123174
+ var counterRegex = _dereq_('../../lib/regex').counter;
123050
123175
 
123051
123176
  module.exports = {
123052
-
123053
123177
  idRegex: {
123054
123178
  x: counterRegex('x'),
123055
123179
  y: counterRegex('y')
@@ -126239,6 +126363,8 @@ var axisIds = _dereq_('./axis_ids');
126239
126363
  var id2name = axisIds.id2name;
126240
126364
  var name2id = axisIds.name2id;
126241
126365
 
126366
+ var AX_ID_PATTERN = _dereq_('./constants').AX_ID_PATTERN;
126367
+
126242
126368
  var Registry = _dereq_('../../registry');
126243
126369
  var traceIs = Registry.traceIs;
126244
126370
  var getComponentMethod = Registry.getComponentMethod;
@@ -126348,7 +126474,28 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126348
126474
 
126349
126475
  var bgColor = Color.combine(plotBgColor, layoutOut.paper_bgcolor);
126350
126476
 
126351
- var axName, axLetter, axLayoutIn, axLayoutOut;
126477
+ // name of single axis (e.g. 'xaxis', 'yaxis2')
126478
+ var axName;
126479
+ // id of single axis (e.g. 'y', 'x5')
126480
+ var axId;
126481
+ // 'x' or 'y'
126482
+ var axLetter;
126483
+ // input layout axis container
126484
+ var axLayoutIn;
126485
+ // full layout axis container
126486
+ var axLayoutOut;
126487
+
126488
+ function newAxLayoutOut() {
126489
+ var traces = ax2traces[axName] || [];
126490
+ axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; });
126491
+ axLayoutOut._annIndices = [];
126492
+ axLayoutOut._shapeIndices = [];
126493
+ axLayoutOut._imgIndices = [];
126494
+ axLayoutOut._subplotsWith = [];
126495
+ axLayoutOut._counterAxes = [];
126496
+ axLayoutOut._name = axLayoutOut._attr = axName;
126497
+ axLayoutOut._id = axId;
126498
+ }
126352
126499
 
126353
126500
  function coerce(attr, dflt) {
126354
126501
  return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt);
@@ -126362,9 +126509,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126362
126509
  return (axLetter === 'x') ? yIds : xIds;
126363
126510
  }
126364
126511
 
126365
- var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')};
126366
- var allAxisIds = counterAxes.x.concat(counterAxes.y);
126367
-
126368
126512
  function getOverlayableAxes(axLetter, axName) {
126369
126513
  var list = (axLetter === 'x') ? xNames : yNames;
126370
126514
  var out = [];
@@ -126380,9 +126524,30 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126380
126524
  return out;
126381
126525
  }
126382
126526
 
126527
+ // list of available counter axis names
126528
+ var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')};
126529
+ // list of all x AND y axis ids
126530
+ var allAxisIds = counterAxes.x.concat(counterAxes.y);
126531
+ // lookup and list of axis ids that axes in axNames have a reference to,
126532
+ // even though they are missing from allAxisIds
126533
+ var missingMatchedAxisIdsLookup = {};
126534
+ var missingMatchedAxisIds = [];
126535
+
126536
+ // fill in 'missing' axis lookup when an axis is set to match an axis
126537
+ // not part of the allAxisIds list, save axis type so that we can propagate
126538
+ // it to the missing axes
126539
+ function addMissingMatchedAxis() {
126540
+ var matchesIn = axLayoutIn.matches;
126541
+ if(AX_ID_PATTERN.test(matchesIn) && allAxisIds.indexOf(matchesIn) === -1) {
126542
+ missingMatchedAxisIdsLookup[matchesIn] = axLayoutIn.type;
126543
+ missingMatchedAxisIds = Object.keys(missingMatchedAxisIdsLookup);
126544
+ }
126545
+ }
126546
+
126383
126547
  // first pass creates the containers, determines types, and handles most of the settings
126384
126548
  for(i = 0; i < axNames.length; i++) {
126385
126549
  axName = axNames[i];
126550
+ axId = name2id(axName);
126386
126551
  axLetter = axName.charAt(0);
126387
126552
 
126388
126553
  if(!Lib.isPlainObject(layoutIn[axName])) {
@@ -126391,20 +126556,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126391
126556
 
126392
126557
  axLayoutIn = layoutIn[axName];
126393
126558
  axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis');
126394
-
126395
- var traces = ax2traces[axName] || [];
126396
- axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; });
126397
- axLayoutOut._annIndices = [];
126398
- axLayoutOut._shapeIndices = [];
126399
- axLayoutOut._imgIndices = [];
126400
- axLayoutOut._subplotsWith = [];
126401
- axLayoutOut._counterAxes = [];
126402
-
126403
- // set up some private properties
126404
- axLayoutOut._name = axLayoutOut._attr = axName;
126405
- var id = axLayoutOut._id = name2id(axName);
126406
-
126407
- var overlayableAxes = getOverlayableAxes(axLetter, axName);
126559
+ newAxLayoutOut();
126408
126560
 
126409
126561
  var visibleDflt =
126410
126562
  (axLetter === 'x' && !xaMustDisplay[axName] && xaMayHide[axName]) ||
@@ -126422,13 +126574,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126422
126574
  font: layoutOut.font,
126423
126575
  outerTicks: outerTicks[axName],
126424
126576
  showGrid: !noGrids[axName],
126425
- data: traces,
126577
+ data: ax2traces[axName] || [],
126426
126578
  bgColor: bgColor,
126427
126579
  calendar: layoutOut.calendar,
126428
126580
  automargin: true,
126429
126581
  visibleDflt: visibleDflt,
126430
126582
  reverseDflt: reverseDflt,
126431
- splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[id]
126583
+ splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
126432
126584
  };
126433
126585
 
126434
126586
  coerce('uirevision', layoutOut.uirevision);
@@ -126454,12 +126606,63 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126454
126606
  handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {
126455
126607
  letter: axLetter,
126456
126608
  counterAxes: counterAxes[axLetter],
126457
- overlayableAxes: overlayableAxes,
126609
+ overlayableAxes: getOverlayableAxes(axLetter, axName),
126458
126610
  grid: layoutOut.grid
126459
126611
  });
126460
126612
 
126461
126613
  coerce('title.standoff');
126462
126614
 
126615
+ addMissingMatchedAxis();
126616
+
126617
+ axLayoutOut._input = axLayoutIn;
126618
+ }
126619
+
126620
+ // coerce the 'missing' axes
126621
+ i = 0;
126622
+ while(i < missingMatchedAxisIds.length) {
126623
+ axId = missingMatchedAxisIds[i++];
126624
+ axName = id2name(axId);
126625
+ axLetter = axName.charAt(0);
126626
+
126627
+ if(!Lib.isPlainObject(layoutIn[axName])) {
126628
+ layoutIn[axName] = {};
126629
+ }
126630
+
126631
+ axLayoutIn = layoutIn[axName];
126632
+ axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis');
126633
+ newAxLayoutOut();
126634
+
126635
+ var defaultOptions2 = {
126636
+ letter: axLetter,
126637
+ font: layoutOut.font,
126638
+ outerTicks: outerTicks[axName],
126639
+ showGrid: !noGrids[axName],
126640
+ data: [],
126641
+ bgColor: bgColor,
126642
+ calendar: layoutOut.calendar,
126643
+ automargin: true,
126644
+ visibleDflt: false,
126645
+ reverseDflt: false,
126646
+ splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
126647
+ };
126648
+
126649
+ coerce('uirevision', layoutOut.uirevision);
126650
+
126651
+ axLayoutOut.type = missingMatchedAxisIdsLookup[axId] || 'linear';
126652
+
126653
+ handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions2, layoutOut);
126654
+
126655
+ handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {
126656
+ letter: axLetter,
126657
+ counterAxes: counterAxes[axLetter],
126658
+ overlayableAxes: getOverlayableAxes(axLetter, axName),
126659
+ grid: layoutOut.grid
126660
+ });
126661
+
126662
+ coerce('fixedrange');
126663
+
126664
+ addMissingMatchedAxis();
126665
+
126463
126666
  axLayoutOut._input = axLayoutIn;
126464
126667
  }
126465
126668
 
@@ -126510,9 +126713,12 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126510
126713
  var constraintGroups = layoutOut._axisConstraintGroups = [];
126511
126714
  // similar to _axisConstraintGroups, but for matching axes
126512
126715
  var matchGroups = layoutOut._axisMatchGroups = [];
126716
+ // make sure to include 'missing' axes here
126717
+ var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds);
126718
+ var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name));
126513
126719
 
126514
- for(i = 0; i < axNames.length; i++) {
126515
- axName = axNames[i];
126720
+ for(i = 0; i < axNamesIncludingMissing.length; i++) {
126721
+ axName = axNamesIncludingMissing[i];
126516
126722
  axLetter = axName.charAt(0);
126517
126723
  axLayoutIn = layoutIn[axName];
126518
126724
  axLayoutOut = layoutOut[axName];
@@ -126520,15 +126726,19 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126520
126726
  var scaleanchorDflt;
126521
126727
  if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) {
126522
126728
  scaleanchorDflt = axLayoutOut.anchor;
126523
- } else {scaleanchorDflt = undefined;}
126729
+ } else {
126730
+ scaleanchorDflt = undefined;
126731
+ }
126524
126732
 
126525
126733
  var constrainDflt;
126526
126734
  if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) {
126527
126735
  constrainDflt = 'domain';
126528
- } else {constrainDflt = undefined;}
126736
+ } else {
126737
+ constrainDflt = undefined;
126738
+ }
126529
126739
 
126530
126740
  handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, {
126531
- allAxisIds: allAxisIds,
126741
+ allAxisIds: allAxisIdsIncludingMissing,
126532
126742
  layoutOut: layoutOut,
126533
126743
  scaleanchorDflt: scaleanchorDflt,
126534
126744
  constrainDflt: constrainDflt
@@ -126539,7 +126749,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126539
126749
  var group = matchGroups[i];
126540
126750
  var rng = null;
126541
126751
  var autorange = null;
126542
- var axId;
126543
126752
 
126544
126753
  // find 'matching' range attrs
126545
126754
  for(axId in group) {
@@ -126592,7 +126801,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
126592
126801
  }
126593
126802
  };
126594
126803
 
126595
- },{"../../components/color":592,"../../lib":717,"../../plot_api/plot_template":755,"../../registry":846,"../layout_attributes":817,"./axis_defaults":767,"./axis_ids":768,"./constraints":772,"./layout_attributes":777,"./position_defaults":780,"./type_defaults":788}],779:[function(_dereq_,module,exports){
126804
+ },{"../../components/color":592,"../../lib":717,"../../plot_api/plot_template":755,"../../registry":846,"../layout_attributes":817,"./axis_defaults":767,"./axis_ids":768,"./constants":771,"./constraints":772,"./layout_attributes":777,"./position_defaults":780,"./type_defaults":788}],779:[function(_dereq_,module,exports){
126596
126805
  /**
126597
126806
  * Copyright 2012-2020, Plotly, Inc.
126598
126807
  * All rights reserved.
@@ -134623,10 +134832,269 @@ var createAxesOptions = _dereq_('./layout/convert');
134623
134832
  var createSpikeOptions = _dereq_('./layout/spikes');
134624
134833
  var computeTickMarks = _dereq_('./layout/tick_marks');
134625
134834
 
134835
+ var isMobile = _dereq_('is-mobile');
134836
+ var tablet = isTablet();
134837
+
134838
+ function isTablet() {
134839
+ if(!navigator) return false;
134840
+
134841
+ var ua;
134842
+ // same interface as applied by is-mobile module
134843
+ if(!ua && typeof navigator !== 'undefined') ua = navigator.userAgent;
134844
+ if(ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
134845
+ ua = ua.headers['user-agent'];
134846
+ }
134847
+ if(typeof ua !== 'string') return false;
134848
+
134849
+ var result = isMobile({
134850
+ ua: ua,
134851
+ tablet: true
134852
+ });
134853
+
134854
+ // handle iPad pro or iPad with iOs 13 using Safari
134855
+ // see https://github.com/plotly/plotly.js/issues/4502
134856
+ if(
134857
+ result === false &&
134858
+ ua.indexOf('Macintosh') !== -1 &&
134859
+ ua.indexOf('Safari') !== -1 &&
134860
+ navigator.maxTouchPoints > 1
134861
+ ) {
134862
+ result = true;
134863
+ }
134864
+
134865
+ return result;
134866
+ }
134867
+
134626
134868
 
134627
134869
  var STATIC_CANVAS, STATIC_CONTEXT;
134628
134870
 
134629
- function render(scene) {
134871
+ function Scene(options, fullLayout) {
134872
+ // create sub container for plot
134873
+ var sceneContainer = document.createElement('div');
134874
+ var plotContainer = options.container;
134875
+
134876
+ // keep a ref to the graph div to fire hover+click events
134877
+ this.graphDiv = options.graphDiv;
134878
+
134879
+ // create SVG container for hover text
134880
+ var svgContainer = document.createElementNS(
134881
+ 'http://www.w3.org/2000/svg',
134882
+ 'svg');
134883
+ svgContainer.style.position = 'absolute';
134884
+ svgContainer.style.top = svgContainer.style.left = '0px';
134885
+ svgContainer.style.width = svgContainer.style.height = '100%';
134886
+ svgContainer.style['z-index'] = 20;
134887
+ svgContainer.style['pointer-events'] = 'none';
134888
+ sceneContainer.appendChild(svgContainer);
134889
+ this.svgContainer = svgContainer;
134890
+
134891
+ // Tag the container with the sceneID
134892
+ sceneContainer.id = options.id;
134893
+ sceneContainer.style.position = 'absolute';
134894
+ sceneContainer.style.top = sceneContainer.style.left = '0px';
134895
+ sceneContainer.style.width = sceneContainer.style.height = '100%';
134896
+ plotContainer.appendChild(sceneContainer);
134897
+
134898
+ this.fullLayout = fullLayout;
134899
+ this.id = options.id || 'scene';
134900
+ this.fullSceneLayout = fullLayout[this.id];
134901
+
134902
+ // Saved from last call to plot()
134903
+ this.plotArgs = [ [], {}, {} ];
134904
+
134905
+ /*
134906
+ * Move this to calc step? Why does it work here?
134907
+ */
134908
+ this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]);
134909
+ this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
134910
+ this.container = sceneContainer;
134911
+ this.staticMode = !!options.staticPlot;
134912
+ this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
134913
+
134914
+ // Coordinate rescaling
134915
+ this.dataScale = [1, 1, 1];
134916
+
134917
+ this.contourLevels = [ [], [], [] ];
134918
+
134919
+ this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert');
134920
+ this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
134921
+
134922
+ this.initializeGLPlot();
134923
+ }
134924
+
134925
+ var proto = Scene.prototype;
134926
+
134927
+ proto.tryCreatePlot = function() {
134928
+ var scene = this;
134929
+ var opts = {
134930
+ canvas: scene.canvas,
134931
+ gl: scene.gl,
134932
+ glOptions: {
134933
+ preserveDrawingBuffer: tablet,
134934
+ premultipliedAlpha: true,
134935
+ antialias: true
134936
+ },
134937
+ container: scene.container,
134938
+ axes: scene.axesOptions,
134939
+ spikes: scene.spikeOptions,
134940
+ pickRadius: 10,
134941
+ snapToData: true,
134942
+ autoScale: true,
134943
+ autoBounds: false,
134944
+ cameraObject: scene.camera,
134945
+ pixelRatio: scene.pixelRatio
134946
+ };
134947
+
134948
+ // for static plots, we reuse the WebGL context
134949
+ // as WebKit doesn't collect them reliably
134950
+ if(scene.staticMode) {
134951
+ if(!STATIC_CONTEXT) {
134952
+ STATIC_CANVAS = document.createElement('canvas');
134953
+ STATIC_CONTEXT = getContext({
134954
+ canvas: STATIC_CANVAS,
134955
+ preserveDrawingBuffer: true,
134956
+ premultipliedAlpha: true,
134957
+ antialias: true
134958
+ });
134959
+ if(!STATIC_CONTEXT) {
134960
+ throw new Error('error creating static canvas/context for image server');
134961
+ }
134962
+ }
134963
+
134964
+ opts.gl = STATIC_CONTEXT;
134965
+ opts.canvas = STATIC_CANVAS;
134966
+ }
134967
+
134968
+ var failed = 0;
134969
+
134970
+ try {
134971
+ scene.glplot = createPlot(opts);
134972
+ } catch(e) {
134973
+ failed++;
134974
+ try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
134975
+ scene.glplot = createPlot(opts);
134976
+ } catch(e) {
134977
+ failed++;
134978
+ }
134979
+ }
134980
+
134981
+ return failed < 2;
134982
+ };
134983
+
134984
+ proto.initializeGLCamera = function() {
134985
+ var scene = this;
134986
+ var cameraData = scene.fullSceneLayout.camera;
134987
+ var isOrtho = (cameraData.projection.type === 'orthographic');
134988
+
134989
+ scene.camera = createCamera(scene.container, {
134990
+ center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],
134991
+ eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],
134992
+ up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],
134993
+ _ortho: isOrtho,
134994
+ zoomMin: 0.01,
134995
+ zoomMax: 100,
134996
+ mode: 'orbit'
134997
+ });
134998
+ };
134999
+
135000
+ proto.initializeGLPlot = function() {
135001
+ var scene = this;
135002
+
135003
+ scene.initializeGLCamera();
135004
+
135005
+ var success = scene.tryCreatePlot();
135006
+ /*
135007
+ * createPlot will throw when webgl is not enabled in the client.
135008
+ * Lets return an instance of the module with all functions noop'd.
135009
+ * The destroy method - which will remove the container from the DOM
135010
+ * is overridden with a function that removes the container only.
135011
+ */
135012
+ if(!success) return showNoWebGlMsg(scene);
135013
+
135014
+ // List of scene objects
135015
+ scene.traces = {};
135016
+
135017
+ scene.make4thDimension();
135018
+
135019
+ var gd = scene.graphDiv;
135020
+ var layout = gd.layout;
135021
+
135022
+ var makeUpdate = function() {
135023
+ var update = {};
135024
+
135025
+ if(scene.isCameraChanged(layout)) {
135026
+ // camera updates
135027
+ update[scene.id + '.camera'] = scene.getCamera();
135028
+ }
135029
+
135030
+ if(scene.isAspectChanged(layout)) {
135031
+ // scene updates
135032
+ update[scene.id + '.aspectratio'] = scene.glplot.getAspectratio();
135033
+ }
135034
+
135035
+ return update;
135036
+ };
135037
+
135038
+ var relayoutCallback = function(scene) {
135039
+ if(scene.fullSceneLayout.dragmode === false) return;
135040
+
135041
+ var update = makeUpdate();
135042
+ scene.saveLayout(layout);
135043
+ scene.graphDiv.emit('plotly_relayout', update);
135044
+ };
135045
+
135046
+ scene.glplot.canvas.addEventListener('mouseup', function() {
135047
+ relayoutCallback(scene);
135048
+ });
135049
+
135050
+ scene.glplot.canvas.addEventListener('wheel', function(e) {
135051
+ if(gd._context._scrollZoom.gl3d) {
135052
+ if(scene.camera._ortho) {
135053
+ var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1;
135054
+ var o = scene.glplot.getAspectratio();
135055
+ scene.glplot.setAspectratio({
135056
+ x: s * o.x,
135057
+ y: s * o.y,
135058
+ z: s * o.z
135059
+ });
135060
+ }
135061
+
135062
+ relayoutCallback(scene);
135063
+ }
135064
+ }, passiveSupported ? {passive: false} : false);
135065
+
135066
+ scene.glplot.canvas.addEventListener('mousemove', function() {
135067
+ if(scene.fullSceneLayout.dragmode === false) return;
135068
+ if(scene.camera.mouseListener.buttons === 0) return;
135069
+
135070
+ var update = makeUpdate();
135071
+ scene.graphDiv.emit('plotly_relayouting', update);
135072
+ });
135073
+
135074
+ if(!scene.staticMode) {
135075
+ scene.glplot.canvas.addEventListener('webglcontextlost', function(event) {
135076
+ if(gd && gd.emit) {
135077
+ gd.emit('plotly_webglcontextlost', {
135078
+ event: event,
135079
+ layer: scene.id
135080
+ });
135081
+ }
135082
+ }, false);
135083
+ }
135084
+
135085
+ scene.glplot.oncontextloss = function() {
135086
+ scene.recoverContext();
135087
+ };
135088
+
135089
+ scene.glplot.onrender = function() {
135090
+ scene.render();
135091
+ };
135092
+
135093
+ return true;
135094
+ };
135095
+
135096
+ proto.render = function() {
135097
+ var scene = this;
134630
135098
  var gd = scene.graphDiv;
134631
135099
  var trace;
134632
135100
 
@@ -134721,7 +135189,7 @@ function render(scene) {
134721
135189
  }
134722
135190
  tx = vectorTx.join('<br>');
134723
135191
  } else if(trace.type === 'isosurface' || trace.type === 'volume') {
134724
- labels.valueLabel = Axes.tickText(scene.mockAxis, scene.mockAxis.d2l(selection.traceCoordinate[3]), 'hover').text;
135192
+ labels.valueLabel = Axes.tickText(scene._mockAxis, scene._mockAxis.d2l(selection.traceCoordinate[3]), 'hover').text;
134725
135193
  vectorTx.push('value: ' + labels.valueLabel);
134726
135194
  if(selection.textLabel) {
134727
135195
  vectorTx.push(selection.textLabel);
@@ -134788,242 +135256,25 @@ function render(scene) {
134788
135256
  }
134789
135257
 
134790
135258
  scene.drawAnnotations(scene);
134791
- }
134792
-
134793
- function tryCreatePlot(scene, cameraObject, pixelRatio, canvas, gl) {
134794
- var glplotOptions = {
134795
- canvas: canvas,
134796
- gl: gl,
134797
- container: scene.container,
134798
- axes: scene.axesOptions,
134799
- spikes: scene.spikeOptions,
134800
- pickRadius: 10,
134801
- snapToData: true,
134802
- autoScale: true,
134803
- autoBounds: false,
134804
- cameraObject: cameraObject,
134805
- pixelRatio: pixelRatio
134806
- };
134807
-
134808
- // for static plots, we reuse the WebGL context
134809
- // as WebKit doesn't collect them reliably
134810
- if(scene.staticMode) {
134811
- if(!STATIC_CONTEXT) {
134812
- STATIC_CANVAS = document.createElement('canvas');
134813
- STATIC_CONTEXT = getContext({
134814
- canvas: STATIC_CANVAS,
134815
- preserveDrawingBuffer: true,
134816
- premultipliedAlpha: true,
134817
- antialias: true
134818
- });
134819
- if(!STATIC_CONTEXT) {
134820
- throw new Error('error creating static canvas/context for image server');
134821
- }
134822
- }
134823
- glplotOptions.pixelRatio = scene.pixelRatio;
134824
- glplotOptions.gl = STATIC_CONTEXT;
134825
- glplotOptions.canvas = STATIC_CANVAS;
134826
- }
134827
-
134828
- var failed = 0;
134829
-
134830
- try {
134831
- scene.glplot = createPlot(glplotOptions);
134832
- } catch(e) {
134833
- failed++;
134834
- try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
134835
- scene.glplot = createPlot(glplotOptions);
134836
- } catch(e) {
134837
- failed++;
134838
- }
134839
- }
134840
-
134841
- return failed < 2;
134842
- }
134843
-
134844
- function initializeGLPlot(scene, canvas, gl) {
134845
- scene.initializeGLCamera();
134846
-
134847
- var success = tryCreatePlot(scene, scene.camera, scene.pixelRatio, canvas, gl);
134848
- /*
134849
- * createPlot will throw when webgl is not enabled in the client.
134850
- * Lets return an instance of the module with all functions noop'd.
134851
- * The destroy method - which will remove the container from the DOM
134852
- * is overridden with a function that removes the container only.
134853
- */
134854
- if(!success) return showNoWebGlMsg(scene);
134855
-
134856
- var gd = scene.graphDiv;
134857
- var layout = gd.layout;
134858
-
134859
- var makeUpdate = function() {
134860
- var update = {};
134861
-
134862
- if(scene.isCameraChanged(layout)) {
134863
- // camera updates
134864
- update[scene.id + '.camera'] = scene.getCamera();
134865
- }
134866
-
134867
- if(scene.isAspectChanged(layout)) {
134868
- // scene updates
134869
- update[scene.id + '.aspectratio'] = scene.glplot.getAspectratio();
134870
- }
134871
-
134872
- return update;
134873
- };
134874
-
134875
- var relayoutCallback = function(scene) {
134876
- if(scene.fullSceneLayout.dragmode === false) return;
134877
-
134878
- var update = makeUpdate();
134879
- scene.saveLayout(layout);
134880
- scene.graphDiv.emit('plotly_relayout', update);
134881
- };
134882
-
134883
- scene.glplot.canvas.addEventListener('mouseup', function() {
134884
- relayoutCallback(scene);
134885
- });
134886
-
134887
- scene.glplot.canvas.addEventListener('wheel', function(e) {
134888
- if(gd._context._scrollZoom.gl3d) {
134889
- if(scene.glplot.camera._ortho) {
134890
- var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1;
134891
- var o = scene.glplot.getAspectratio();
134892
- scene.glplot.setAspectratio({
134893
- x: s * o.x,
134894
- y: s * o.y,
134895
- z: s * o.z
134896
- });
134897
- }
134898
-
134899
- relayoutCallback(scene);
134900
- }
134901
- }, passiveSupported ? {passive: false} : false);
134902
-
134903
- scene.glplot.canvas.addEventListener('mousemove', function() {
134904
- if(scene.fullSceneLayout.dragmode === false) return;
134905
- if(scene.camera.mouseListener.buttons === 0) return;
134906
-
134907
- var update = makeUpdate();
134908
- scene.graphDiv.emit('plotly_relayouting', update);
134909
- });
134910
-
134911
- if(!scene.staticMode) {
134912
- scene.glplot.canvas.addEventListener('webglcontextlost', function(event) {
134913
- if(gd && gd.emit) {
134914
- gd.emit('plotly_webglcontextlost', {
134915
- event: event,
134916
- layer: scene.id
134917
- });
134918
- }
134919
- }, false);
134920
- }
134921
-
134922
- scene.glplot.camera = scene.camera;
134923
-
134924
- scene.glplot.oncontextloss = function() {
134925
- scene.recoverContext();
134926
- };
134927
-
134928
- scene.glplot.onrender = render.bind(null, scene);
134929
-
134930
- // List of scene objects
134931
- scene.traces = {};
134932
-
134933
- scene.make4thDimension();
134934
-
134935
- return true;
134936
- }
134937
-
134938
- function Scene(options, fullLayout) {
134939
- // create sub container for plot
134940
- var sceneContainer = document.createElement('div');
134941
- var plotContainer = options.container;
134942
-
134943
- // keep a ref to the graph div to fire hover+click events
134944
- this.graphDiv = options.graphDiv;
134945
-
134946
- // create SVG container for hover text
134947
- var svgContainer = document.createElementNS(
134948
- 'http://www.w3.org/2000/svg',
134949
- 'svg');
134950
- svgContainer.style.position = 'absolute';
134951
- svgContainer.style.top = svgContainer.style.left = '0px';
134952
- svgContainer.style.width = svgContainer.style.height = '100%';
134953
- svgContainer.style['z-index'] = 20;
134954
- svgContainer.style['pointer-events'] = 'none';
134955
- sceneContainer.appendChild(svgContainer);
134956
- this.svgContainer = svgContainer;
134957
-
134958
- // Tag the container with the sceneID
134959
- sceneContainer.id = options.id;
134960
- sceneContainer.style.position = 'absolute';
134961
- sceneContainer.style.top = sceneContainer.style.left = '0px';
134962
- sceneContainer.style.width = sceneContainer.style.height = '100%';
134963
- plotContainer.appendChild(sceneContainer);
134964
-
134965
- this.fullLayout = fullLayout;
134966
- this.id = options.id || 'scene';
134967
- this.fullSceneLayout = fullLayout[this.id];
134968
-
134969
- // Saved from last call to plot()
134970
- this.plotArgs = [ [], {}, {} ];
134971
-
134972
- /*
134973
- * Move this to calc step? Why does it work here?
134974
- */
134975
- this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]);
134976
- this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
134977
- this.container = sceneContainer;
134978
- this.staticMode = !!options.staticPlot;
134979
- this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
134980
-
134981
- // Coordinate rescaling
134982
- this.dataScale = [1, 1, 1];
134983
-
134984
- this.contourLevels = [ [], [], [] ];
134985
-
134986
- this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert');
134987
- this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
134988
-
134989
- initializeGLPlot(this);
134990
- }
134991
-
134992
- var proto = Scene.prototype;
134993
-
134994
- proto.initializeGLCamera = function() {
134995
- var cameraData = this.fullSceneLayout.camera;
134996
- var isOrtho = (cameraData.projection.type === 'orthographic');
134997
-
134998
- this.camera = createCamera(this.container, {
134999
- center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],
135000
- eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],
135001
- up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],
135002
- _ortho: isOrtho,
135003
- zoomMin: 0.01,
135004
- zoomMax: 100,
135005
- mode: 'orbit'
135006
- });
135007
135259
  };
135008
135260
 
135009
135261
  proto.recoverContext = function() {
135010
135262
  var scene = this;
135011
- var gl = this.glplot.gl;
135012
- var canvas = this.glplot.canvas;
135013
135263
 
135014
- this.glplot.dispose();
135264
+ scene.glplot.dispose();
135015
135265
 
135016
- function tryRecover() {
135017
- if(gl.isContextLost()) {
135266
+ var tryRecover = function() {
135267
+ if(scene.glplot.gl.isContextLost()) {
135018
135268
  requestAnimationFrame(tryRecover);
135019
135269
  return;
135020
135270
  }
135021
- if(!initializeGLPlot(scene, canvas, gl)) {
135271
+ if(!scene.initializeGLPlot()) {
135022
135272
  Lib.error('Catastrophic and unrecoverable WebGL error. Context lost.');
135023
135273
  return;
135024
135274
  }
135025
135275
  scene.plot.apply(scene, scene.plotArgs);
135026
- }
135276
+ };
135277
+
135027
135278
  requestAnimationFrame(tryRecover);
135028
135279
  };
135029
135280
 
@@ -135091,39 +135342,35 @@ function computeAnnotationBounds(scene, bounds) {
135091
135342
  }
135092
135343
 
135093
135344
  proto.plot = function(sceneData, fullLayout, layout) {
135345
+ var scene = this;
135346
+
135094
135347
  // Save parameters
135095
- this.plotArgs = [sceneData, fullLayout, layout];
135348
+ scene.plotArgs = [sceneData, fullLayout, layout];
135096
135349
 
135097
- if(this.glplot.contextLost) return;
135350
+ if(scene.glplot.contextLost) return;
135098
135351
 
135099
135352
  var data, trace;
135100
135353
  var i, j, axis, axisType;
135101
- var fullSceneLayout = fullLayout[this.id];
135102
- var sceneLayout = layout[this.id];
135103
-
135104
- if(fullSceneLayout.bgcolor) this.glplot.clearColor = str2RGBAarray(fullSceneLayout.bgcolor);
135105
- else this.glplot.clearColor = [0, 0, 0, 0];
135106
-
135107
- this.glplot.snapToData = true;
135354
+ var fullSceneLayout = fullLayout[scene.id];
135355
+ var sceneLayout = layout[scene.id];
135108
135356
 
135109
135357
  // Update layout
135110
- this.fullLayout = fullLayout;
135111
- this.fullSceneLayout = fullSceneLayout;
135358
+ scene.fullLayout = fullLayout;
135359
+ scene.fullSceneLayout = fullSceneLayout;
135112
135360
 
135113
- this.glplotLayout = fullSceneLayout;
135114
- this.axesOptions.merge(fullLayout, fullSceneLayout);
135115
- this.spikeOptions.merge(fullSceneLayout);
135361
+ scene.axesOptions.merge(fullLayout, fullSceneLayout);
135362
+ scene.spikeOptions.merge(fullSceneLayout);
135116
135363
 
135117
135364
  // Update camera and camera mode
135118
- this.setViewport(fullSceneLayout);
135119
- this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);
135120
- this.camera.enableWheel = this.graphDiv._context._scrollZoom.gl3d;
135365
+ scene.setViewport(fullSceneLayout);
135366
+ scene.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);
135367
+ scene.camera.enableWheel = scene.graphDiv._context._scrollZoom.gl3d;
135121
135368
 
135122
- // Update scene
135123
- this.glplot.update({});
135369
+ // Update scene background
135370
+ scene.glplot.setClearColor(str2RGBAarray(fullSceneLayout.bgcolor));
135124
135371
 
135125
135372
  // Update axes functions BEFORE updating traces
135126
- this.setConvert(axis);
135373
+ scene.setConvert(axis);
135127
135374
 
135128
135375
  // Convert scene data
135129
135376
  if(!sceneData) sceneData = [];
@@ -135153,10 +135400,10 @@ proto.plot = function(sceneData, fullLayout, layout) {
135153
135400
  }
135154
135401
 
135155
135402
  // Save scale
135156
- this.dataScale = dataScale;
135403
+ scene.dataScale = dataScale;
135157
135404
 
135158
135405
  // after computeTraceBounds where ax._categories are filled in
135159
- this.convertAnnotations(this);
135406
+ scene.convertAnnotations(this);
135160
135407
 
135161
135408
  // Update traces
135162
135409
  for(i = 0; i < sceneData.length; ++i) {
@@ -135164,24 +135411,24 @@ proto.plot = function(sceneData, fullLayout, layout) {
135164
135411
  if(data.visible !== true || data._length === 0) {
135165
135412
  continue;
135166
135413
  }
135167
- trace = this.traces[data.uid];
135414
+ trace = scene.traces[data.uid];
135168
135415
  if(trace) {
135169
135416
  if(trace.data.type === data.type) {
135170
135417
  trace.update(data);
135171
135418
  } else {
135172
135419
  trace.dispose();
135173
135420
  trace = data._module.plot(this, data);
135174
- this.traces[data.uid] = trace;
135421
+ scene.traces[data.uid] = trace;
135175
135422
  }
135176
135423
  } else {
135177
135424
  trace = data._module.plot(this, data);
135178
- this.traces[data.uid] = trace;
135425
+ scene.traces[data.uid] = trace;
135179
135426
  }
135180
135427
  trace.name = data.name;
135181
135428
  }
135182
135429
 
135183
135430
  // Remove empty traces
135184
- var traceIds = Object.keys(this.traces);
135431
+ var traceIds = Object.keys(scene.traces);
135185
135432
 
135186
135433
  traceIdLoop:
135187
135434
  for(i = 0; i < traceIds.length; ++i) {
@@ -135191,13 +135438,13 @@ proto.plot = function(sceneData, fullLayout, layout) {
135191
135438
  continue traceIdLoop;
135192
135439
  }
135193
135440
  }
135194
- trace = this.traces[traceIds[i]];
135441
+ trace = scene.traces[traceIds[i]];
135195
135442
  trace.dispose();
135196
- delete this.traces[traceIds[i]];
135443
+ delete scene.traces[traceIds[i]];
135197
135444
  }
135198
135445
 
135199
135446
  // order object per trace index
135200
- this.glplot.objects.sort(function(a, b) {
135447
+ scene.glplot.objects.sort(function(a, b) {
135201
135448
  return a._trace.data.index - b._trace.data.index;
135202
135449
  });
135203
135450
 
@@ -135224,8 +135471,8 @@ proto.plot = function(sceneData, fullLayout, layout) {
135224
135471
  sceneBounds[0][i] = Infinity;
135225
135472
  sceneBounds[1][i] = -Infinity;
135226
135473
 
135227
- var objects = this.glplot.objects;
135228
- var annotations = this.fullSceneLayout.annotations || [];
135474
+ var objects = scene.glplot.objects;
135475
+ var annotations = scene.fullSceneLayout.annotations || [];
135229
135476
  var axLetter = axis._name.charAt(0);
135230
135477
 
135231
135478
  for(j = 0; j < objects.length; j++) {
@@ -135283,8 +135530,10 @@ proto.plot = function(sceneData, fullLayout, layout) {
135283
135530
  axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i];
135284
135531
 
135285
135532
  // Update plot bounds
135286
- this.glplot.bounds[0][i] = sceneBounds[0][i] * dataScale[i];
135287
- this.glplot.bounds[1][i] = sceneBounds[1][i] * dataScale[i];
135533
+ scene.glplot.setBounds(i, {
135534
+ min: sceneBounds[0][i] * dataScale[i],
135535
+ max: sceneBounds[1][i] * dataScale[i]
135536
+ });
135288
135537
  }
135289
135538
 
135290
135539
  var axesScaleRatio = [1, 1, 1];
@@ -135339,11 +135588,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
135339
135588
  * Finally assign the computed aspecratio to the glplot module. This will have an effect
135340
135589
  * on the next render cycle.
135341
135590
  */
135342
- this.glplot.setAspectratio(fullSceneLayout.aspectratio);
135591
+ scene.glplot.setAspectratio(fullSceneLayout.aspectratio);
135343
135592
 
135344
135593
  // save 'initial' camera view settings for modebar button
135345
- if(!this.viewInitial.aspectratio) {
135346
- this.viewInitial.aspectratio = {
135594
+ if(!scene.viewInitial.aspectratio) {
135595
+ scene.viewInitial.aspectratio = {
135347
135596
  x: fullSceneLayout.aspectratio.x,
135348
135597
  y: fullSceneLayout.aspectratio.y,
135349
135598
  z: fullSceneLayout.aspectratio.z
@@ -135355,7 +135604,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
135355
135604
  var size = fullLayout._size || null;
135356
135605
 
135357
135606
  if(domain && size) {
135358
- var containerStyle = this.container.style;
135607
+ var containerStyle = scene.container.style;
135359
135608
  containerStyle.position = 'absolute';
135360
135609
  containerStyle.left = (size.l + domain.x[0] * size.w) + 'px';
135361
135610
  containerStyle.top = (size.t + (1 - domain.y[1]) * size.h) + 'px';
@@ -135364,18 +135613,19 @@ proto.plot = function(sceneData, fullLayout, layout) {
135364
135613
  }
135365
135614
 
135366
135615
  // force redraw so that promise is returned when rendering is completed
135367
- this.glplot.redraw();
135616
+ scene.glplot.redraw();
135368
135617
  };
135369
135618
 
135370
135619
  proto.destroy = function() {
135371
- if(!this.glplot) return;
135620
+ var scene = this;
135372
135621
 
135373
- this.camera.mouseListener.enabled = false;
135374
- this.container.removeEventListener('wheel', this.camera.wheelListener);
135375
- this.camera = this.glplot.camera = null;
135376
- this.glplot.dispose();
135377
- this.container.parentNode.removeChild(this.container);
135378
- this.glplot = null;
135622
+ if(!scene.glplot) return;
135623
+ scene.camera.mouseListener.enabled = false;
135624
+ scene.container.removeEventListener('wheel', scene.camera.wheelListener);
135625
+ scene.camera = null;
135626
+ scene.glplot.dispose();
135627
+ scene.container.parentNode.removeChild(scene.container);
135628
+ scene.glplot = null;
135379
135629
  };
135380
135630
 
135381
135631
  // getCameraArrays :: plotly_coords -> gl-plot3d_coords
@@ -135401,42 +135651,34 @@ function getLayoutCamera(camera) {
135401
135651
 
135402
135652
  // get camera position in plotly coords from 'gl-plot3d' coords
135403
135653
  proto.getCamera = function() {
135404
- this.glplot.camera.view.recalcMatrix(this.camera.view.lastT());
135405
- return getLayoutCamera(this.glplot.camera);
135654
+ var scene = this;
135655
+ scene.camera.view.recalcMatrix(scene.camera.view.lastT());
135656
+ return getLayoutCamera(scene.camera);
135406
135657
  };
135407
135658
 
135408
135659
  // set gl-plot3d camera position and scene aspects with a set of plotly coords
135409
135660
  proto.setViewport = function(sceneLayout) {
135661
+ var scene = this;
135410
135662
  var cameraData = sceneLayout.camera;
135411
135663
 
135412
- this.glplot.camera.lookAt.apply(this, getCameraArrays(cameraData));
135413
- this.glplot.setAspectratio(sceneLayout.aspectratio);
135664
+ scene.camera.lookAt.apply(this, getCameraArrays(cameraData));
135665
+ scene.glplot.setAspectratio(sceneLayout.aspectratio);
135414
135666
 
135415
135667
  var newOrtho = (cameraData.projection.type === 'orthographic');
135416
- var oldOrtho = this.glplot.camera._ortho;
135668
+ var oldOrtho = scene.camera._ortho;
135417
135669
 
135418
135670
  if(newOrtho !== oldOrtho) {
135419
- this.glplot.redraw();
135420
-
135421
- var RGBA = this.glplot.clearColor;
135422
- this.glplot.gl.clearColor(
135423
- RGBA[0], RGBA[1], RGBA[2], RGBA[3]
135424
- );
135425
- this.glplot.gl.clear(
135426
- this.glplot.gl.DEPTH_BUFFER_BIT |
135427
- this.glplot.gl.COLOR_BUFFER_BIT
135428
- );
135429
-
135430
- this.glplot.dispose();
135431
-
135432
- initializeGLPlot(this);
135433
- this.glplot.camera._ortho = newOrtho;
135671
+ scene.glplot.redraw(); // TODO: figure out why we need to redraw here?
135672
+ scene.glplot.clearRGBA();
135673
+ scene.glplot.dispose();
135674
+ scene.initializeGLPlot();
135434
135675
  }
135435
135676
  };
135436
135677
 
135437
135678
  proto.isCameraChanged = function(layout) {
135438
- var cameraData = this.getCamera();
135439
- var cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera');
135679
+ var scene = this;
135680
+ var cameraData = scene.getCamera();
135681
+ var cameraNestedProp = Lib.nestedProperty(layout, scene.id + '.camera');
135440
135682
  var cameraDataLastSave = cameraNestedProp.get();
135441
135683
 
135442
135684
  function same(x, y, i, j) {
@@ -135469,8 +135711,9 @@ proto.isCameraChanged = function(layout) {
135469
135711
  };
135470
135712
 
135471
135713
  proto.isAspectChanged = function(layout) {
135472
- var aspectData = this.glplot.getAspectratio();
135473
- var aspectNestedProp = Lib.nestedProperty(layout, this.id + '.aspectratio');
135714
+ var scene = this;
135715
+ var aspectData = scene.glplot.getAspectratio();
135716
+ var aspectNestedProp = Lib.nestedProperty(layout, scene.id + '.aspectratio');
135474
135717
  var aspectDataLastSave = aspectNestedProp.get();
135475
135718
 
135476
135719
  return (
@@ -135483,7 +135726,8 @@ proto.isAspectChanged = function(layout) {
135483
135726
 
135484
135727
  // save camera to user layout (i.e. gd.layout)
135485
135728
  proto.saveLayout = function(layout) {
135486
- var fullLayout = this.fullLayout;
135729
+ var scene = this;
135730
+ var fullLayout = scene.fullLayout;
135487
135731
 
135488
135732
  var cameraData;
135489
135733
  var cameraNestedProp;
@@ -135493,42 +135737,42 @@ proto.saveLayout = function(layout) {
135493
135737
  var aspectNestedProp;
135494
135738
  var aspectDataLastSave;
135495
135739
 
135496
- var cameraChanged = this.isCameraChanged(layout);
135497
- var aspectChanged = this.isAspectChanged(layout);
135740
+ var cameraChanged = scene.isCameraChanged(layout);
135741
+ var aspectChanged = scene.isAspectChanged(layout);
135498
135742
 
135499
135743
  var hasChanged = cameraChanged || aspectChanged;
135500
135744
  if(hasChanged) {
135501
135745
  var preGUI = {};
135502
135746
  if(cameraChanged) {
135503
- cameraData = this.getCamera();
135504
- cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera');
135747
+ cameraData = scene.getCamera();
135748
+ cameraNestedProp = Lib.nestedProperty(layout, scene.id + '.camera');
135505
135749
  cameraDataLastSave = cameraNestedProp.get();
135506
135750
 
135507
- preGUI[this.id + '.camera'] = cameraDataLastSave;
135751
+ preGUI[scene.id + '.camera'] = cameraDataLastSave;
135508
135752
  }
135509
135753
  if(aspectChanged) {
135510
- aspectData = this.glplot.getAspectratio();
135511
- aspectNestedProp = Lib.nestedProperty(layout, this.id + '.aspectratio');
135754
+ aspectData = scene.glplot.getAspectratio();
135755
+ aspectNestedProp = Lib.nestedProperty(layout, scene.id + '.aspectratio');
135512
135756
  aspectDataLastSave = aspectNestedProp.get();
135513
135757
 
135514
- preGUI[this.id + '.aspectratio'] = aspectDataLastSave;
135758
+ preGUI[scene.id + '.aspectratio'] = aspectDataLastSave;
135515
135759
  }
135516
135760
  Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, preGUI);
135517
135761
 
135518
135762
  if(cameraChanged) {
135519
135763
  cameraNestedProp.set(cameraData);
135520
135764
 
135521
- var cameraFullNP = Lib.nestedProperty(fullLayout, this.id + '.camera');
135765
+ var cameraFullNP = Lib.nestedProperty(fullLayout, scene.id + '.camera');
135522
135766
  cameraFullNP.set(cameraData);
135523
135767
  }
135524
135768
 
135525
135769
  if(aspectChanged) {
135526
135770
  aspectNestedProp.set(aspectData);
135527
135771
 
135528
- var aspectFullNP = Lib.nestedProperty(fullLayout, this.id + '.aspectratio');
135772
+ var aspectFullNP = Lib.nestedProperty(fullLayout, scene.id + '.aspectratio');
135529
135773
  aspectFullNP.set(aspectData);
135530
135774
 
135531
- this.glplot.redraw();
135775
+ scene.glplot.redraw();
135532
135776
  }
135533
135777
  }
135534
135778
 
@@ -135536,7 +135780,8 @@ proto.saveLayout = function(layout) {
135536
135780
  };
135537
135781
 
135538
135782
  proto.updateFx = function(dragmode, hovermode) {
135539
- var camera = this.camera;
135783
+ var scene = this;
135784
+ var camera = scene.camera;
135540
135785
  if(camera) {
135541
135786
  // rotate and orbital are synonymous
135542
135787
  if(dragmode === 'orbit') {
@@ -135550,15 +135795,15 @@ proto.updateFx = function(dragmode, hovermode) {
135550
135795
  // The setter for camera.mode animates the transition to z-up,
135551
135796
  // but only if we *don't* explicitly set z-up earlier via the
135552
135797
  // relayout. So push `up` back to layout & fullLayout manually now.
135553
- var gd = this.graphDiv;
135798
+ var gd = scene.graphDiv;
135554
135799
  var fullLayout = gd._fullLayout;
135555
- var fullCamera = this.fullSceneLayout.camera;
135800
+ var fullCamera = scene.fullSceneLayout.camera;
135556
135801
  var x = fullCamera.up.x;
135557
135802
  var y = fullCamera.up.y;
135558
135803
  var z = fullCamera.up.z;
135559
135804
  // only push `up` back to (full)layout if it's going to change
135560
135805
  if(z / Math.sqrt(x * x + y * y + z * z) < 0.999) {
135561
- var attr = this.id + '.camera.up';
135806
+ var attr = scene.id + '.camera.up';
135562
135807
  var zUp = {x: 0, y: 0, z: 1};
135563
135808
  var edits = {};
135564
135809
  edits[attr] = zUp;
@@ -135574,19 +135819,20 @@ proto.updateFx = function(dragmode, hovermode) {
135574
135819
  }
135575
135820
 
135576
135821
  // to put dragmode and hovermode on the same grounds from relayout
135577
- this.fullSceneLayout.hovermode = hovermode;
135822
+ scene.fullSceneLayout.hovermode = hovermode;
135578
135823
  };
135579
135824
 
135580
135825
  proto.toImage = function(format) {
135581
- if(!format) format = 'png';
135826
+ var scene = this;
135582
135827
 
135583
- if(this.staticMode) this.container.appendChild(STATIC_CANVAS);
135828
+ if(!format) format = 'png';
135829
+ if(scene.staticMode) scene.container.appendChild(STATIC_CANVAS);
135584
135830
 
135585
135831
  // Force redraw
135586
- this.glplot.redraw();
135832
+ scene.glplot.redraw();
135587
135833
 
135588
135834
  // Grab context and yank out pixels
135589
- var gl = this.glplot.gl;
135835
+ var gl = scene.glplot.gl;
135590
135836
  var w = gl.drawingBufferWidth;
135591
135837
  var h = gl.drawingBufferHeight;
135592
135838
 
@@ -135627,36 +135873,37 @@ proto.toImage = function(format) {
135627
135873
  dataURL = canvas.toDataURL('image/png');
135628
135874
  }
135629
135875
 
135630
- if(this.staticMode) this.container.removeChild(STATIC_CANVAS);
135876
+ if(scene.staticMode) scene.container.removeChild(STATIC_CANVAS);
135631
135877
 
135632
135878
  return dataURL;
135633
135879
  };
135634
135880
 
135635
135881
  proto.setConvert = function() {
135882
+ var scene = this;
135636
135883
  for(var i = 0; i < 3; i++) {
135637
- var ax = this.fullSceneLayout[axisProperties[i]];
135638
- Axes.setConvert(ax, this.fullLayout);
135884
+ var ax = scene.fullSceneLayout[axisProperties[i]];
135885
+ Axes.setConvert(ax, scene.fullLayout);
135639
135886
  ax.setScale = Lib.noop;
135640
135887
  }
135641
135888
  };
135642
135889
 
135643
135890
  proto.make4thDimension = function() {
135644
- var _this = this;
135645
- var gd = _this.graphDiv;
135891
+ var scene = this;
135892
+ var gd = scene.graphDiv;
135646
135893
  var fullLayout = gd._fullLayout;
135647
135894
 
135648
135895
  // mock axis for hover formatting
135649
- _this.mockAxis = {
135896
+ scene._mockAxis = {
135650
135897
  type: 'linear',
135651
135898
  showexponent: 'all',
135652
135899
  exponentformat: 'B'
135653
135900
  };
135654
- Axes.setConvert(_this.mockAxis, fullLayout);
135901
+ Axes.setConvert(scene._mockAxis, fullLayout);
135655
135902
  };
135656
135903
 
135657
135904
  module.exports = Scene;
135658
135905
 
135659
- },{"../../components/fx":630,"../../lib":717,"../../lib/show_no_webgl_msg":738,"../../lib/str2rgbarray":740,"../../plots/cartesian/axes":765,"../../registry":846,"./layout/convert":809,"./layout/spikes":812,"./layout/tick_marks":813,"./project":814,"gl-plot3d":293,"has-passive-events":413,"webgl-context":555}],816:[function(_dereq_,module,exports){
135906
+ },{"../../components/fx":630,"../../lib":717,"../../lib/show_no_webgl_msg":738,"../../lib/str2rgbarray":740,"../../plots/cartesian/axes":765,"../../registry":846,"./layout/convert":809,"./layout/spikes":812,"./layout/tick_marks":813,"./project":814,"gl-plot3d":293,"has-passive-events":413,"is-mobile":422,"webgl-context":555}],816:[function(_dereq_,module,exports){
135660
135907
  /**
135661
135908
  * Copyright 2012-2020, Plotly, Inc.
135662
135909
  * All rights reserved.
@@ -136841,7 +137088,8 @@ function convertOpts(opts) {
136841
137088
  break;
136842
137089
  case 'raster':
136843
137090
  Lib.extendFlat(paint, {
136844
- 'raster-fade-duration': 0
137091
+ 'raster-fade-duration': 0,
137092
+ 'raster-opacity': opts.opacity
136845
137093
  });
136846
137094
  break;
136847
137095
  }
@@ -139360,10 +139608,13 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
139360
139608
  var subplots = layout._subplots;
139361
139609
  var subplotId = '';
139362
139610
 
139363
- // TODO - currently if we draw an empty gl2d subplot, it draws
139364
- // nothing then gets stuck and you can't get it back without newPlot
139365
- // sort this out in the regl refactor? but for now just drop empty gl2d subplots
139366
- if(basePlotModule.name !== 'gl2d' || visible) {
139611
+ if(
139612
+ visible ||
139613
+ basePlotModule.name !== 'gl2d' // for now just drop empty gl2d subplots
139614
+ // TODO - currently if we draw an empty gl2d subplot, it draws
139615
+ // nothing then gets stuck and you can't get it back without newPlot
139616
+ // sort this out in the regl refactor?
139617
+ ) {
139367
139618
  if(Array.isArray(subplotAttr)) {
139368
139619
  for(i = 0; i < subplotAttr.length; i++) {
139369
139620
  var attri = subplotAttr[i];
@@ -141022,7 +141273,7 @@ plots.doCalcdata = function(gd, traces) {
141022
141273
  calcdata[i] = cd;
141023
141274
  }
141024
141275
 
141025
- setupAxisCategories(axList, fullData);
141276
+ setupAxisCategories(axList, fullData, fullLayout);
141026
141277
 
141027
141278
  // 'transform' loop - must calc container traces first
141028
141279
  // so that if their dependent traces can get transform properly
@@ -141030,7 +141281,7 @@ plots.doCalcdata = function(gd, traces) {
141030
141281
  for(i = 0; i < fullData.length; i++) transformCalci(i);
141031
141282
 
141032
141283
  // clear stuff that should recomputed in 'regular' loop
141033
- if(hasCalcTransform) setupAxisCategories(axList, fullData);
141284
+ if(hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout);
141034
141285
 
141035
141286
  // 'regular' loop - make sure container traces (eg carpet) calc before
141036
141287
  // contained traces (eg contourcarpet)
@@ -141235,13 +141486,31 @@ function sortAxisCategoriesByValue(axList, gd) {
141235
141486
  return affectedTraces;
141236
141487
  }
141237
141488
 
141238
- function setupAxisCategories(axList, fullData) {
141239
- for(var i = 0; i < axList.length; i++) {
141240
- var ax = axList[i];
141489
+ function setupAxisCategories(axList, fullData, fullLayout) {
141490
+ var axLookup = {};
141491
+ var i, ax, axId;
141492
+
141493
+ for(i = 0; i < axList.length; i++) {
141494
+ ax = axList[i];
141495
+ axId = ax._id;
141496
+
141241
141497
  ax.clearCalc();
141242
141498
  if(ax.type === 'multicategory') {
141243
141499
  ax.setupMultiCategory(fullData);
141244
141500
  }
141501
+
141502
+ axLookup[ax._id] = 1;
141503
+ }
141504
+
141505
+ // look into match groups for 'missing' axes
141506
+ var matchGroups = fullLayout._axisMatchGroups || [];
141507
+ for(i = 0; i < matchGroups.length; i++) {
141508
+ for(axId in matchGroups[i]) {
141509
+ if(!axLookup[axId]) {
141510
+ ax = fullLayout[axisIDs.id2name(axId)];
141511
+ ax.clearCalc();
141512
+ }
141513
+ }
141245
141514
  }
141246
141515
  }
141247
141516
 
@@ -149705,7 +149974,12 @@ function hoverOnBars(pointData, xval, yval, hovermode) {
149705
149974
  var s = di[sizeLetter];
149706
149975
 
149707
149976
  if(isWaterfall) {
149708
- s += Math.abs(di.rawS || 0);
149977
+ var rawS = Math.abs(di.rawS) || 0;
149978
+ if(v > 0) {
149979
+ s += rawS;
149980
+ } else if(v < 0) {
149981
+ s -= rawS;
149982
+ }
149709
149983
  }
149710
149984
 
149711
149985
  // add a gradient so hovering near the end of a
@@ -150092,6 +150366,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
150092
150366
  !isNumeric(y0) ||
150093
150367
  !isNumeric(y1)
150094
150368
  );
150369
+
150095
150370
  // display zeros if line.width > 0
150096
150371
  if(isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di) && (isHorizontal ? x1 - x0 === 0 : y1 - y0 === 0)) {
150097
150372
  isBlank = false;
@@ -150101,6 +150376,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
150101
150376
  if(isBlank && isHorizontal) x1 = x0;
150102
150377
  if(isBlank && !isHorizontal) y1 = y0;
150103
150378
 
150379
+ var spansHorizontal = isHorizontal && (x0 !== x1);
150380
+ var spansVertical = !isHorizontal && (y0 !== y1);
150381
+
150104
150382
  // in waterfall mode `between` we need to adjust bar end points to match the connector width
150105
150383
  if(adjustPixel && !isBlank) {
150106
150384
  if(isHorizontal) {
@@ -150155,10 +150433,15 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
150155
150433
 
150156
150434
  var op = Color.opacity(mc);
150157
150435
  var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible;
150158
- x0 = fixpx(x0, x1);
150159
- x1 = fixpx(x1, x0);
150160
- y0 = fixpx(y0, y1);
150161
- y1 = fixpx(y1, y0);
150436
+
150437
+ if(spansHorizontal) {
150438
+ x0 = fixpx(x0, x1);
150439
+ x1 = fixpx(x1, x0);
150440
+ }
150441
+ if(spansVertical) {
150442
+ y0 = fixpx(y0, y1);
150443
+ y1 = fixpx(y1, y0);
150444
+ }
150162
150445
  }
150163
150446
 
150164
150447
  var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback);
@@ -171798,11 +172081,15 @@ proto.handlePick = function(selection) {
171798
172081
  if(selection.object === this.mesh) {
171799
172082
  var selectIndex = selection.index = selection.data.index;
171800
172083
 
171801
- selection.traceCoordinate = [
171802
- this.data.x[selectIndex],
171803
- this.data.y[selectIndex],
171804
- this.data.z[selectIndex]
171805
- ];
172084
+ if(selection.data._cellCenter) {
172085
+ selection.traceCoordinate = selection.data.dataCoordinate;
172086
+ } else {
172087
+ selection.traceCoordinate = [
172088
+ this.data.x[selectIndex],
172089
+ this.data.y[selectIndex],
172090
+ this.data.z[selectIndex]
172091
+ ];
172092
+ }
171806
172093
 
171807
172094
  var text = this.data.hovertext || this.data.text;
171808
172095
  if(Array.isArray(text) && text[selectIndex] !== undefined) {
@@ -200521,6 +200808,8 @@ function plotOne(gd, cd, element, transitionOpts) {
200521
200808
  hasTransition: hasTransition,
200522
200809
  strTransform: strTransform
200523
200810
  });
200811
+ } else {
200812
+ selAncestors.remove();
200524
200813
  }
200525
200814
  }
200526
200815