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
@@ -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
@@ -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
 
@@ -82756,7 +82867,7 @@ module.exports = templatedArray('annotation', {
82756
82867
  editType: 'arraydraw',
82757
82868
  description: [
82758
82869
  'Sets the horizontal alignment of the `text` within the box.',
82759
- 'Has an effect only if `text` spans more two or more lines',
82870
+ 'Has an effect only if `text` spans two or more lines',
82760
82871
  '(i.e. `text` contains one or more <br> HTML tags) or if an',
82761
82872
  'explicit width is set to override the text width.'
82762
82873
  ].join(' ')
@@ -103639,7 +103750,7 @@ exports.svgAttrs = {
103639
103750
  'use strict';
103640
103751
 
103641
103752
  // package version injected by `npm run preprocess`
103642
- exports.version = '1.52.1';
103753
+ exports.version = '1.52.2';
103643
103754
 
103644
103755
  // inject promise polyfill
103645
103756
  _dereq_('es6-promise').polyfill();
@@ -107921,11 +108032,14 @@ lib.templateString = function(string, obj) {
107921
108032
  var getterCache = {};
107922
108033
 
107923
108034
  return string.replace(lib.TEMPLATE_STRING_REGEX, function(dummy, key) {
108035
+ var v;
107924
108036
  if(SIMPLE_PROPERTY_REGEX.test(key)) {
107925
- return obj[key] || '';
108037
+ v = obj[key];
108038
+ } else {
108039
+ getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get;
108040
+ v = getterCache[key]();
107926
108041
  }
107927
- getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get;
107928
- return getterCache[key]() || '';
108042
+ return lib.isValidTextValue(v) ? v : '';
107929
108043
  });
107930
108044
  };
107931
108045
 
@@ -118529,6 +118643,7 @@ exports.doAutoRangeAndConstraints = function(gd) {
118529
118643
  var fullLayout = gd._fullLayout;
118530
118644
  var axList = Axes.list(gd, '', true);
118531
118645
  var matchGroups = fullLayout._axisMatchGroups || [];
118646
+ var axLookup = {};
118532
118647
  var ax;
118533
118648
  var axRng;
118534
118649
 
@@ -118536,6 +118651,7 @@ exports.doAutoRangeAndConstraints = function(gd) {
118536
118651
  ax = axList[i];
118537
118652
  cleanAxisConstraints(gd, ax);
118538
118653
  doAutoRange(gd, ax);
118654
+ axLookup[ax._id] = 1;
118539
118655
  }
118540
118656
 
118541
118657
  enforceAxisConstraints(gd);
@@ -118548,6 +118664,10 @@ exports.doAutoRangeAndConstraints = function(gd) {
118548
118664
 
118549
118665
  for(id in group) {
118550
118666
  ax = Axes.getFromId(gd, id);
118667
+
118668
+ // skip over 'missing' axes which do not pass through doAutoRange
118669
+ if(!axLookup[ax._id]) continue;
118670
+ // if one axis has autorange false, we're done
118551
118671
  if(ax.autorange === false) continue groupLoop;
118552
118672
 
118553
118673
  axRng = Lib.simpleMap(ax.range, ax.r2l);
@@ -119447,13 +119567,14 @@ function crawl(objIn, objOut, schema, list, base, path) {
119447
119567
  var valOut = objOut[k];
119448
119568
 
119449
119569
  var nestedSchema = getNestedSchema(schema, k);
119450
- var isInfoArray = (nestedSchema || {}).valType === 'info_array';
119451
- var isColorscale = (nestedSchema || {}).valType === 'colorscale';
119570
+ var nestedValType = (nestedSchema || {}).valType;
119571
+ var isInfoArray = nestedValType === 'info_array';
119572
+ var isColorscale = nestedValType === 'colorscale';
119452
119573
  var items = (nestedSchema || {}).items;
119453
119574
 
119454
119575
  if(!isInSchema(schema, k)) {
119455
119576
  list.push(format('schema', base, p));
119456
- } else if(isPlainObject(valIn) && isPlainObject(valOut)) {
119577
+ } else if(isPlainObject(valIn) && isPlainObject(valOut) && nestedValType !== 'any') {
119457
119578
  crawl(valIn, valOut, nestedSchema, list, base, p);
119458
119579
  } else if(isInfoArray && isArray(valIn)) {
119459
119580
  if(valIn.length > valOut.length) {
@@ -122372,10 +122493,14 @@ axes.drawOne = function(gd, ax, opts) {
122372
122493
  var axId = ax._id;
122373
122494
  var axLetter = axId.charAt(0);
122374
122495
  var counterLetter = axes.counterLetter(axId);
122375
- var mainLinePosition = ax._mainLinePosition;
122376
- var mainMirrorPosition = ax._mainMirrorPosition;
122377
122496
  var mainPlotinfo = fullLayout._plots[ax._mainSubplot];
122497
+
122498
+ // this happens when updating matched group with 'missing' axes
122499
+ if(!mainPlotinfo) return;
122500
+
122378
122501
  var mainAxLayer = mainPlotinfo[axLetter + 'axislayer'];
122502
+ var mainLinePosition = ax._mainLinePosition;
122503
+ var mainMirrorPosition = ax._mainMirrorPosition;
122379
122504
 
122380
122505
  var vals = ax._vals = axes.calcTicks(ax);
122381
122506
 
@@ -124334,11 +124459,10 @@ exports.tick0 = function(tick0, axType, calendar, dtick) {
124334
124459
  */
124335
124460
 
124336
124461
  'use strict';
124337
- var counterRegex = _dereq_('../../lib/regex').counter;
124338
124462
 
124463
+ var counterRegex = _dereq_('../../lib/regex').counter;
124339
124464
 
124340
124465
  module.exports = {
124341
-
124342
124466
  idRegex: {
124343
124467
  x: counterRegex('x'),
124344
124468
  y: counterRegex('y')
@@ -127840,6 +127964,8 @@ var axisIds = _dereq_('./axis_ids');
127840
127964
  var id2name = axisIds.id2name;
127841
127965
  var name2id = axisIds.name2id;
127842
127966
 
127967
+ var AX_ID_PATTERN = _dereq_('./constants').AX_ID_PATTERN;
127968
+
127843
127969
  var Registry = _dereq_('../../registry');
127844
127970
  var traceIs = Registry.traceIs;
127845
127971
  var getComponentMethod = Registry.getComponentMethod;
@@ -127949,7 +128075,28 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
127949
128075
 
127950
128076
  var bgColor = Color.combine(plotBgColor, layoutOut.paper_bgcolor);
127951
128077
 
127952
- var axName, axLetter, axLayoutIn, axLayoutOut;
128078
+ // name of single axis (e.g. 'xaxis', 'yaxis2')
128079
+ var axName;
128080
+ // id of single axis (e.g. 'y', 'x5')
128081
+ var axId;
128082
+ // 'x' or 'y'
128083
+ var axLetter;
128084
+ // input layout axis container
128085
+ var axLayoutIn;
128086
+ // full layout axis container
128087
+ var axLayoutOut;
128088
+
128089
+ function newAxLayoutOut() {
128090
+ var traces = ax2traces[axName] || [];
128091
+ axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; });
128092
+ axLayoutOut._annIndices = [];
128093
+ axLayoutOut._shapeIndices = [];
128094
+ axLayoutOut._imgIndices = [];
128095
+ axLayoutOut._subplotsWith = [];
128096
+ axLayoutOut._counterAxes = [];
128097
+ axLayoutOut._name = axLayoutOut._attr = axName;
128098
+ axLayoutOut._id = axId;
128099
+ }
127953
128100
 
127954
128101
  function coerce(attr, dflt) {
127955
128102
  return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt);
@@ -127963,9 +128110,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
127963
128110
  return (axLetter === 'x') ? yIds : xIds;
127964
128111
  }
127965
128112
 
127966
- var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')};
127967
- var allAxisIds = counterAxes.x.concat(counterAxes.y);
127968
-
127969
128113
  function getOverlayableAxes(axLetter, axName) {
127970
128114
  var list = (axLetter === 'x') ? xNames : yNames;
127971
128115
  var out = [];
@@ -127981,9 +128125,30 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
127981
128125
  return out;
127982
128126
  }
127983
128127
 
128128
+ // list of available counter axis names
128129
+ var counterAxes = {x: getCounterAxes('x'), y: getCounterAxes('y')};
128130
+ // list of all x AND y axis ids
128131
+ var allAxisIds = counterAxes.x.concat(counterAxes.y);
128132
+ // lookup and list of axis ids that axes in axNames have a reference to,
128133
+ // even though they are missing from allAxisIds
128134
+ var missingMatchedAxisIdsLookup = {};
128135
+ var missingMatchedAxisIds = [];
128136
+
128137
+ // fill in 'missing' axis lookup when an axis is set to match an axis
128138
+ // not part of the allAxisIds list, save axis type so that we can propagate
128139
+ // it to the missing axes
128140
+ function addMissingMatchedAxis() {
128141
+ var matchesIn = axLayoutIn.matches;
128142
+ if(AX_ID_PATTERN.test(matchesIn) && allAxisIds.indexOf(matchesIn) === -1) {
128143
+ missingMatchedAxisIdsLookup[matchesIn] = axLayoutIn.type;
128144
+ missingMatchedAxisIds = Object.keys(missingMatchedAxisIdsLookup);
128145
+ }
128146
+ }
128147
+
127984
128148
  // first pass creates the containers, determines types, and handles most of the settings
127985
128149
  for(i = 0; i < axNames.length; i++) {
127986
128150
  axName = axNames[i];
128151
+ axId = name2id(axName);
127987
128152
  axLetter = axName.charAt(0);
127988
128153
 
127989
128154
  if(!Lib.isPlainObject(layoutIn[axName])) {
@@ -127992,20 +128157,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
127992
128157
 
127993
128158
  axLayoutIn = layoutIn[axName];
127994
128159
  axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis');
127995
-
127996
- var traces = ax2traces[axName] || [];
127997
- axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; });
127998
- axLayoutOut._annIndices = [];
127999
- axLayoutOut._shapeIndices = [];
128000
- axLayoutOut._imgIndices = [];
128001
- axLayoutOut._subplotsWith = [];
128002
- axLayoutOut._counterAxes = [];
128003
-
128004
- // set up some private properties
128005
- axLayoutOut._name = axLayoutOut._attr = axName;
128006
- var id = axLayoutOut._id = name2id(axName);
128007
-
128008
- var overlayableAxes = getOverlayableAxes(axLetter, axName);
128160
+ newAxLayoutOut();
128009
128161
 
128010
128162
  var visibleDflt =
128011
128163
  (axLetter === 'x' && !xaMustDisplay[axName] && xaMayHide[axName]) ||
@@ -128023,13 +128175,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128023
128175
  font: layoutOut.font,
128024
128176
  outerTicks: outerTicks[axName],
128025
128177
  showGrid: !noGrids[axName],
128026
- data: traces,
128178
+ data: ax2traces[axName] || [],
128027
128179
  bgColor: bgColor,
128028
128180
  calendar: layoutOut.calendar,
128029
128181
  automargin: true,
128030
128182
  visibleDflt: visibleDflt,
128031
128183
  reverseDflt: reverseDflt,
128032
- splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[id]
128184
+ splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
128033
128185
  };
128034
128186
 
128035
128187
  coerce('uirevision', layoutOut.uirevision);
@@ -128055,12 +128207,63 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128055
128207
  handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {
128056
128208
  letter: axLetter,
128057
128209
  counterAxes: counterAxes[axLetter],
128058
- overlayableAxes: overlayableAxes,
128210
+ overlayableAxes: getOverlayableAxes(axLetter, axName),
128059
128211
  grid: layoutOut.grid
128060
128212
  });
128061
128213
 
128062
128214
  coerce('title.standoff');
128063
128215
 
128216
+ addMissingMatchedAxis();
128217
+
128218
+ axLayoutOut._input = axLayoutIn;
128219
+ }
128220
+
128221
+ // coerce the 'missing' axes
128222
+ i = 0;
128223
+ while(i < missingMatchedAxisIds.length) {
128224
+ axId = missingMatchedAxisIds[i++];
128225
+ axName = id2name(axId);
128226
+ axLetter = axName.charAt(0);
128227
+
128228
+ if(!Lib.isPlainObject(layoutIn[axName])) {
128229
+ layoutIn[axName] = {};
128230
+ }
128231
+
128232
+ axLayoutIn = layoutIn[axName];
128233
+ axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + 'axis');
128234
+ newAxLayoutOut();
128235
+
128236
+ var defaultOptions2 = {
128237
+ letter: axLetter,
128238
+ font: layoutOut.font,
128239
+ outerTicks: outerTicks[axName],
128240
+ showGrid: !noGrids[axName],
128241
+ data: [],
128242
+ bgColor: bgColor,
128243
+ calendar: layoutOut.calendar,
128244
+ automargin: true,
128245
+ visibleDflt: false,
128246
+ reverseDflt: false,
128247
+ splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
128248
+ };
128249
+
128250
+ coerce('uirevision', layoutOut.uirevision);
128251
+
128252
+ axLayoutOut.type = missingMatchedAxisIdsLookup[axId] || 'linear';
128253
+
128254
+ handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions2, layoutOut);
128255
+
128256
+ handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, {
128257
+ letter: axLetter,
128258
+ counterAxes: counterAxes[axLetter],
128259
+ overlayableAxes: getOverlayableAxes(axLetter, axName),
128260
+ grid: layoutOut.grid
128261
+ });
128262
+
128263
+ coerce('fixedrange');
128264
+
128265
+ addMissingMatchedAxis();
128266
+
128064
128267
  axLayoutOut._input = axLayoutIn;
128065
128268
  }
128066
128269
 
@@ -128111,9 +128314,12 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128111
128314
  var constraintGroups = layoutOut._axisConstraintGroups = [];
128112
128315
  // similar to _axisConstraintGroups, but for matching axes
128113
128316
  var matchGroups = layoutOut._axisMatchGroups = [];
128317
+ // make sure to include 'missing' axes here
128318
+ var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds);
128319
+ var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name));
128114
128320
 
128115
- for(i = 0; i < axNames.length; i++) {
128116
- axName = axNames[i];
128321
+ for(i = 0; i < axNamesIncludingMissing.length; i++) {
128322
+ axName = axNamesIncludingMissing[i];
128117
128323
  axLetter = axName.charAt(0);
128118
128324
  axLayoutIn = layoutIn[axName];
128119
128325
  axLayoutOut = layoutOut[axName];
@@ -128121,15 +128327,19 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128121
128327
  var scaleanchorDflt;
128122
128328
  if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) {
128123
128329
  scaleanchorDflt = axLayoutOut.anchor;
128124
- } else {scaleanchorDflt = undefined;}
128330
+ } else {
128331
+ scaleanchorDflt = undefined;
128332
+ }
128125
128333
 
128126
128334
  var constrainDflt;
128127
128335
  if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) {
128128
128336
  constrainDflt = 'domain';
128129
- } else {constrainDflt = undefined;}
128337
+ } else {
128338
+ constrainDflt = undefined;
128339
+ }
128130
128340
 
