plotly.js 2.13.3 → 2.14.0

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js (strict) v2.13.3
2
+ * plotly.js (strict) v2.14.0
3
3
  * Copyright 2012-2022, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -120579,6 +120579,10 @@ function draw(gd) {
120579
120579
  }
120580
120580
  }
120581
120581
 
120582
+ function couldHaveActiveSelection(gd) {
120583
+ return gd._context.editSelection;
120584
+ }
120585
+
120582
120586
  function drawOne(gd, index) {
120583
120587
  // remove the existing selection if there is one.
120584
120588
  // because indices can change, we need to look in all selection layers
@@ -120615,7 +120619,7 @@ function drawOne(gd, index) {
120615
120619
  lineDash = 'solid';
120616
120620
  }
120617
120621
 
120618
- var isActiveSelection =
120622
+ var isActiveSelection = couldHaveActiveSelection(gd) &&
120619
120623
  gd._fullLayout._activeSelectionIndex === index;
120620
120624
 
120621
120625
  if(isActiveSelection) {
@@ -120682,6 +120686,8 @@ function setClipPath(selectionPath, gd, selectionOptions) {
120682
120686
 
120683
120687
 
120684
120688
  function activateSelection(gd, path) {
120689
+ if(!couldHaveActiveSelection(gd)) return;
120690
+
120685
120691
  var element = path.node();
120686
120692
  var id = +element.getAttribute('data-index');
120687
120693
  if(id >= 0) {
@@ -120698,6 +120704,8 @@ function activateSelection(gd, path) {
120698
120704
  }
120699
120705
 
120700
120706
  function activateLastSelection(gd) {
120707
+ if(!couldHaveActiveSelection(gd)) return;
120708
+
120701
120709
  var id = gd._fullLayout.selections.length - 1;
120702
120710
  gd._fullLayout._activeSelectionIndex = id;
120703
120711
  gd._fullLayout._deactivateSelection = deactivateSelection;
@@ -120705,6 +120713,8 @@ function activateLastSelection(gd) {
120705
120713
  }
120706
120714
 
120707
120715
  function deactivateSelection(gd) {
120716
+ if(!couldHaveActiveSelection(gd)) return;
120717
+
120708
120718
  var id = gd._fullLayout._activeSelectionIndex;
120709
120719
  if(id >= 0) {
120710
120720
  clearOutlineControllers(gd);
@@ -163730,6 +163740,11 @@ var configAttributes = {
163730
163740
  }
163731
163741
  },
163732
163742
 
163743
+ editSelection: {
163744
+ valType: 'boolean',
163745
+ dflt: true,
163746
+ },
163747
+
163733
163748
  autosizable: {
163734
163749
  valType: 'boolean',
163735
163750
  dflt: false,
@@ -227438,6 +227453,11 @@ var attrs = module.exports = overrideAll({
227438
227453
  },
227439
227454
 
227440
227455
  link: {
227456
+ arrowlen: {
227457
+ valType: 'number',
227458
+ min: 0,
227459
+ dflt: 0,
227460
+ },
227441
227461
  label: {
227442
227462
  valType: 'data_array',
227443
227463
  dflt: [],
@@ -227898,6 +227918,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
227898
227918
  return Lib.coerce(linkIn, linkOut, attributes.link, attr, dflt);
227899
227919
  }
227900
227920
  coerceLink('label');
227921
+ coerceLink('arrowlen');
227901
227922
  coerceLink('source');
227902
227923
  coerceLink('target');
227903
227924
  coerceLink('value');
@@ -228610,6 +228631,7 @@ function sankeyModel(layout, d, traceIndex) {
228610
228631
  nodeLineWidth: trace.node.line.width,
228611
228632
  linkLineColor: trace.link.line.color,
228612
228633
  linkLineWidth: trace.link.line.width,
228634
+ linkArrowLength: trace.link.arrowlen,
228613
228635
  valueFormat: trace.valueformat,
228614
228636
  valueSuffix: trace.valuesuffix,
228615
228637
  textFont: trace.textfont,
@@ -228648,6 +228670,7 @@ function linkModel(d, l, i) {
228648
228670
  linkPath: linkPath,
228649
228671
  linkLineColor: d.linkLineColor,
228650
228672
  linkLineWidth: d.linkLineWidth,
228673
+ linkArrowLength: d.linkArrowLength,
228651
228674
  valueFormat: d.valueFormat,
228652
228675
  valueSuffix: d.valueSuffix,
228653
228676
  sankey: d.sankey,
@@ -228657,7 +228680,7 @@ function linkModel(d, l, i) {
228657
228680
  };
228658
228681
  }
228659
228682
 
228660
- function createCircularClosedPathString(link) {
228683
+ function createCircularClosedPathString(link, arrowLen) {
228661
228684
  // Using coordinates computed by d3-sankey-circular
228662
228685
  var pathString = '';
228663
228686
  var offset = link.width / 2;
@@ -228667,17 +228690,17 @@ function createCircularClosedPathString(link) {
228667
228690
  pathString =
228668
228691
  // start at the left of the target node
228669
228692
  'M ' +
228670
- coords.targetX + ' ' + (coords.targetY + offset) + ' ' +
228693
+ (coords.targetX - arrowLen) + ' ' + (coords.targetY + offset) + ' ' +
228671
228694
  'L' +
228672
- coords.rightInnerExtent + ' ' + (coords.targetY + offset) +
228695
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.targetY + offset) +
228673
228696
  'A' +
228674
228697
  (coords.rightLargeArcRadius + offset) + ' ' + (coords.rightSmallArcRadius + offset) + ' 0 0 1 ' +
228675
- (coords.rightFullExtent - offset) + ' ' + (coords.targetY - coords.rightSmallArcRadius) +
228698
+ (coords.rightFullExtent - offset - arrowLen) + ' ' + (coords.targetY - coords.rightSmallArcRadius) +
228676
228699
  'L' +
228677
- (coords.rightFullExtent - offset) + ' ' + coords.verticalRightInnerExtent +
228700
+ (coords.rightFullExtent - offset - arrowLen) + ' ' + coords.verticalRightInnerExtent +
228678
228701
  'A' +
228679
228702
  (coords.rightLargeArcRadius + offset) + ' ' + (coords.rightLargeArcRadius + offset) + ' 0 0 1 ' +
228680
- coords.rightInnerExtent + ' ' + (coords.verticalFullExtent - offset) +
228703
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.verticalFullExtent - offset) +
228681
228704
  'L' +
228682
228705
  coords.leftInnerExtent + ' ' + (coords.verticalFullExtent - offset) +
228683
228706
  'A' +
@@ -228705,34 +228728,35 @@ function createCircularClosedPathString(link) {
228705
228728
  (coords.leftLargeArcRadius - offset) + ' ' + (coords.leftLargeArcRadius - offset) + ' 0 0 0 ' +
228706
228729
  coords.leftInnerExtent + ' ' + (coords.verticalFullExtent + offset) +
228707
228730
  'L' +
228708
- coords.rightInnerExtent + ' ' + (coords.verticalFullExtent + offset) +
228731
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.verticalFullExtent + offset) +
228709
228732
  'A' +
228710
228733
  (coords.rightLargeArcRadius - offset) + ' ' + (coords.rightLargeArcRadius - offset) + ' 0 0 0 ' +
228711
- (coords.rightFullExtent + offset) + ' ' + coords.verticalRightInnerExtent +
228734
+ (coords.rightFullExtent + offset - arrowLen) + ' ' + coords.verticalRightInnerExtent +
228712
228735
  'L' +
228713
- (coords.rightFullExtent + offset) + ' ' + (coords.targetY - coords.rightSmallArcRadius) +
228736
+ (coords.rightFullExtent + offset - arrowLen) + ' ' + (coords.targetY - coords.rightSmallArcRadius) +
228714
228737
  'A' +
228715
228738
  (coords.rightLargeArcRadius - offset) + ' ' + (coords.rightSmallArcRadius - offset) + ' 0 0 0 ' +
228716
- coords.rightInnerExtent + ' ' + (coords.targetY - offset) +
228739
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.targetY - offset) +
228717
228740
  'L' +
228718
- coords.targetX + ' ' + (coords.targetY - offset) +
228741
+ (coords.targetX - arrowLen) + ' ' + (coords.targetY - offset) +
228742
+ (arrowLen > 0 ? 'L' + coords.targetX + ' ' + (coords.targetY) : '') +
228719
228743
  'Z';
228720
228744
  } else {
228721
228745
  // Bottom path
228722
228746
  pathString =
228723
228747
  // start at the left of the target node
228724
228748
  'M ' +
228725
- coords.targetX + ' ' + (coords.targetY - offset) + ' ' +
228749
+ (coords.targetX - arrowLen) + ' ' + (coords.targetY - offset) + ' ' +
228726
228750
  'L' +
228727
- coords.rightInnerExtent + ' ' + (coords.targetY - offset) +
228751
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.targetY - offset) +
228728
228752
  'A' +
228729
228753
  (coords.rightLargeArcRadius + offset) + ' ' + (coords.rightSmallArcRadius + offset) + ' 0 0 0 ' +
228730
- (coords.rightFullExtent - offset) + ' ' + (coords.targetY + coords.rightSmallArcRadius) +
228754
+ (coords.rightFullExtent - offset - arrowLen) + ' ' + (coords.targetY + coords.rightSmallArcRadius) +
228731
228755
  'L' +
228732
- (coords.rightFullExtent - offset) + ' ' + coords.verticalRightInnerExtent +
228756
+ (coords.rightFullExtent - offset - arrowLen) + ' ' + coords.verticalRightInnerExtent +
228733
228757
  'A' +
228734
228758
  (coords.rightLargeArcRadius + offset) + ' ' + (coords.rightLargeArcRadius + offset) + ' 0 0 0 ' +
228735
- coords.rightInnerExtent + ' ' + (coords.verticalFullExtent + offset) +
228759
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.verticalFullExtent + offset) +
228736
228760
  'L' +
228737
228761
  coords.leftInnerExtent + ' ' + (coords.verticalFullExtent + offset) +
228738
228762
  'A' +
@@ -228760,17 +228784,18 @@ function createCircularClosedPathString(link) {
228760
228784
  (coords.leftLargeArcRadius - offset) + ' ' + (coords.leftLargeArcRadius - offset) + ' 0 0 1 ' +
228761
228785
  coords.leftInnerExtent + ' ' + (coords.verticalFullExtent - offset) +
228762
228786
  'L' +
228763
- coords.rightInnerExtent + ' ' + (coords.verticalFullExtent - offset) +
228787
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.verticalFullExtent - offset) +
228764
228788
  'A' +
228765
228789
  (coords.rightLargeArcRadius - offset) + ' ' + (coords.rightLargeArcRadius - offset) + ' 0 0 1 ' +
228766
- (coords.rightFullExtent + offset) + ' ' + coords.verticalRightInnerExtent +
228790
+ (coords.rightFullExtent + offset - arrowLen) + ' ' + coords.verticalRightInnerExtent +
228767
228791
  'L' +
228768
- (coords.rightFullExtent + offset) + ' ' + (coords.targetY + coords.rightSmallArcRadius) +
228792
+ (coords.rightFullExtent + offset - arrowLen) + ' ' + (coords.targetY + coords.rightSmallArcRadius) +
228769
228793
  'A' +
228770
228794
  (coords.rightLargeArcRadius - offset) + ' ' + (coords.rightSmallArcRadius - offset) + ' 0 0 1 ' +
228771
- coords.rightInnerExtent + ' ' + (coords.targetY + offset) +
228795
+ (coords.rightInnerExtent - arrowLen) + ' ' + (coords.targetY + offset) +
228772
228796
  'L' +
228773
- coords.targetX + ' ' + (coords.targetY + offset) +
228797
+ (coords.targetX - arrowLen) + ' ' + (coords.targetY + offset) +
228798
+ (arrowLen > 0 ? 'L' + coords.targetX + ' ' + (coords.targetY) : '') +
228774
228799
  'Z';
228775
228800
  }
228776
228801
  return pathString;
@@ -228779,11 +228804,16 @@ function createCircularClosedPathString(link) {
228779
228804
  function linkPath() {
228780
228805
  var curvature = 0.5;
228781
228806
  function path(d) {
228807
+ var arrowLen = d.linkArrowLength;
228782
228808
  if(d.link.circular) {
228783
- return createCircularClosedPathString(d.link);
228809
+ return createCircularClosedPathString(d.link, arrowLen);
228784
228810
  } else {
228811
+ var maxArrowLength = Math.abs((d.link.target.x0 - d.link.source.x1) / 2);
228812
+ if(arrowLen > maxArrowLength) {
228813
+ arrowLen = maxArrowLength;
228814
+ }
228785
228815
  var x0 = d.link.source.x1;
228786
- var x1 = d.link.target.x0;
228816
+ var x1 = d.link.target.x0 - arrowLen;
228787
228817
  var xi = interpolateNumber(x0, x1);
228788
228818
  var x2 = xi(curvature);
228789
228819
  var x3 = xi(1 - curvature);
@@ -228791,15 +228821,17 @@ function linkPath() {
228791
228821
  var y0b = d.link.y0 + d.link.width / 2;
228792
228822
  var y1a = d.link.y1 - d.link.width / 2;
228793
228823
  var y1b = d.link.y1 + d.link.width / 2;
228794
- return 'M' + x0 + ',' + y0a +
228795
- 'C' + x2 + ',' + y0a +
228796
- ' ' + x3 + ',' + y1a +
228797
- ' ' + x1 + ',' + y1a +
228798
- 'L' + x1 + ',' + y1b +
228799
- 'C' + x3 + ',' + y1b +
228800
- ' ' + x2 + ',' + y0b +
228801
- ' ' + x0 + ',' + y0b +
228802
- 'Z';
228824
+ var start = 'M' + x0 + ',' + y0a;
228825
+ var upperCurve = 'C' + x2 + ',' + y0a +
228826
+ ' ' + x3 + ',' + y1a +
228827
+ ' ' + x1 + ',' + y1a;
228828
+ var lowerCurve = 'C' + x3 + ',' + y1b +
228829
+ ' ' + x2 + ',' + y0b +
228830
+ ' ' + x0 + ',' + y0b;
228831
+
228832
+ var rightEnd = arrowLen > 0 ? 'L' + (x1 + arrowLen) + ',' + (y1a + d.link.width / 2) : '';
228833
+ rightEnd += 'L' + x1 + ',' + y1b;
228834
+ return start + upperCurve + rightEnd + lowerCurve + 'Z';
228803
228835
  }
228804
228836
  }
228805
228837
  return path;
@@ -249355,7 +249387,7 @@ function getSortFunc(opts, d2c) {
249355
249387
  'use strict';
249356
249388
 
249357
249389
  // package version injected by `npm run preprocess`
249358
- exports.version = '2.13.3';
249390
+ exports.version = '2.14.0';
249359
249391
 
249360
249392
  },{}],1151:[function(_dereq_,module,exports){
249361
249393
  (function (global){(function (){