diff --git a/src/component/plotly-graph/parse.js b/src/component/plotly-graph/parse.js index a91f1eca..3155df5d 100644 --- a/src/component/plotly-graph/parse.js +++ b/src/component/plotly-graph/parse.js @@ -152,14 +152,23 @@ function findMaxArrayLength (cont) { } function estimateDataLength (trace) { + const topLevel = findMaxArrayLength(trace) + let dimLevel = 0 + let cellLevel = 0 + // special case for e.g. parcoords and splom traces if (Array.isArray(trace.dimensions)) { - return trace.dimensions + dimLevel = trace.dimensions .map(findMaxArrayLength) .reduce((a, v) => a + v) } - return findMaxArrayLength(trace) + // special case for e.g. table traces + if (isPlainObj(trace.cells)) { + cellLevel = findMaxArrayLength(trace.cells) + } + + return Math.max(topLevel, dimLevel, cellLevel) } function maxPtsPerTrace (trace) { @@ -169,6 +178,7 @@ function maxPtsPerTrace (trace) { case 'scattergl': case 'splom': case 'pointcloud': + case 'table': return 1e7 case 'scatterpolargl': diff --git a/test/unit/plotly-graph_test.js b/test/unit/plotly-graph_test.js index 16c66712..777515fa 100644 --- a/test/unit/plotly-graph_test.js +++ b/test/unit/plotly-graph_test.js @@ -395,6 +395,25 @@ tap.test('parse:', t => { }) }) + t.test('failing table case', t => { + fn({ + data: [{ + type: 'table', + cells: { + values: [ + new Array(5e6), + new Array(5e6), + new Array(5e6) + ] + } + }] + }, {safeMode: true}, (errorCode, result) => { + t.equal(errorCode, 400, 'code') + t.type(result.msg, 'string', 'msg type') + t.end() + }) + }) + t.test('failing case from too many traces', t => { var data = new Array(3e3)