MCPcopy Create free account
hub / github.com/curiores/SerialAnalyzer / reformatData

Function reformatData

src/Utils/DataUtils.js:9–18  ·  view source on GitHub ↗
(xvec,yarray,yindex,step)

Source from the content-addressed store, hash-verified

7 from the presentation in Spectrum.js and SerialChart.js
8*/
9export function reformatData(xvec,yarray,yindex,step){
10 // This creates data arrays of the form [{x:100,y:23.44},{x:100,y:23.44},...]
11 // Uses a step size of step (so it can decimate the data)
12 var data = [];
13 for(var k = 0; k < xvec.length; k=k+step){
14 data.push({ x: xvec[k],
15 y: yarray[k][yindex]})
16 }
17 return data;
18}
19
20export function reformatDataVec(xvec,yvec){
21 // This creates data arrays of the form [{x:100,y:23.44},{x:100,y:23.44},...]

Callers 1

updateChartMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected