You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm implementing a real time heatmap that gets > 100k points per minute.
I'm using rectangles to plot each value, using a path builder. For performance issues, I only want to add the last Y (column) of values to the canvas, so I don't have to iterate through a constantly growing array of values. This is working, however the canvas (chart) is getting cleared every iteration, so only the last Y column gets plotted.
I don't want this, I want the previous plotted values to remain. How can I achieve this?
Here is the code:
privatepointPathBuilder(): uPlot.Series.PathBuilder{return(u)=>{constseriesData=u.dataasunknownas[number[],number[],number[]];const[xValues,yValues,aValues]=seriesData;constctx=u.ctx;constxSize=getPixelsPerUnit(u,'x');constySize=getPixelsPerUnit(u,'y');constdataLength=xValues.length;// Plot the last 32 valuesconststart=dataLength-this.channels;constend=start+this.channels;if(dataLength<this.channels){returnnull;}// for (let i = 0; i < 32; i++) {for(leti=start;i<end;i++){constxValue=xValues[i];constyValue=yValues[i]??0;constaValue=aValues[i]??0;constcolor=this.interpolateColor(aValue,this.rainBowPalet);constx=u.valToPos(xValue,'x',true);consty=u.valToPos(yValue,'y',true);if(!isPointInChart(u,x,y,xSize)){continue;}ctx.save();ctx.fillStyle=color;ctx.beginPath();ctx.rect(x,y,xSize,-ySize);ctx.fill();ctx.restore();}returnnull;};}
Thanks!
The text was updated successfully, but these errors were encountered:
first, let's see how far we can get without incremental rendering :)
are you able to share an image (or even streaming screen rec) of the the final result, and maybe attach a representative 100k sanitized dataset?
it sounds like you have 32 "y" cells (channels), so then also 3125 "x" cells rendered to yield 100k total rendered in view? and you're adding 1666 cells per second (32 y rows * 52 x columns)?
I'm implementing a real time heatmap that gets > 100k points per minute.
I'm using rectangles to plot each value, using a path builder. For performance issues, I only want to add the last Y (column) of values to the canvas, so I don't have to iterate through a constantly growing array of values. This is working, however the canvas (chart) is getting cleared every iteration, so only the last Y column gets plotted.
I don't want this, I want the previous plotted values to remain. How can I achieve this?
Here is the code:
Thanks!
The text was updated successfully, but these errors were encountered: