|
| 1 | +/* eslint-disable no-multi-assign */ |
1 | 2 | /* eslint-disable no-unused-vars, prefer-object-spread, no-mixed-operators, |
2 | 3 | no-unneeded-ternary, arrow-body-style */ |
3 | 4 | import * as d3 from 'd3'; |
@@ -68,6 +69,7 @@ class MultiFocus { |
68 | 69 | this.currentExtent = null; |
69 | 70 | this.primaryExtent = { xExtent: null, yExtent: { yL: null, yU: null } }; |
70 | 71 | this.secondaryExtent = { xExtent: null, yExtent: { yL: null, yU: null } }; |
| 72 | + this.initialSecondaryExtent = { xExtent: null, yExtent: { yL: null, yU: null } }; |
71 | 73 | this.shouldUpdate = {}; |
72 | 74 | // this.freq = false; |
73 | 75 | this.layout = LIST_LAYOUT.CYCLIC_VOLTAMMETRY; |
@@ -275,26 +277,30 @@ class MultiFocus { |
275 | 277 | this.axisCall.x.scale(xt); |
276 | 278 | this.axisCall.y.scale(yt); |
277 | 279 |
|
278 | | - if (sweepExtentSt.newOtherGraphExtents) { |
| 280 | + if (sweepExtentSt.newOtherGraphExtents |
| 281 | + || this.secondaryExtent.yExtent.yU !== this.initialSecondaryExtent.yExtent.yL) { |
| 282 | + const yExtentValues = sweepExtentSt.newOtherGraphExtents |
| 283 | + ? [sweepExtentSt.newOtherGraphExtents.yL, sweepExtentSt.newOtherGraphExtents.yU] |
| 284 | + : [this.initialSecondaryExtent.yExtent.yL, this.initialSecondaryExtent.yExtent.yU]; |
| 285 | + |
279 | 286 | this.secondaryYScale = d3.scaleLinear() |
280 | | - .domain([(sweepExtentSt.newOtherGraphExtents.yL), |
281 | | - (sweepExtentSt.newOtherGraphExtents.yU)]) |
| 287 | + .domain(yExtentValues) |
282 | 288 | .range([this.h, 0]); |
| 289 | + |
283 | 290 | const yAxisSecondary = d3.axisRight(this.secondaryYScale); |
284 | 291 | this.secondaryAxis.y.call(yAxisSecondary); |
285 | | - |
286 | 292 | this.updateSecondaryPathCall(xt, this.secondaryYScale); |
| 293 | + |
287 | 294 | this.secondaryExtent = { |
288 | 295 | xExtent, |
289 | 296 | yExtent: { |
290 | | - yL: sweepExtentSt.newOtherGraphExtents.yL, |
291 | | - yU: sweepExtentSt.newOtherGraphExtents.yU, |
| 297 | + yL: yExtentValues[0], |
| 298 | + yU: yExtentValues[1], |
292 | 299 | }, |
293 | 300 | }; |
294 | 301 | } |
295 | 302 |
|
296 | | - this.currentExtent = { xExtent, yExtent }; |
297 | | - this.primaryExtent = { xExtent, yExtent }; |
| 303 | + this.currentExtent = this.primaryExtent = { xExtent, yExtent }; |
298 | 304 | } |
299 | 305 | } |
300 | 306 |
|
@@ -424,6 +430,7 @@ class MultiFocus { |
424 | 430 | this.secondaryAxisDrawn = true; |
425 | 431 | this.secondaryYScale = secondaryYScale; |
426 | 432 | this.secondaryAxis = secondaryAxes; |
| 433 | + this.initialSecondaryExtent = this.secondaryExtent; |
427 | 434 | } |
428 | 435 | return { |
429 | 436 | secondaryYScale: this.secondaryYScale, |
|
0 commit comments