Skip to content

Commit adbe5c0

Browse files
kaur-mananjeetGT, ShreyaRajeshwari Kiwad
authored
Fix: Script Gen- Sweep Graph Preview Cuts Off End of Graph (#46)
* TSP-947 Script generation infrastructure first cut * TSP-947 Fix multiple channel issue in script * TSP-948 Fix linting issues * TSP-Script-Gen-UI- Linting done (both angular and rust) * TSP-Script-Gen-UI step and sweep points update fixed to show on plot * TSP-Script-Gen All linitng done with standalones * TSP-960-Scrolling input containers to view done * TSP-Scrip-Gen-UI- Scroll into view feature done * Script-Gen-UI- UI changes done (through reviews from UX team) * Revert "Merge branch 'main' into task/TSP-960-style-layout" This reverts commit 12b90fcd4c35917273d40a01e1c5f21dfc5ac79e, reversing changes made to beb512d73be7731c565fec696796c0cd47e5878a. * Reapply "Merge branch 'main' into task/TSP-960-style-layout" This reverts commit 712497e134fc83278e4ec837ff50212ac1f77484. * TSP-960-Scroll-Into-View done with UI changes * TSP-944-resizing and layout of the input containers done * Script-Gen-UI- Fixed the error and bias plot background color * Script-Gen-UI- Sweep color fix * Script-Gen-UI- fixed arrows and step add and remove button * TSP-944- Input panes reflow when shrunk done * Added styles to timing popup * Removed files as per review comment * tsp-1123-Fix start and stop CSS in Step and Sweep Section * Fix start and stop border in step and sweep * tsp-1123-Fix leaking CSS in start and stop * Task/tsp-1201-Correct the spelling of the "Aperture" textbox in the Timing tab * task/tsp-1199-fix-automation name & IDs are missing for the combo box and textboxes in the Timing Tab * fix automation IDs for measure delay and rate * remove duplicate automationID from input-numeric * TSP-1202-add automation Names and automationIDs for Bias * Fix automation names for NPLC and Aperture in Timing * fix issue with automation names in timing and bias (script-gen) * fix: bias plot range for source range AUTO * fix: tsp-1230 and tsp-1231 -The automation name & IDs are missing for the combo box and textboxes in the Step -The automation name & IDs are missing for the combo box and textboxes in the Sweep * fix: Script Gen- Sweep Graph Preview Cuts Off End of Graph * refactor: move repeated code into function generatePlotData() --------- Co-authored-by: GT, Shreya <[email protected]> Co-authored-by: Rajeshwari Kiwad <[email protected]>
1 parent f99deca commit adbe5c0

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

script-gen-ui/src/app/components/main-sweep/plot-container/plot-sweep/plot-sweep.component.ts

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,21 @@ export class PlotSweepComponent
260260
(_, i) => startValue + i * stepSize
261261
).flat();
262262

263-
this.plotData1.y = Array.from(
264-
{ length: this.numSteps },
265-
() => sweepValues
266-
).flat();
267-
268-
this.plotData1.x = Array.from({ length: this.numSteps }, (_, i) =>
269-
Array.from({ length: numberOfPoints }, (_, j) => i + j / numberOfPoints)
270-
).flat();
263+
this.generatePlotData(sweepValues, numberOfPoints);
271264
}
272265
}
273266

267+
private generatePlotData(sweepValues: number[], numberOfPoints: number) {
268+
const numSteps = this.numSteps || 0;
269+
this.plotData1.y = Array.from(
270+
{ length: numSteps },
271+
() => sweepValues
272+
).flat().concat(sweepValues[sweepValues.length - 1]);
273+
274+
this.plotData1.x = Array.from({ length: numSteps }, (_, i) => Array.from({ length: numberOfPoints }, (_, j) => i + j / numberOfPoints)
275+
).flat().concat(numSteps);
276+
}
277+
274278
// the plots are rendered only after the DOM is created, so we need to render them after the DOM is loaded
275279
ngAfterViewInit(): void {
276280
if (this.style?.value == 'LIN' && this.list == false) {
@@ -331,7 +335,7 @@ export class PlotSweepComponent
331335
if (this.style?.value === 'LOG') {
332336
if (this.start && this.stop && this.numSteps && this.numPoints) {
333337
const numberOfPoints = this.numPoints.value;
334-
const numSteps = this.numSteps;
338+
// const numSteps = this.numSteps;
335339
const startValue = this.start.value > 0 ? this.start.value : 1e-12;
336340
const stopValue = this.stop.value > 0 ? this.stop.value : 1e-12;
337341
const stepFactor = Math.pow(
@@ -344,14 +348,7 @@ export class PlotSweepComponent
344348
(_, i) => startValue * Math.pow(stepFactor, i)
345349
);
346350

347-
this.plotData1.y = Array.from(
348-
{ length: numSteps },
349-
() => sweepValues
350-
).flat();
351-
352-
this.plotData1.x = Array.from({ length: numSteps }, (_, i) =>
353-
sweepValues.map((_, j) => i + j / numberOfPoints)
354-
).flat();
351+
this.generatePlotData(sweepValues, numberOfPoints);
355352

356353
console.log('LOG sweep plotData1.x:', this.plotData1.x);
357354
console.log('LOG sweep plotData1.y:', this.plotData1.y);
@@ -367,17 +364,11 @@ export class PlotSweepComponent
367364
// console.log('listSweep: step and sweep', this.listSweep, this.numPoints, this.numSteps);
368365
if (this.listSweep && this.numPoints && this.numSteps) {
369366
const numberOfPoints = this.numPoints.value;
370-
const numSteps = this.numSteps;
367+
// const numSteps = this.numSteps;
371368

372369
const sweepValues = this.listSweep.map((pf) => pf?.value ?? 0);
373-
this.plotData1.y = Array.from(
374-
{ length: numSteps },
375-
() => sweepValues
376-
).flat();
377370

378-
this.plotData1.x = Array.from({ length: numSteps }, (_, i) =>
379-
Array.from({ length: numberOfPoints }, (_, j) => i + j / numberOfPoints)
380-
).flat();
371+
this.generatePlotData(sweepValues, numberOfPoints);
381372

382373
this.plotData1.line.shape = 'hv';
383374
// console.log('List sweep plotData1.x:', this.plotData1.x);

0 commit comments

Comments
 (0)