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