@@ -2592,7 +2592,7 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2592
2592
* - traces {array} trace indices
2593
2593
* - baseframe {string} name of frame from which this frame gets defaults
2594
2594
*
2595
- * @param {array of integers) indices
2595
+ * @param {array of integers } indices
2596
2596
* an array of integer indices matching the respective frames in `frameList`. If not
2597
2597
* provided, an index will be provided in serial order. If already used, the frame
2598
2598
* will be overwritten.
@@ -2601,6 +2601,7 @@ Plotly.addFrames = function(gd, frameList, indices) {
2601
2601
gd = Lib . getGraphDiv ( gd ) ;
2602
2602
2603
2603
var numericNameWarningCount = 0 ;
2604
+ var numericNameWarningCountLimit = 5 ;
2604
2605
2605
2606
if ( frameList === null || frameList === undefined ) {
2606
2607
return Promise . resolve ( ) ;
@@ -2616,7 +2617,7 @@ Plotly.addFrames = function(gd, frameList, indices) {
2616
2617
2617
2618
var i , frame , j , idx ;
2618
2619
var _frames = gd . _transitionData . _frames ;
2619
- var _hash = gd . _transitionData . _frameHash ;
2620
+ var _frameHash = gd . _transitionData . _frameHash ;
2620
2621
2621
2622
2622
2623
if ( ! Array . isArray ( frameList ) ) {
@@ -2634,20 +2635,20 @@ Plotly.addFrames = function(gd, frameList, indices) {
2634
2635
for ( i = frameList . length - 1 ; i >= 0 ; i -- ) {
2635
2636
if ( ! Lib . isPlainObject ( frameList [ i ] ) ) continue ;
2636
2637
2637
- var name = ( _hash [ frameList [ i ] . name ] || { } ) . name ;
2638
+ var name = ( _frameHash [ frameList [ i ] . name ] || { } ) . name ;
2638
2639
var newName = frameList [ i ] . name ;
2639
2640
2640
- if ( name && newName && typeof newName === 'number' && _hash [ name ] ) {
2641
+ if ( name && newName && typeof newName === 'number' && _frameHash [ name ] && numericNameWarningCount < numericNameWarningCountLimit ) {
2641
2642
numericNameWarningCount ++ ;
2642
2643
2643
- Lib . warn ( 'addFrames: overwriting frame "' + _hash [ name ] . name +
2644
+ Lib . warn ( 'addFrames: overwriting frame "' + _frameHash [ name ] . name +
2644
2645
'" with a frame whose name of type "number" also equates to "' +
2645
2646
name + '". This is valid but may potentially lead to unexpected ' +
2646
2647
'behavior since all plotly.js frame names are stored internally ' +
2647
2648
'as strings.' ) ;
2648
2649
2649
- if ( numericNameWarningCount > 5 ) {
2650
- Lib . warn ( 'addFrames: This API call has yielded too many warnings. ' +
2650
+ if ( numericNameWarningCount === numericNameWarningCountLimit ) {
2651
+ Lib . warn ( 'addFrames: This API call has yielded too many of these warnings. ' +
2651
2652
'For the rest of this call, further warnings about numeric frame ' +
2652
2653
'names will be suppressed.' ) ;
2653
2654
}
@@ -2682,10 +2683,10 @@ Plotly.addFrames = function(gd, frameList, indices) {
2682
2683
if ( ! frame . name ) {
2683
2684
// Repeatedly assign a default name, incrementing the counter each time until
2684
2685
// we get a name that's not in the hashed lookup table:
2685
- while ( _hash [ ( frame . name = 'frame ' + gd . _transitionData . _counter ++ ) ] ) ;
2686
+ while ( _frameHash [ ( frame . name = 'frame ' + gd . _transitionData . _counter ++ ) ] ) ;
2686
2687
}
2687
2688
2688
- if ( _hash [ frame . name ] ) {
2689
+ if ( _frameHash [ frame . name ] ) {
2689
2690
// If frame is present, overwrite its definition:
2690
2691
for ( j = 0 ; j < _frames . length ; j ++ ) {
2691
2692
if ( ( _frames [ j ] || { } ) . name === frame . name ) break ;
0 commit comments