File tree Expand file tree Collapse file tree
src/component/plotly-graph Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,14 +152,23 @@ function findMaxArrayLength (cont) {
152152}
153153
154154function estimateDataLength ( trace ) {
155+ const topLevel = findMaxArrayLength ( trace )
156+ let dimLevel = 0
157+ let cellLevel = 0
158+
155159 // special case for e.g. parcoords and splom traces
156160 if ( Array . isArray ( trace . dimensions ) ) {
157- return trace . dimensions
161+ dimLevel = trace . dimensions
158162 . map ( findMaxArrayLength )
159163 . reduce ( ( a , v ) => a + v )
160164 }
161165
162- return findMaxArrayLength ( trace )
166+ // special case for e.g. table traces
167+ if ( isPlainObj ( trace . cells ) ) {
168+ cellLevel = findMaxArrayLength ( trace . cells )
169+ }
170+
171+ return Math . max ( topLevel , dimLevel , cellLevel )
163172}
164173
165174function maxPtsPerTrace ( trace ) {
@@ -169,6 +178,7 @@ function maxPtsPerTrace (trace) {
169178 case 'scattergl' :
170179 case 'splom' :
171180 case 'pointcloud' :
181+ case 'table' :
172182 return 1e7
173183
174184 case 'scatterpolargl' :
Original file line number Diff line number Diff line change @@ -395,6 +395,25 @@ tap.test('parse:', t => {
395395 } )
396396 } )
397397
398+ t . test ( 'failing table case' , t => {
399+ fn ( {
400+ data : [ {
401+ type : 'table' ,
402+ cells : {
403+ values : [
404+ new Array ( 5e6 ) ,
405+ new Array ( 5e6 ) ,
406+ new Array ( 5e6 )
407+ ]
408+ }
409+ } ]
410+ } , { safeMode : true } , ( errorCode , result ) => {
411+ t . equal ( errorCode , 400 , 'code' )
412+ t . type ( result . msg , 'string' , 'msg type' )
413+ t . end ( )
414+ } )
415+ } )
416+
398417 t . test ( 'failing case from too many traces' , t => {
399418 var data = new Array ( 3e3 )
400419
You can’t perform that action at this time.
0 commit comments