Skip to content

Commit 12fb4ce

Browse files
committed
single update
1 parent 951949e commit 12fb4ce

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
"node_modules": true,
1717
"package-lock.json": true,
1818
"yarn.lock": true,
19-
"**/lib*":true
19+
"**/lib*":true,
20+
"LICENSE":true,
21+
"gulpFile.js":true,
22+
"**/*.min.*":true,
23+
"**/*.woff2":true
24+
2025
}
2126
}

src/js/functions.js

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ const slider = document.getElementById('range')
1515
const thumb = document.getElementById('thumb')
1616
const figurecontainer = document.getElementById("figurecontainer")
1717

18+
// array of JSONs => {data, fName, sName, }
19+
var dataList=[];
20+
// array of JSONs => {dataIndex, col:{x,y,z,s}, lName}
21+
var traceList=[];
1822

1923
var fullData = [], fullDataCols = [], fileNames = [], saveNames = [], legendNames = [],
2024
data = [], dpsx = [], dpsy = [], index = [], saved = true, firstSave = true,
2125
col = {x: 0, y: 0, z: 0,s: 0}, currentEditable = 0, xName = "X";
22-
lockXc = 1, swapped = 0, issame = false, swapper = false, ddd = false,
26+
lockXc = 1, swapped = 0, issame = false, swapper = false, ddd = false, oldDpsLen=0,
2327
th_in = 0, undoStack = [], redoStack = [], isAxesLocked=false;
2428

2529

@@ -267,6 +271,7 @@ function addTrace(){
267271
var cRange=false,cRangeY=[NaN, NaN]; //hidden feature
268272
function setCutRange(){
269273
if(!cRange) return
274+
// should also include other traces if they are currently plotted
270275
let a=Math.min(...dpsy), b=Math.max(...dpsy);
271276
let [aY,bY] = cRangeY;
272277
a = isNaN(aY)? a: Math.max(aY,a)
@@ -312,7 +317,6 @@ function updatePlot(all = true) {
312317

313318

314319

315-
var oldDpsLen=0
316320
function sliderChanged(shift=0){
317321
if((shift==-1 && th_in==0) || (shift==+1 && th_in==data.length-1)) return
318322
th_in +=shift
@@ -420,23 +424,26 @@ function keyBoardDrag(moveDown) {
420424

421425

422426
var exportAll = false
427+
var timer;
423428
function updateOnServer() {
424429
if (!viewerWindow) return;
425-
if(!exportAll) {
426-
var s_data = [[
427-
data.map(i=>i[swapped? col.y: col.x]),
428-
data.map(i=>i[swapped? col.x: col.y]),
429-
data.map(i=>i[col.z])
430-
]]
431-
} else{
432-
var s_data = fullData.map((el,j)=>[
433-
el.map(i=>i[swapped? fullDataCols[j].y: fullDataCols[j].x]),
434-
el.map(i=>i[swapped? fullDataCols[j].x: fullDataCols[j].y]),
435-
el.map(i=>i[fullDataCols[j].z])
436-
])
437-
}
438-
439-
viewerWindow.webContents.send("sdata", [s_data, swapped, col.z, data[0].length]);
430+
clearTimeout(timer);
431+
timer = setTimeout(()=>{ //send updated value only once within .5 sec
432+
if(!exportAll) {
433+
var s_data = [[
434+
data.map(i=>i[swapped? col.y: col.x]),
435+
data.map(i=>i[swapped? col.x: col.y]),
436+
data.map(i=>i[col.z])
437+
]]
438+
} else{
439+
var s_data = fullData.map((el,j)=>[
440+
el.map(i=>i[swapped? fullDataCols[j].y: fullDataCols[j].x]),
441+
el.map(i=>i[swapped? fullDataCols[j].x: fullDataCols[j].y]),
442+
el.map(i=>i[fullDataCols[j].z])
443+
])
444+
}
445+
viewerWindow.webContents.send("sdata", [s_data, swapped, col.z, data[0].length]);
446+
},500)
440447
}
441448

442449

src/js/keyIpcTrigger.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ $('#filler').width($('#container').parent().width())
285285

286286
figurecontainer.on("plotly_selected", (ev)=>{
287287
if (ev != undefined) {
288+
// console.log(ev)
288289
index = [];
289290
for (let pt of ev.points) {
290291
if(pt.curveNumber == currentEditable) index.push(pt.pointIndex);

0 commit comments

Comments
 (0)