@@ -47,19 +47,6 @@ export default class TimeDomainPlot {
4747 zeros ,
4848 poles
4949 ) {
50- this . #plotContainerDomElement = plotContainerDomElement ;
51- //create the two plot DOM elements inside the container
52- const markup = `
53- <div class="time-domain-subplot" id="time-response-plot"></div>
54- <div class="time-domain-subplot" id="trajectory-plot"></div>
55- ` ;
56- plotContainerDomElement . insertAdjacentHTML ( "afterbegin" , markup ) ;
57-
58- this . #timeResponsePlotDomElement = plotContainerDomElement . querySelector (
59- "#time-response-plot"
60- ) ;
61- this . #trajectoryPlotDomElement =
62- plotContainerDomElement . querySelector ( "#trajectory-plot" ) ;
6350 this . #numeratorTermsArray = numeratorTermsArray ;
6451 this . #denominatorTermsArray = denominatorTermsArray ;
6552 this . #zeros = zeros ;
@@ -72,9 +59,31 @@ export default class TimeDomainPlot {
7259 ) ;
7360 }
7461
75- this . createTimeDomainPlot ( ) ;
62+ if ( ! plotContainerDomElement || ! functionPlot ) {
63+ // return time domain curve points without displaying the plots (ex. for testing)
64+ return {
65+ timeResponseCurvePoints : this . #timeResponseCurvePoints,
66+ trajectoryCurvePoints : this . #trajectoryCurvePoints,
67+ } ;
68+ } else {
69+ this . #plotContainerDomElement = plotContainerDomElement ;
70+ //create the two plot DOM elements inside the container
71+ const markup = `
72+ <div class="time-domain-subplot" id="time-response-plot"></div>
73+ <div class="time-domain-subplot" id="trajectory-plot"></div>
74+ ` ;
75+ plotContainerDomElement . insertAdjacentHTML ( "afterbegin" , markup ) ;
76+
77+ this . #timeResponsePlotDomElement = plotContainerDomElement . querySelector (
78+ "#time-response-plot"
79+ ) ;
80+ this . #trajectoryPlotDomElement =
81+ plotContainerDomElement . querySelector ( "#trajectory-plot" ) ;
82+
83+ this . createTimeDomainPlot ( ) ;
7684
77- return this . #timeDomainObserver;
85+ return this . #timeDomainObserver;
86+ }
7887 }
7988
8089 /**
0 commit comments