Skip to content

Commit ca07e89

Browse files
committed
handle typed arrays in pie
1 parent f660105 commit ca07e89

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/traces/pie/defaults.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var handleDomainDefaults = require('../../plots/domain').defaults;
77
var handleText = require('../bar/defaults').handleText;
88

99
function handleLabelsAndValues(labels, values) {
10-
var hasLabels = Array.isArray(labels);
10+
var hasLabels = Lib.isArrayOrTypedArray(labels);
1111
var hasValues = Lib.isArrayOrTypedArray(values);
1212
var len = Math.min(
1313
hasLabels ? labels.length : Infinity,
@@ -72,7 +72,7 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
7272
var textData = coerce('text');
7373
var textTemplate = coerce('texttemplate');
7474
var textInfo;
75-
if(!textTemplate) textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent');
75+
if(!textTemplate) textInfo = coerce('textinfo', Lib.isArrayOrTypedArray(textData) ? 'text+percent' : 'percent');
7676

7777
coerce('hovertext');
7878
coerce('hovertemplate');

src/traces/pie/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ function getMaxPull(trace) {
841841
if(!maxPull) return 0;
842842

843843
var j;
844-
if(Array.isArray(maxPull)) {
844+
if(Lib.isArrayOrTypedArray(maxPull)) {
845845
maxPull = 0;
846846
for(j = 0; j < trace.pull.length; j++) {
847847
if(trace.pull[j] > maxPull) maxPull = trace.pull[j];
@@ -874,7 +874,7 @@ function scootLabels(quadrants, trace) {
874874
if(newExtraY * yDiffSign > 0) thisPt.labelExtraY = newExtraY;
875875

876876
// make sure this label doesn't overlap any slices
877-
if(!Array.isArray(trace.pull)) return; // this can only happen with array pulls
877+
if(!Lib.isArrayOrTypedArray(trace.pull)) return; // this can only happen with array pulls
878878

879879
for(i = 0; i < wholeSide.length; i++) {
880880
otherPt = wholeSide[i];

0 commit comments

Comments
 (0)