128131
128341
  handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, {
128132
- allAxisIds: allAxisIds,
128342
+ allAxisIds: allAxisIdsIncludingMissing,
128133
128343
  layoutOut: layoutOut,
128134
128344
  scaleanchorDflt: scaleanchorDflt,
128135
128345
  constrainDflt: constrainDflt
@@ -128140,7 +128350,6 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128140
128350
  var group = matchGroups[i];
128141
128351
  var rng = null;
128142
128352
  var autorange = null;
128143
- var axId;
128144
128353
 
128145
128354
  // find 'matching' range attrs
128146
128355
  for(axId in group) {
@@ -128193,7 +128402,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
128193
128402
  }
128194
128403
  };
128195
128404
 
128196
- },{"../../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){
128405
+ },{"../../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){
128197
128406
  /**
128198
128407
  * Copyright 2012-2020, Plotly, Inc.
128199
128408
  * All rights reserved.
@@ -136413,10 +136622,269 @@ var createAxesOptions = _dereq_('./layout/convert');
136413
136622
  var createSpikeOptions = _dereq_('./layout/spikes');
136414
136623
  var computeTickMarks = _dereq_('./layout/tick_marks');
136415
136624
 
136625
+ var isMobile = _dereq_('is-mobile');
136626
+ var tablet = isTablet();
136627
+
136628
+ function isTablet() {
136629
+ if(!navigator) return false;
136630
+
136631
+ var ua;
136632
+ // same interface as applied by is-mobile module
136633
+ if(!ua && typeof navigator !== 'undefined') ua = navigator.userAgent;
136634
+ if(ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
136635
+ ua = ua.headers['user-agent'];
136636
+ }
136637
+ if(typeof ua !== 'string') return false;
136638
+
136639
+ var result = isMobile({
136640
+ ua: ua,
136641
+ tablet: true
136642
+ });
136643
+
136644
+ // handle iPad pro or iPad with iOs 13 using Safari
136645
+ // see https://github.com/plotly/plotly.js/issues/4502
136646
+ if(
136647
+ result === false &&
136648
+ ua.indexOf('Macintosh') !== -1 &&
136649
+ ua.indexOf('Safari') !== -1 &&
136650
+ navigator.maxTouchPoints > 1
136651
+ ) {
136652
+ result = true;
136653
+ }
136654
+
136655
+ return result;
136656
+ }
136657
+
136416
136658
 
136417
136659
  var STATIC_CANVAS, STATIC_CONTEXT;
136418
136660
 
136419
- function render(scene) {
136661
+ function Scene(options, fullLayout) {
136662
+ // create sub container for plot
136663
+ var sceneContainer = document.createElement('div');
136664
+ var plotContainer = options.container;
136665
+
136666
+ // keep a ref to the graph div to fire hover+click events
136667
+ this.graphDiv = options.graphDiv;
136668
+
136669
+ // create SVG container for hover text
136670
+ var svgContainer = document.createElementNS(
136671
+ 'http://www.w3.org/2000/svg',
136672
+ 'svg');
136673
+ svgContainer.style.position = 'absolute';
136674
+ svgContainer.style.top = svgContainer.style.left = '0px';
136675
+ svgContainer.style.width = svgContainer.style.height = '100%';
136676
+ svgContainer.style['z-index'] = 20;
136677
+ svgContainer.style['pointer-events'] = 'none';
136678
+ sceneContainer.appendChild(svgContainer);
136679
+ this.svgContainer = svgContainer;
136680
+
136681
+ // Tag the container with the sceneID
136682
+ sceneContainer.id = options.id;
136683
+ sceneContainer.style.position = 'absolute';
136684
+ sceneContainer.style.top = sceneContainer.style.left = '0px';
136685
+ sceneContainer.style.width = sceneContainer.style.height = '100%';
136686
+ plotContainer.appendChild(sceneContainer);
136687
+
136688
+ this.fullLayout = fullLayout;
136689
+ this.id = options.id || 'scene';
136690
+ this.fullSceneLayout = fullLayout[this.id];
136691
+
136692
+ // Saved from last call to plot()
136693
+ this.plotArgs = [ [], {}, {} ];
136694
+
136695
+ /*
136696
+ * Move this to calc step? Why does it work here?
136697
+ */
136698
+ this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]);
136699
+ this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
136700
+ this.container = sceneContainer;
136701
+ this.staticMode = !!options.staticPlot;
136702
+ this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
136703
+
136704
+ // Coordinate rescaling
136705
+ this.dataScale = [1, 1, 1];
136706
+
136707
+ this.contourLevels = [ [], [], [] ];
136708
+
136709
+ this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert');
136710
+ this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
136711
+
136712
+ this.initializeGLPlot();
136713
+ }
136714
+
136715
+ var proto = Scene.prototype;
136716
+
136717
+ proto.tryCreatePlot = function() {
136718
+ var scene = this;
136719
+ var opts = {
136720
+ canvas: scene.canvas,
136721
+ gl: scene.gl,
136722
+ glOptions: {
136723
+ preserveDrawingBuffer: tablet,
136724
+ premultipliedAlpha: true,
136725
+ antialias: true
136726
+ },
136727
+ container: scene.container,
136728
+ axes: scene.axesOptions,
136729
+ spikes: scene.spikeOptions,
136730
+ pickRadius: 10,
136731
+ snapToData: true,
136732
+ autoScale: true,
136733
+ autoBounds: false,
136734
+ cameraObject: scene.camera,
136735
+ pixelRatio: scene.pixelRatio
136736
+ };
136737
+
136738
+ // for static plots, we reuse the WebGL context
136739
+ // as WebKit doesn't collect them reliably
136740
+ if(scene.staticMode) {
136741
+ if(!STATIC_CONTEXT) {
136742
+ STATIC_CANVAS = document.createElement('canvas');
136743
+ STATIC_CONTEXT = getContext({
136744
+ canvas: STATIC_CANVAS,
136745
+ preserveDrawingBuffer: true,
136746
+ premultipliedAlpha: true,
136747
+ antialias: true
136748
+ });
136749
+ if(!STATIC_CONTEXT) {
136750
+ throw new Error('error creating static canvas/context for image server');
136751
+ }
136752
+ }
136753
+
136754
+ opts.gl = STATIC_CONTEXT;
136755
+ opts.canvas = STATIC_CANVAS;
136756
+ }
136757
+
136758
+ var failed = 0;
136759
+
136760
+ try {
136761
+ scene.glplot = createPlot(opts);
136762
+ } catch(e) {
136763
+ failed++;
136764
+ try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
136765
+ scene.glplot = createPlot(opts);
136766
+ } catch(e) {
136767
+ failed++;
136768
+ }
136769
+ }
136770
+
136771
+ return failed < 2;
136772
+ };
136773
+
136774
+ proto.initializeGLCamera = function() {
136775
+ var scene = this;
136776
+ var cameraData = scene.fullSceneLayout.camera;
136777
+ var isOrtho = (cameraData.projection.type === 'orthographic');
136778
+
136779
+ scene.camera = createCamera(scene.container, {
136780
+ center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],
136781
+ eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],
136782
+ up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],
136783
+ _ortho: isOrtho,
136784
+ zoomMin: 0.01,
136785
+ zoomMax: 100,
136786
+ mode: 'orbit'
136787
+ });
136788
+ };
136789
+
136790
+ proto.initializeGLPlot = function() {
136791
+ var scene = this;
136792
+
136793
+ scene.initializeGLCamera();
136794
+
136795
+ var success = scene.tryCreatePlot();
136796
+ /*
136797
+ * createPlot will throw when webgl is not enabled in the client.
136798
+ * Lets return an instance of the module with all functions noop'd.
136799
+ * The destroy method - which will remove the container from the DOM
136800
+ * is overridden with a function that removes the container only.
136801
+ */
136802
+ if(!success) return showNoWebGlMsg(scene);
136803
+
136804
+ // List of scene objects
136805
+ scene.traces = {};
136806
+
136807
+ scene.make4thDimension();
136808
+
136809
+ var gd = scene.graphDiv;
136810
+ var layout = gd.layout;
136811
+
136812
+ var makeUpdate = function() {
136813
+ var update = {};
136814
+
136815
+ if(scene.isCameraChanged(layout)) {
136816
+ // camera updates
136817
+ update[scene.id + '.camera'] = scene.getCamera();
136818
+ }
136819
+
136820
+ if(scene.isAspectChanged(layout)) {
136821
+ // scene updates
136822
+ update[scene.id + '.aspectratio'] = scene.glplot.getAspectratio();
136823
+ }
136824
+
136825
+ return update;
136826
+ };
136827
+
136828
+ var relayoutCallback = function(scene) {
136829
+ if(scene.fullSceneLayout.dragmode === false) return;
136830
+
136831
+ var update = makeUpdate();
136832
+ scene.saveLayout(layout);
136833
+ scene.graphDiv.emit('plotly_relayout', update);
136834
+ };
136835
+
136836
+ scene.glplot.canvas.addEventListener('mouseup', function() {
136837
+ relayoutCallback(scene);
136838
+ });
136839
+
136840
+ scene.glplot.canvas.addEventListener('wheel', function(e) {
136841
+ if(gd._context._scrollZoom.gl3d) {
136842
+ if(scene.camera._ortho) {
136843
+ var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1;
136844
+ var o = scene.glplot.getAspectratio();
136845
+ scene.glplot.setAspectratio({
136846
+ x: s * o.x,
136847
+ y: s * o.y,
136848
+ z: s * o.z
136849
+ });
136850
+ }
136851
+
136852
+ relayoutCallback(scene);
136853
+ }
136854
+ }, passiveSupported ? {passive: false} : false);
136855
+
136856
+ scene.glplot.canvas.addEventListener('mousemove', function() {
136857
+ if(scene.fullSceneLayout.dragmode === false) return;
136858
+ if(scene.camera.mouseListener.buttons === 0) return;
136859
+
136860
+ var update = makeUpdate();
136861
+ scene.graphDiv.emit('plotly_relayouting', update);
136862
+ });
136863
+
136864
+ if(!scene.staticMode) {
136865
+ scene.glplot.canvas.addEventListener('webglcontextlost', function(event) {
136866
+ if(gd && gd.emit) {
136867
+ gd.emit('plotly_webglcontextlost', {
136868
+ event: event,
136869
+ layer: scene.id
136870
+ });
136871
+ }
136872
+ }, false);
136873
+ }
136874
+
136875
+ scene.glplot.oncontextloss = function() {
136876
+ scene.recoverContext();
136877
+ };
136878
+
136879
+ scene.glplot.onrender = function() {
136880
+ scene.render();
136881
+ };
136882
+
136883
+ return true;
136884
+ };
136885
+
136886
+ proto.render = function() {
136887
+ var scene = this;
136420
136888
  var gd = scene.graphDiv;
136421
136889
  var trace;
136422
136890
 
@@ -136511,7 +136979,7 @@ function render(scene) {
136511
136979
  }
136512
136980
  tx = vectorTx.join('<br>');
136513
136981
  } else if(trace.type === 'isosurface' || trace.type === 'volume') {
136514
- labels.valueLabel = Axes.tickText(scene.mockAxis, scene.mockAxis.d2l(selection.traceCoordinate[3]), 'hover').text;
136982
+ labels.valueLabel = Axes.tickText(scene._mockAxis, scene._mockAxis.d2l(selection.traceCoordinate[3]), 'hover').text;
136515
136983
  vectorTx.push('value: ' + labels.valueLabel);
136516
136984
  if(selection.textLabel) {
136517
136985
  vectorTx.push(selection.textLabel);
@@ -136578,242 +137046,25 @@ function render(scene) {
136578
137046
  }
136579
137047
 
136580
137048
  scene.drawAnnotations(scene);
136581
- }
136582
-
136583
- function tryCreatePlot(scene, cameraObject, pixelRatio, canvas, gl) {
136584
- var glplotOptions = {
136585
- canvas: canvas,
136586
- gl: gl,
136587
- container: scene.container,
136588
- axes: scene.axesOptions,
136589
- spikes: scene.spikeOptions,
136590
- pickRadius: 10,
136591
- snapToData: true,
136592
- autoScale: true,
136593
- autoBounds: false,
136594
- cameraObject: cameraObject,
136595
- pixelRatio: pixelRatio
136596
- };
136597
-
136598
- // for static plots, we reuse the WebGL context
136599
- // as WebKit doesn't collect them reliably
136600
- if(scene.staticMode) {
136601
- if(!STATIC_CONTEXT) {
136602
- STATIC_CANVAS = document.createElement('canvas');
136603
- STATIC_CONTEXT = getContext({
136604
- canvas: STATIC_CANVAS,
136605
- preserveDrawingBuffer: true,
136606
- premultipliedAlpha: true,
136607
- antialias: true
136608
- });
136609
- if(!STATIC_CONTEXT) {
136610
- throw new Error('error creating static canvas/context for image server');
136611
- }
136612
- }
136613
- glplotOptions.pixelRatio = scene.pixelRatio;
136614
- glplotOptions.gl = STATIC_CONTEXT;
136615
- glplotOptions.canvas = STATIC_CANVAS;
136616
- }
136617
-
136618
- var failed = 0;
136619
-
136620
- try {
136621
- scene.glplot = createPlot(glplotOptions);
136622
- } catch(e) {
136623
- failed++;
136624
- try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
136625
- scene.glplot = createPlot(glplotOptions);
136626
- } catch(e) {
136627
- failed++;
136628
- }
136629
- }
136630
-
136631
- return failed < 2;
136632
- }
136633
-
136634
- function initializeGLPlot(scene, canvas, gl) {
136635
- scene.initializeGLCamera();
136636
-
136637
- var success = tryCreatePlot(scene, scene.camera, scene.pixelRatio, canvas, gl);
136638
- /*
136639
- * createPlot will throw when webgl is not enabled in the client.
136640
- * Lets return an instance of the module with all functions noop'd.
136641
- * The destroy method - which will remove the container from the DOM
136642
- * is overridden with a function that removes the container only.
136643
- */
136644
- if(!success) return showNoWebGlMsg(scene);
136645
-
136646
- var gd = scene.graphDiv;
136647
- var layout = gd.layout;
136648
-
136649
- var makeUpdate = function() {
136650
- var update = {};
136651
-
136652
- if(scene.isCameraChanged(layout)) {
136653
- // camera updates
136654
- update[scene.id + '.camera'] = scene.getCamera();
136655
- }
136656
-
136657
- if(scene.isAspectChanged(layout)) {
136658
- // scene updates
136659
- update[scene.id + '.aspectratio'] = scene.glplot.getAspectratio();
136660
- }
136661
-
136662
- return update;
136663
- };
136664
-
136665
- var relayoutCallback = function(scene) {
136666
- if(scene.fullSceneLayout.dragmode === false) return;
136667
-
136668
- var update = makeUpdate();
136669
- scene.saveLayout(layout);
136670
- scene.graphDiv.emit('plotly_relayout', update);
136671
- };
136672
-
136673
- scene.glplot.canvas.addEventListener('mouseup', function() {
136674
- relayoutCallback(scene);
136675
- });
136676
-
136677
- scene.glplot.canvas.addEventListener('wheel', function(e) {
136678
- if(gd._context._scrollZoom.gl3d) {
136679
- if(scene.glplot.camera._ortho) {
136680
- var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1;
136681
- var o = scene.glplot.getAspectratio();
136682
- scene.glplot.setAspectratio({
136683
- x: s * o.x,
136684
- y: s * o.y,
136685
- z: s * o.z
136686
- });
136687
- }
136688
-
136689
- relayoutCallback(scene);
136690
- }
136691
- }, passiveSupported ? {passive: false} : false);
136692
-
136693
- scene.glplot.canvas.addEventListener('mousemove', function() {
136694
- if(scene.fullSceneLayout.dragmode === false) return;
136695
- if(scene.camera.mouseListener.buttons === 0) return;
136696
-
136697
- var update = makeUpdate();
136698
- scene.graphDiv.emit('plotly_relayouting', update);
136699
- });
136700
-
136701
- if(!scene.staticMode) {
136702
- scene.glplot.canvas.addEventListener('webglcontextlost', function(event) {
136703
- if(gd && gd.emit) {
136704
- gd.emit('plotly_webglcontextlost', {
136705
- event: event,
136706
- layer: scene.id
136707
- });
136708
- }
136709
- }, false);
136710
- }
136711
-
136712
- scene.glplot.camera = scene.camera;
136713
-
136714
- scene.glplot.oncontextloss = function() {
136715
- scene.recoverContext();
136716
- };
136717
-
136718
- scene.glplot.onrender = render.bind(null, scene);
136719
-
136720
- // List of scene objects
136721
- scene.traces = {};
136722
-
136723
- scene.make4thDimension();
136724
-
136725
- return true;
136726
- }
136727
-
136728
- function Scene(options, fullLayout) {
136729
- // create sub container for plot
136730
- var sceneContainer = document.createElement('div');
136731
- var plotContainer = options.container;
136732
-
136733
- // keep a ref to the graph div to fire hover+click events
136734
- this.graphDiv = options.graphDiv;
136735
-
136736
- // create SVG container for hover text
136737
- var svgContainer = document.createElementNS(
136738
- 'http://www.w3.org/2000/svg',
136739
- 'svg');
136740
- svgContainer.style.position = 'absolute';
136741
- svgContainer.style.top = svgContainer.style.left = '0px';
136742
- svgContainer.style.width = svgContainer.style.height = '100%';
136743
- svgContainer.style['z-index'] = 20;
136744
- svgContainer.style['pointer-events'] = 'none';
136745
- sceneContainer.appendChild(svgContainer);
136746
- this.svgContainer = svgContainer;
136747
-
136748
- // Tag the container with the sceneID
136749
- sceneContainer.id = options.id;
136750
- sceneContainer.style.position = 'absolute';
136751
- sceneContainer.style.top = sceneContainer.style.left = '0px';
136752
- sceneContainer.style.width = sceneContainer.style.height = '100%';
136753
- plotContainer.appendChild(sceneContainer);
136754
-
136755
- this.fullLayout = fullLayout;
136756
- this.id = options.id || 'scene';
136757
- this.fullSceneLayout = fullLayout[this.id];
136758
-
136759
- // Saved from last call to plot()
136760
- this.plotArgs = [ [], {}, {} ];
136761
-
136762
- /*
136763
- * Move this to calc step? Why does it work here?
136764
- */
136765
- this.axesOptions = createAxesOptions(fullLayout, fullLayout[this.id]);
136766
- this.spikeOptions = createSpikeOptions(fullLayout[this.id]);
136767
- this.container = sceneContainer;
136768
- this.staticMode = !!options.staticPlot;
136769
- this.pixelRatio = this.pixelRatio || options.plotGlPixelRatio || 2;
136770
-
136771
- // Coordinate rescaling
136772
- this.dataScale = [1, 1, 1];
136773
-
136774
- this.contourLevels = [ [], [], [] ];
136775
-
136776
- this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert');
136777
- this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
136778
-
136779
- initializeGLPlot(this);
136780
- }
136781
-
136782
- var proto = Scene.prototype;
136783
-
136784
- proto.initializeGLCamera = function() {
136785
- var cameraData = this.fullSceneLayout.camera;
136786
- var isOrtho = (cameraData.projection.type === 'orthographic');
136787
-
136788
- this.camera = createCamera(this.container, {
136789
- center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],
136790
- eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],
136791
- up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],
136792
- _ortho: isOrtho,
136793
- zoomMin: 0.01,
136794
- zoomMax: 100,
136795
- mode: 'orbit'
136796
- });
136797
137049
  };
