Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use handleArrayContainerDefaults for various array containers:
rangeselector.buttons updatemenus.buttons parcoords & splom.dimensions (and DRY these a bit)
- Loading branch information
1 parent
86e09bb
commit 3dee25c
Showing
7 changed files
with
134 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* mergeLength: set trace length as the minimum of all dimension data lengths | ||
* and propagates this length into each dimension | ||
* | ||
* @param {object} traceOut: the fullData trace | ||
* @param {Array(object)} dimensions: array of dimension objects | ||
* @param {string} dataAttr: the attribute of each dimension containing the data | ||
* @param {integer} len: an already-existing length from other attributes | ||
*/ | ||
module.exports = function(traceOut, dimensions, dataAttr, len) { | ||
if(!len) len = Infinity; | ||
var i, dimi; | ||
for(i = 0; i < dimensions.length; i++) { | ||
dimi = dimensions[i]; | ||
if(dimi.visible) len = Math.min(len, dimi[dataAttr].length); | ||
} | ||
if(len === Infinity) len = 0; | ||
|
||
traceOut._length = len; | ||
for(i = 0; i < dimensions.length; i++) { | ||
dimi = dimensions[i]; | ||
if(dimi.visible) dimi._length = len; | ||
} | ||
|
||
return len; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.