Black Lives Matter. Please consider donating to Black Girls Code today.

Too many trace make ram overflow.What can i to do

This picture is thirty number of trace.
I have learned to make some plot, referring to Basic Ribbon Plot documentation.
I took a some barrier that too many trace in the Ribbon Plot is ram overflow.

i want to make traces, that is 1024 pieces.
But i met Memory overflow issue.
My cumputer’s ram is 8GB.

Is there nothing we can do ?

$.ajax({
url : ‘bytea.do’,
type : ‘post’,
dataType : ‘json’,
data : ‘command=getDataVer2&&datanum=’+datanum,
success : function(data1) {
if(data1.x_data.length==0 || data1.y_data.length==0 || data1.y_data.length==0){
clearInterval(interval);
}
var x = new Array();
var y = new Array();
var z = new Array();
var datanum = 6;
var x_oesData = data1.x_data;
var y_oesData = data1.y_data;
var z_oesData = data1.z_data;
currentTime = data1.currentTime.substring(0,16);
for(var i=0;i<1024;i++){
var x_temp = Array();
var y_temp = Array();
var z_temp = Array();
for(var j=i;j<datanum*1024;j+=1024){
x_temp.push( new Array( (y_oesData[j]-0.05),(y_oesData[j]+0.05) ) );
y_temp.push( new Array( (x_oesData[j]),(x_oesData[j]) ) );
z_temp.push( new Array( z_oesData[j],z_oesData[j] ) );
}
x.push(x_temp);
y.push(y_temp);
z.push(z_temp);
}
chartdata=[];
for(var i=0;i<1024;i++){
var trace1 = {
x:x[i], y:y[i], z:z[i],
name: ‘’,
colorscale: colorScaleArr[i%3],
type: ‘surface’,
showscale: false
};
chartdata.push(trace1);
}
data = chartdata,
layout = {
scene: {
xaxis:{title: ‘wavelength(nm)’},
yaxis:{title: ‘second(s)’},
zaxis:{title: ‘intensity’},
},
title: ‘OES’,
hovermode: ‘x’,
showlegend: false,
autosize: true,
height: 800,
margin: {
l: 65,
r: 50,
b: 65,
t: 90,
}
};

		if(isPlot){
			gd.data=chartdata;
			Plotly.redraw(gd);
		}else{
			var d3 = Plotly.d3;

			var WIDTH_IN_PERCENT_OF_PARENT = 50,
			    HEIGHT_IN_PERCENT_OF_PARENT = 80;

			var gd3 = d3.select("div[id='ThreeD_chart']")
			    //.append('div')
			    .style({
			        width: WIDTH_IN_PERCENT_OF_PARENT + '%',
			        height: HEIGHT_IN_PERCENT_OF_PARENT + 'vh',
			    });

			gd = gd3.node();
			Plotly.newPlot(gd,chartdata,layout);
		}
	},
	error: function(){
		alert('fail');
	}
});

Try combining traces into several segments.

[{
  x: [1, 2, 3],
  y: [1, 2, 1]
}, {
  x: [4, 5, 6],
  y: [1, 2, 1]
}]

is essentially equivalent to:

[{
  x: [1, 2, 3, null, 4, 5, 6],
  y: [1, 2, 1, null, 1, 2, 1]
}]
1 Like

that’s it! Brilliant ! Thank you .