136798
137050
 
136799
137051
  proto.recoverContext = function() {
136800
137052
  var scene = this;
136801
- var gl = this.glplot.gl;
136802
- var canvas = this.glplot.canvas;
136803
137053
 
136804
- this.glplot.dispose();
137054
+ scene.glplot.dispose();
136805
137055
 
136806
- function tryRecover() {
136807
- if(gl.isContextLost()) {
137056
+ var tryRecover = function() {
137057
+ if(scene.glplot.gl.isContextLost()) {
136808
137058
  requestAnimationFrame(tryRecover);
136809
137059
  return;
136810
137060
  }
136811
- if(!initializeGLPlot(scene, canvas, gl)) {
137061
+ if(!scene.initializeGLPlot()) {
136812
137062
  Lib.error('Catastrophic and unrecoverable WebGL error. Context lost.');
136813
137063
  return;
136814
137064
  }
136815
137065
  scene.plot.apply(scene, scene.plotArgs);
136816
- }
137066
+ };
137067
+
136817
137068
  requestAnimationFrame(tryRecover);
136818
137069
  };
136819
137070
 
@@ -136881,39 +137132,35 @@ function computeAnnotationBounds(scene, bounds) {
136881
137132
  }
136882
137133
 
136883
137134
  proto.plot = function(sceneData, fullLayout, layout) {
137135
+ var scene = this;
137136
+
136884
137137
  // Save parameters
136885
- this.plotArgs = [sceneData, fullLayout, layout];
137138
+ scene.plotArgs = [sceneData, fullLayout, layout];
136886
137139
 
136887
- if(this.glplot.contextLost) return;
137140
+ if(scene.glplot.contextLost) return;
136888
137141
 
136889
137142
  var data, trace;
136890
137143
  var i, j, axis, axisType;
136891
- var fullSceneLayout = fullLayout[this.id];
136892
- var sceneLayout = layout[this.id];
136893
-
136894
- if(fullSceneLayout.bgcolor) this.glplot.clearColor = str2RGBAarray(fullSceneLayout.bgcolor);
136895
- else this.glplot.clearColor = [0, 0, 0, 0];
136896
-
136897
- this.glplot.snapToData = true;
137144
+ var fullSceneLayout = fullLayout[scene.id];
137145
+ var sceneLayout = layout[scene.id];
136898
137146
 
136899
137147
  // Update layout
136900
- this.fullLayout = fullLayout;
136901
- this.fullSceneLayout = fullSceneLayout;
137148
+ scene.fullLayout = fullLayout;
137149
+ scene.fullSceneLayout = fullSceneLayout;
136902
137150
 
136903
- this.glplotLayout = fullSceneLayout;
136904
- this.axesOptions.merge(fullLayout, fullSceneLayout);
136905
- this.spikeOptions.merge(fullSceneLayout);
137151
+ scene.axesOptions.merge(fullLayout, fullSceneLayout);
137152
+ scene.spikeOptions.merge(fullSceneLayout);
136906
137153
 
136907
137154
  // Update camera and camera mode
136908
- this.setViewport(fullSceneLayout);
136909
- this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);
136910
- this.camera.enableWheel = this.graphDiv._context._scrollZoom.gl3d;
137155
+ scene.setViewport(fullSceneLayout);
137156
+ scene.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);
137157
+ scene.camera.enableWheel = scene.graphDiv._context._scrollZoom.gl3d;
136911
137158
 
136912
- // Update scene
136913
- this.glplot.update({});
137159
+ // Update scene background
137160
+ scene.glplot.setClearColor(str2RGBAarray(fullSceneLayout.bgcolor));
136914
137161
 
136915
137162
  // Update axes functions BEFORE updating traces
136916
- this.setConvert(axis);
137163
+ scene.setConvert(axis);
136917
137164
 
136918
137165
  // Convert scene data
136919
137166
  if(!sceneData) sceneData = [];
@@ -136943,10 +137190,10 @@ proto.plot = function(sceneData, fullLayout, layout) {
136943
137190
  }
136944
137191
 
136945
137192
  // Save scale
136946
- this.dataScale = dataScale;
137193
+ scene.dataScale = dataScale;
136947
137194
 
136948
137195
  // after computeTraceBounds where ax._categories are filled in
136949
- this.convertAnnotations(this);
137196
+ scene.convertAnnotations(this);
136950
137197
 
136951
137198
  // Update traces
136952
137199
  for(i = 0; i < sceneData.length; ++i) {
@@ -136954,24 +137201,24 @@ proto.plot = function(sceneData, fullLayout, layout) {
136954
137201
  if(data.visible !== true || data._length === 0) {
136955
137202
  continue;
136956
137203
  }
136957
- trace = this.traces[data.uid];
137204
+ trace = scene.traces[data.uid];
136958
137205
  if(trace) {
136959
137206
  if(trace.data.type === data.type) {
136960
137207
  trace.update(data);
136961
137208
  } else {
136962
137209
  trace.dispose();
136963
137210
  trace = data._module.plot(this, data);
136964
- this.traces[data.uid] = trace;
137211
+ scene.traces[data.uid] = trace;
136965
137212
  }
136966
137213
  } else {
136967
137214
  trace = data._module.plot(this, data);
136968
- this.traces[data.uid] = trace;
137215
+ scene.traces[data.uid] = trace;
136969
137216
  }
136970
137217
  trace.name = data.name;
136971
137218
  }
136972
137219
 
136973
137220
  // Remove empty traces
136974
- var traceIds = Object.keys(this.traces);
137221
+ var traceIds = Object.keys(scene.traces);
136975
137222
 
136976
137223
  traceIdLoop:
136977
137224
  for(i = 0; i < traceIds.length; ++i) {
@@ -136981,13 +137228,13 @@ proto.plot = function(sceneData, fullLayout, layout) {
136981
137228
  continue traceIdLoop;
136982
137229
  }
136983
137230
  }
136984
- trace = this.traces[traceIds[i]];
137231
+ trace = scene.traces[traceIds[i]];
136985
137232
  trace.dispose();
136986
- delete this.traces[traceIds[i]];
137233
+ delete scene.traces[traceIds[i]];
136987
137234
  }
136988
137235
 
136989
137236
  // order object per trace index
136990
- this.glplot.objects.sort(function(a, b) {
137237
+ scene.glplot.objects.sort(function(a, b) {
136991
137238
  return a._trace.data.index - b._trace.data.index;
136992
137239
  });
136993
137240
 
@@ -137014,8 +137261,8 @@ proto.plot = function(sceneData, fullLayout, layout) {
137014
137261
  sceneBounds[0][i] = Infinity;
137015
137262
  sceneBounds[1][i] = -Infinity;
137016
137263
 
137017
- var objects = this.glplot.objects;
137018
- var annotations = this.fullSceneLayout.annotations || [];
137264
+ var objects = scene.glplot.objects;
137265
+ var annotations = scene.fullSceneLayout.annotations || [];
137019
137266
  var axLetter = axis._name.charAt(0);
137020
137267
 
137021
137268
  for(j = 0; j < objects.length; j++) {
@@ -137073,8 +137320,10 @@ proto.plot = function(sceneData, fullLayout, layout) {
137073
137320
  axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i];
137074
137321
 
137075
137322
  // Update plot bounds
137076
- this.glplot.bounds[0][i] = sceneBounds[0][i] * dataScale[i];
137077
- this.glplot.bounds[1][i] = sceneBounds[1][i] * dataScale[i];
137323
+ scene.glplot.setBounds(i, {
137324
+ min: sceneBounds[0][i] * dataScale[i],
137325
+ max: sceneBounds[1][i] * dataScale[i]
137326
+ });
137078
137327
  }
137079
137328
 
137080
137329
  var axesScaleRatio = [1, 1, 1];
@@ -137129,11 +137378,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
137129
137378
  * Finally assign the computed aspecratio to the glplot module. This will have an effect
137130
137379
  * on the next render cycle.
137131
137380
  */
137132
- this.glplot.setAspectratio(fullSceneLayout.aspectratio);
137381
+ scene.glplot.setAspectratio(fullSceneLayout.aspectratio);
137133
137382
 
137134
137383
  // save 'initial' camera view settings for modebar button
137135
- if(!this.viewInitial.aspectratio) {
137136
- this.viewInitial.aspectratio = {
137384
+ if(!scene.viewInitial.aspectratio) {
137385
+ scene.viewInitial.aspectratio = {
137137
137386
  x: fullSceneLayout.aspectratio.x,
137138
137387
  y: fullSceneLayout.aspectratio.y,
137139
137388
  z: fullSceneLayout.aspectratio.z
@@ -137145,7 +137394,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
137145
137394
  var size = fullLayout._size || null;
137146
137395
 
137147
137396
  if(domain && size) {
137148
- var containerStyle = this.container.style;
137397
+ var containerStyle = scene.container.style;
137149
137398
  containerStyle.position = 'absolute';
137150
137399
  containerStyle.left = (size.l + domain.x[0] * size.w) + 'px';
137151
137400
  containerStyle.top = (size.t + (1 - domain.y[1]) * size.h) + 'px';
@@ -137154,18 +137403,19 @@ proto.plot = function(sceneData, fullLayout, layout) {
137154
137403
  }
137155
137404
 
137156
137405
  // force redraw so that promise is returned when rendering is completed
137157
- this.glplot.redraw();
137406
+ scene.glplot.redraw();
137158
137407
  };
137159
137408
 
137160
137409
  proto.destroy = function() {
137161
- if(!this.glplot) return;
137410
+ var scene = this;
137162
137411
 
137163
- this.camera.mouseListener.enabled = false;
137164
- this.container.removeEventListener('wheel', this.camera.wheelListener);
137165
- this.camera = this.glplot.camera = null;
137166
- this.glplot.dispose();
137167
- this.container.parentNode.removeChild(this.container);
137168
- this.glplot = null;
137412
+ if(!scene.glplot) return;
137413
+ scene.camera.mouseListener.enabled = false;
137414
+ scene.container.removeEventListener('wheel', scene.camera.wheelListener);
137415
+ scene.camera = null;
137416
+ scene.glplot.dispose();
137417
+ scene.container.parentNode.removeChild(scene.container);
137418
+ scene.glplot = null;
137169
137419
  };
137170
137420
 
137171
137421
  // getCameraArrays :: plotly_coords -> gl-plot3d_coords
@@ -137191,42 +137441,34 @@ function getLayoutCamera(camera) {
137191
137441
 
137192
137442
  // get camera position in plotly coords from 'gl-plot3d' coords
137193
137443
  proto.getCamera = function() {
137194
- this.glplot.camera.view.recalcMatrix(this.camera.view.lastT());
137195
- return getLayoutCamera(this.glplot.camera);
137444
+ var scene = this;
137445
+ scene.camera.view.recalcMatrix(scene.camera.view.lastT());
137446
+ return getLayoutCamera(scene.camera);
137196
137447
  };
137197
137448
 
137198
137449
  // set gl-plot3d camera position and scene aspects with a set of plotly coords
137199
137450
  proto.setViewport = function(sceneLayout) {
137451
+ var scene = this;
137200
137452
  var cameraData = sceneLayout.camera;
137201
137453
 
137202
- this.glplot.camera.lookAt.apply(this, getCameraArrays(cameraData));
137203
- this.glplot.setAspectratio(sceneLayout.aspectratio);
137454
+ scene.camera.lookAt.apply(this, getCameraArrays(cameraData));
137455
+ scene.glplot.setAspectratio(sceneLayout.aspectratio);
137204
137456
 
137205
137457
  var newOrtho = (cameraData.projection.type === 'orthographic');
137206
- var oldOrtho = this.glplot.camera._ortho;
137458
+ var oldOrtho = scene.camera._ortho;
137207
137459
 
137208
137460
  if(newOrtho !== oldOrtho) {
137209
- this.glplot.redraw();
137210
-
137211
- var RGBA = this.glplot.clearColor;
137212
- this.glplot.gl.clearColor(
137213
- RGBA[0], RGBA[1], RGBA[2], RGBA[3]
137214
- );
137215
- this.glplot.gl.clear(
137216
- this.glplot.gl.DEPTH_BUFFER_BIT |
137217
- this.glplot.gl.COLOR_BUFFER_BIT
137218
- );
137219
-
137220
- this.glplot.dispose();
137221
-
137222
- initializeGLPlot(this);
137223
- this.glplot.camera._ortho = newOrtho;
137461
+ scene.glplot.redraw(); // TODO: figure out why we need to redraw here?
137462
+ scene.glplot.clearRGBA();
137463
+ scene.glplot.dispose();
137464
+ scene.initializeGLPlot();
137224
137465
  }
137225
137466
  };
137226
137467
 
137227
137468
  proto.isCameraChanged = function(layout) {
137228
- var cameraData = this.getCamera();
137229
- var cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera');
137469
+ var scene = this;
137470
+ var cameraData = scene.getCamera();
137471
+ var cameraNestedProp = Lib.nestedProperty(layout, scene.id + '.camera');
137230
137472
  var cameraDataLastSave = cameraNestedProp.get();
137231
137473
 
137232
137474
  function same(x, y, i, j) {
@@ -137259,8 +137501,9 @@ proto.isCameraChanged = function(layout) {
137259
137501
  };
137260
137502
 
137261
137503
  proto.isAspectChanged = function(layout) {
137262
- var aspectData = this.glplot.getAspectratio();
137263
- var aspectNestedProp = Lib.nestedProperty(layout, this.id + '.aspectratio');
137504
+ var scene = this;
137505
+ var aspectData = scene.glplot.getAspectratio();
137506
+ var aspectNestedProp = Lib.nestedProperty(layout, scene.id + '.aspectratio');
137264
137507
  var aspectDataLastSave = aspectNestedProp.get();
137265
137508
 
137266
137509
  return (
@@ -137273,7 +137516,8 @@ proto.isAspectChanged = function(layout) {
137273
137516
 
137274
137517
  // save camera to user layout (i.e. gd.layout)
137275
137518
  proto.saveLayout = function(layout) {
137276
- var fullLayout = this.fullLayout;
137519
+ var scene = this;
137520
+ var fullLayout = scene.fullLayout;
137277
137521
 
137278
137522
  var cameraData;
137279
137523
  var cameraNestedProp;
@@ -137283,42 +137527,42 @@ proto.saveLayout = function(layout) {
137283
137527
  var aspectNestedProp;
137284
137528
  var aspectDataLastSave;
137285
137529
 
137286
- var cameraChanged = this.isCameraChanged(layout);
137287
- var aspectChanged = this.isAspectChanged(layout);
137530
+ var cameraChanged = scene.isCameraChanged(layout);
137531
+ var aspectChanged = scene.isAspectChanged(layout);
137288
137532
 
137289
137533
  var hasChanged = cameraChanged || aspectChanged;
137290
137534
  if(hasChanged) {
137291
137535
  var preGUI = {};
137292
137536
  if(cameraChanged) {
137293
- cameraData = this.getCamera();
137294
- cameraNestedProp = Lib.nestedProperty(layout, this.id + '.camera');
137537
+ cameraData = scene.getCamera();
137538
+ cameraNestedProp = Lib.nestedProperty(layout, scene.id + '.camera');
137295
137539
  cameraDataLastSave = cameraNestedProp.get();
137296
137540
 
137297
- preGUI[this.id + '.camera'] = cameraDataLastSave;
137541
+ preGUI[scene.id + '.camera'] = cameraDataLastSave;
137298
137542
  }
137299
137543
  if(aspectChanged) {
137300
- aspectData = this.glplot.getAspectratio();
137301
- aspectNestedProp = Lib.nestedProperty(layout, this.id + '.aspectratio');
137544
+ aspectData = scene.glplot.getAspectratio();
137545
+ aspectNestedProp = Lib.nestedProperty(layout, scene.id + '.aspectratio');
137302
137546
  aspectDataLastSave = aspectNestedProp.get();
137303
137547
 
137304
- preGUI[this.id + '.aspectratio'] = aspectDataLastSave;
137548
+ preGUI[scene.id + '.aspectratio'] = aspectDataLastSave;
137305
137549
  }
137306
137550
  Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, preGUI);
137307
137551
 
137308
137552
  if(cameraChanged) {
137309
137553
  cameraNestedProp.set(cameraData);
137310
137554
 
137311
- var cameraFullNP = Lib.nestedProperty(fullLayout, this.id + '.camera');
137555
+ var cameraFullNP = Lib.nestedProperty(fullLayout, scene.id + '.camera');
137312
137556
  cameraFullNP.set(cameraData);
137313
137557
  }
137314
137558
 
137315
137559
  if(aspectChanged) {
137316
137560
  aspectNestedProp.set(aspectData);
137317
137561
 
137318
- var aspectFullNP = Lib.nestedProperty(fullLayout, this.id + '.aspectratio');
137562
+ var aspectFullNP = Lib.nestedProperty(fullLayout, scene.id + '.aspectratio');
137319
137563
  aspectFullNP.set(aspectData);
137320
137564
 
137321
- this.glplot.redraw();
137565
+ scene.glplot.redraw();
137322
137566
  }
137323
137567
  }
137324
137568
 
@@ -137326,7 +137570,8 @@ proto.saveLayout = function(layout) {
137326
137570
  };
137327
137571
 
137328
137572
  proto.updateFx = function(dragmode, hovermode) {
137329
- var camera = this.camera;
137573
+ var scene = this;
137574
+ var camera = scene.camera;
137330
137575
  if(camera) {
137331
137576
  // rotate and orbital are synonymous
137332
137577
  if(dragmode === 'orbit') {
@@ -137340,15 +137585,15 @@ proto.updateFx = function(dragmode, hovermode) {
137340
137585
  // The setter for camera.mode animates the transition to z-up,
137341
137586
  // but only if we *don't* explicitly set z-up earlier via the
137342
137587
  // relayout. So push `up` back to layout & fullLayout manually now.
137343
- var gd = this.graphDiv;
137588
+ var gd = scene.graphDiv;
137344
137589
  var fullLayout = gd._fullLayout;
137345
- var fullCamera = this.fullSceneLayout.camera;
137590
+ var fullCamera = scene.fullSceneLayout.camera;
137346
137591
  var x = fullCamera.up.x;
137347
137592
  var y = fullCamera.up.y;
137348
137593
  var z = fullCamera.up.z;
137349
137594
  // only push `up` back to (full)layout if it's going to change
137350
137595
  if(z / Math.sqrt(x * x + y * y + z * z) < 0.999) {
137351
- var attr = this.id + '.camera.up';
137596
+ var attr = scene.id + '.camera.up';
137352
137597
  var zUp = {x: 0, y: 0, z: 1};
137353
137598
  var edits = {};
137354
137599
  edits[attr] = zUp;
@@ -137364,19 +137609,20 @@ proto.updateFx = function(dragmode, hovermode) {
137364
137609
  }
137365
137610
 
137366
137611
  // to put dragmode and hovermode on the same grounds from relayout
137367
- this.fullSceneLayout.hovermode = hovermode;
137612
+ scene.fullSceneLayout.hovermode = hovermode;
137368
137613
  };
137369
137614
 
137370
137615
  proto.toImage = function(format) {
137371
- if(!format) format = 'png';
137616
+ var scene = this;
137372
137617
 
137373
- if(this.staticMode) this.container.appendChild(STATIC_CANVAS);
137618
+ if(!format) format = 'png';
137619
+ if(scene.staticMode) scene.container.appendChild(STATIC_CANVAS);
137374
137620
 
137375
137621
  // Force redraw
137376
- this.glplot.redraw();
137622
+ scene.glplot.redraw();
137377
137623
 
137378
137624
  // Grab context and yank out pixels
137379
- var gl = this.glplot.gl;
137625
+ var gl = scene.glplot.gl;
137380
137626
  var w = gl.drawingBufferWidth;
137381
137627
  var h = gl.drawingBufferHeight;
137382
137628
 
@@ -137417,36 +137663,37 @@ proto.toImage = function(format) {
137417
137663
  dataURL = canvas.toDataURL('image/png');
137418
137664
  }
137419
137665
 
137420
- if(this.staticMode) this.container.removeChild(STATIC_CANVAS);
137666
+ if(scene.staticMode) scene.container.removeChild(STATIC_CANVAS);
137421
137667
 
137422
137668
  return dataURL;
137423
137669
  };
137424
137670
 
137425
137671
  proto.setConvert = function() {
137672
+ var scene = this;
137426
137673
  for(var i = 0; i < 3; i++) {
137427
- var ax = this.fullSceneLayout[axisProperties[i]];
137428
- Axes.setConvert(ax, this.fullLayout);
137674
+ var ax = scene.fullSceneLayout[axisProperties[i]];
137675
+ Axes.setConvert(ax, scene.fullLayout);
137429
137676
  ax.setScale = Lib.noop;
137430
137677
  }
137431
137678
  };
137432
137679
 
137433
137680
  proto.make4thDimension = function() {
137434
- var _this = this;
137435
- var gd = _this.graphDiv;
137681
+ var scene = this;
137682
+ var gd = scene.graphDiv;
137436
137683
  var fullLayout = gd._fullLayout;
137437
137684
 
137438
137685
  // mock axis for hover formatting
137439
- _this.mockAxis = {
137686
+ scene._mockAxis = {
137440
137687
  type: 'linear',
137441
137688
  showexponent: 'all',
137442
137689
  exponentformat: 'B'
137443
137690
  };
137444
- Axes.setConvert(_this.mockAxis, fullLayout);
137691
+ Axes.setConvert(scene._mockAxis, fullLayout);
137445
137692
  };
137446
137693
 
137447
137694
  module.exports = Scene;
137448
137695
 
137449
- },{"../../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){
137696
+ },{"../../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){
137450
137697
  /**
137451
137698
  * Copyright 2012-2020, Plotly, Inc.
137452
137699
  * All rights reserved.
@@ -137739,7 +137986,7 @@ module.exports = {
137739
137986
  role: 'style',
137740
137987
  dflt: colorAttrs.background,
137741
137988
  editType: 'plot',
137742
- description: 'Sets the color of paper where the graph is drawn.'
137989
+ description: 'Sets the background color of the paper where the graph is drawn.'
137743
137990
  },
137744
137991
  plot_bgcolor: {
137745
137992
  // defined here, but set in cartesian.supplyLayoutDefaults
@@ -137749,7 +137996,7 @@ module.exports = {
137749
137996
  dflt: colorAttrs.background,
137750
137997
  editType: 'layoutstyle',
137751
137998
  description: [
137752
- 'Sets the color of plotting area in-between x and y axes.'
137999
+ 'Sets the background color of the plotting area in-between x and y axes.'
137753
138000
  ].join(' ')
137754
138001
  },
137755
138002
  separators: {
@@ -138803,7 +139050,8 @@ function convertOpts(opts) {
138803
139050
  break;
138804
139051
  case 'raster':
138805
139052
  Lib.extendFlat(paint, {
138806
- 'raster-fade-duration': 0
139053
+ 'raster-fade-duration': 0,
139054
+ 'raster-opacity': opts.opacity
138807
139055
  });
138808
139056
  break;
138809
139057
  }
@@ -141439,10 +141687,13 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
141439
141687
  var subplots = layout._subplots;
141440
141688
  var subplotId = '';
141441
141689
 
141442
- // TODO - currently if we draw an empty gl2d subplot, it draws
141443
- // nothing then gets stuck and you can't get it back without newPlot
141444
- // sort this out in the regl refactor? but for now just drop empty gl2d subplots
141445
- if(basePlotModule.name !== 'gl2d' || visible) {
141690
+ if(
141691
+ visible ||
141692
+ basePlotModule.name !== 'gl2d' // for now just drop empty gl2d subplots
141693
+ // TODO - currently if we draw an empty gl2d subplot, it draws
141694
+ // nothing then gets stuck and you can't get it back without newPlot
141695
+ // sort this out in the regl refactor?
141696
+ ) {
141446
141697
  if(Array.isArray(subplotAttr)) {
141447
141698
  for(i = 0; i < subplotAttr.length; i++) {
141448
141699
  var attri = subplotAttr[i];
@@ -143101,7 +143352,7 @@ plots.doCalcdata = function(gd, traces) {
143101
143352
  calcdata[i] = cd;
143102
143353
  }
143103
143354
 
143104
- setupAxisCategories(axList, fullData);
143355
+ setupAxisCategories(axList, fullData, fullLayout);
143105
143356
 
143106
143357
  // 'transform' loop - must calc container traces first
143107
143358
  // so that if their dependent traces can get transform properly
@@ -143109,7 +143360,7 @@ plots.doCalcdata = function(gd, traces) {
143109
143360
  for(i = 0; i < fullData.length; i++) transformCalci(i);
143110
143361
 
143111
143362
  // clear stuff that should recomputed in 'regular' loop
143112
- if(hasCalcTransform) setupAxisCategories(axList, fullData);
143363
+ if(hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout);
143113
143364
 
143114
143365
  // 'regular' loop - make sure container traces (eg carpet) calc before
143115
143366
  // contained traces (eg contourcarpet)
@@ -143314,13 +143565,31 @@ function sortAxisCategoriesByValue(axList, gd) {
143314
143565
  return affectedTraces;
143315
143566
  }
143316
143567
 
143317
- function setupAxisCategories(axList, fullData) {
143318
- for(var i = 0; i < axList.length; i++) {
143319
- var ax = axList[i];
143568
+ function setupAxisCategories(axList, fullData, fullLayout) {
143569
+ var axLookup = {};
143570
+ var i, ax, axId;
143571
+
143572
+ for(i = 0; i < axList.length; i++) {
143573
+ ax = axList[i];
143574
+ axId = ax._id;
143575
+
143320
143576
  ax.clearCalc();
143321
143577
  if(ax.type === 'multicategory') {
143322
143578
  ax.setupMultiCategory(fullData);
143323
143579
  }
143580
+
143581
+ axLookup[ax._id] = 1;
143582
+ }
143583
+
143584
+ // look into match groups for 'missing' axes
143585
+ var matchGroups = fullLayout._axisMatchGroups || [];
143586
+ for(i = 0; i < matchGroups.length; i++) {
143587
+ for(axId in matchGroups[i]) {
143588
+ if(!axLookup[axId]) {
143589
+ ax = fullLayout[axisIDs.id2name(axId)];
143590
+ ax.clearCalc();
143591
+ }
143592
+ }
143324
143593
  }
143325
143594
  }
143326
143595
 
@@ -152001,7 +152270,12 @@ function hoverOnBars(pointData, xval, yval, hovermode) {
152001
152270
  var s = di[sizeLetter];
152002
152271
 
152003
152272
  if(isWaterfall) {
152004
- s += Math.abs(di.rawS || 0);
152273
+ var rawS = Math.abs(di.rawS) || 0;
152274
+ if(v > 0) {
152275
+ s += rawS;
152276
+ } else if(v < 0) {
152277
+ s -= rawS;
152278
+ }
152005
152279
  }
152006
152280
 
152007
152281
  // add a gradient so hovering near the end of a
@@ -152414,6 +152688,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
152414
152688
  !isNumeric(y0) ||
152415
152689
  !isNumeric(y1)
152416
152690
  );
152691
+
152417
152692
  // display zeros if line.width > 0
152418
152693
  if(isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di) && (isHorizontal ? x1 - x0 === 0 : y1 - y0 === 0)) {
152419
152694
  isBlank = false;
@@ -152423,6 +152698,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
152423
152698
  if(isBlank && isHorizontal) x1 = x0;
152424
152699
  if(isBlank && !isHorizontal) y1 = y0;
152425
152700
 
152701
+ var spansHorizontal = isHorizontal && (x0 !== x1);
152702
+ var spansVertical = !isHorizontal && (y0 !== y1);
152703
+
152426
152704
  // in waterfall mode `between` we need to adjust bar end points to match the connector width
152427
152705
  if(adjustPixel && !isBlank) {
152428
152706
  if(isHorizontal) {
@@ -152477,10 +152755,15 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
152477
152755
 
152478
152756
  var op = Color.opacity(mc);
152479
152757
  var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible;
152480
- x0 = fixpx(x0, x1);
152481
- x1 = fixpx(x1, x0);
152482
- y0 = fixpx(y0, y1);
152483
- y1 = fixpx(y1, y0);
152758
+
152759
+ if(spansHorizontal) {
152760
+ x0 = fixpx(x0, x1);
152761
+ x1 = fixpx(x1, x0);
152762
+ }
152763
+ if(spansVertical) {
152764
+ y0 = fixpx(y0, y1);
152765
+ y1 = fixpx(y1, y0);
152766
+ }
152484
152767
  }
152485
152768
 
152486
152769
  var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback);
@@ -175278,11 +175561,15 @@ proto.handlePick = function(selection) {
175278
175561
  if(selection.object === this.mesh) {
175279
175562
  var selectIndex = selection.index = selection.data.index;
175280
175563
 
175281
- selection.traceCoordinate = [
175282
- this.data.x[selectIndex],
175283
- this.data.y[selectIndex],
175284
- this.data.z[selectIndex]
175285
- ];
175564
+ if(selection.data._cellCenter) {
175565
+ selection.traceCoordinate = selection.data.dataCoordinate;
175566
+ } else {
175567
+ selection.traceCoordinate = [
175568
+ this.data.x[selectIndex],
175569
+ this.data.y[selectIndex],
175570
+ this.data.z[selectIndex]
175571
+ ];
175572
+ }
175286
175573
 
175287
175574
  var text = this.data.hovertext || this.data.text;
175288
175575
  if(Array.isArray(text) && text[selectIndex] !== undefined) {
@@ -182205,12 +182492,13 @@ module.exports = {
182205
182492
  dflt: 'auto',
182206
182493
  editType: 'plot',
182207
182494
  description: [
182208
- 'Determines the orientation of text inside slices.',
182209
- 'With *auto* the texts may automatically be',
182210
- 'rotated to fit with the maximum size inside the slice.',
182211
- 'Using *horizontal* option forces text to be horizontal.',
182212
- 'Using *radial* option forces text to be radial.',
182213
- 'Using *tangential* option forces text to be tangential.'
182495
+ 'Controls the orientation of the text inside chart sectors.',
182496
+ 'When set to *auto*, text may be oriented in any direction in order',
182497
+ 'to be as big as possible in the middle of a sector.',
182498
+ 'The *horizontal* option orients text to be parallel with the bottom',
182499
+ 'of the chart, and may make text smaller in order to achieve that goal.',
182500
+ 'The *radial* option orients text along the radius of the sector.',
182501
+ 'The *tangential* option orients text perpendicular to the radius of the sector.'
182214
182502
  ].join(' ')
182215
182503
  },
182216
182504
  insidetextfont: extendFlat({}, textFontAttrs, {
@@ -205085,6 +205373,8 @@ function plotOne(gd, cd, element, transitionOpts) {
205085
205373
  hasTransition: hasTransition,
205086
205374
  strTransform: strTransform
205087
205375
  });
205376
+ } else {
205377
+ selAncestors.remove();
205088
205378
  }
205089
205379
  }
205090
205380