diff options
-rw-r--r-- | routes/routes.js | 7 | ||||
-rw-r--r-- | views/index.html | 48 |
2 files changed, 28 insertions, 27 deletions
diff --git a/routes/routes.js b/routes/routes.js index cd00754..04fb6cc 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -24,7 +24,7 @@ module.exports = function(express,app,fs,os,io,PythonShell,scriptPath){ //Plotting List plotList = data['plotList']; - console.log("PlotList----------->"+plotList); + // console.log("PlotList----------->"+plotList); plotOption = plotList.join(" "); //Space is required between two plot @@ -116,6 +116,7 @@ module.exports = function(express,app,fs,os,io,PythonShell,scriptPath){ function parsePlotData(){ console.log("Ngspice netlist executed successfully "+fileName); + console.log("PlotList----------->"+plotList); //socket.emit('serverMessage','Ngspice netlist executed successfully: '); //var analysisInfo = grep('.tran|.dc|.ac', fileName); //Not reliable var analysisInfo = getAnalysisInfo(fileName); @@ -132,10 +133,10 @@ module.exports = function(express,app,fs,os,io,PythonShell,scriptPath){ if (err) throw err; // results is an array consisting of messages collected during execution // console.log('results: %j', results); - var resultString = results[0]; + var outData = results[0]; //Emitting Data Points to client - socket.emit('plotData',resultString); + socket.emit('plotData',{"outData":outData,"plotList":plotList}); }); } diff --git a/views/index.html b/views/index.html index 1d45ab1..748b587 100644 --- a/views/index.html +++ b/views/index.html @@ -81,10 +81,7 @@ v1 in gnd pwl(0m 0 0.5m 5 50m 5 50.5m 0 100m 0) <h3>Plots:</h3>
<textarea class="form-control" id="plotOption" rows="3">
v(in) v(out)
-
- </textarea>
-
-
+ </textarea>
</div>
</form>
<div class="buttonArea">
@@ -221,12 +218,28 @@ v(in) v(out) });
socket.on("plotData",function(data){
- var keys = Object.keys(data);
- var traceObj = {};
- var traces = [];
+ var outData = data['outData'];
+ plotList = data['plotList'];
+ console.log("PlotList---->"+plotList);
+ var keys = Object.keys(outData);
+
+
+ nonStackPlot(keys,outData);
+
- console.log(Object.keys(data));
+ });
+
+
+ function destroyClickedElement(event)
+ {
+ // remove the link from the DOM
+ document.body.removeChild(event.target);
+ }
+ function nonStackPlot(keys,outData)
+ {
+ var traceObj = {};
+ var traces = [];
//Dynamically creating traces
for(var i=0; i<keys.length; i++){
if(keys[i]=='x-axis'){
@@ -234,8 +247,8 @@ v(in) v(out) }
else{
var trace = {
- x: data['x-axis'],
- y: data[keys[i]],
+ x: outData['x-axis'],
+ y: outData[keys[i]],
name:keys[i],
type: 'scatter'
};
@@ -244,15 +257,10 @@ v(in) v(out) }
var traceKey = Object.keys(traceObj);
-
for (var i=0;i<traceKey.length;i++) {
var value = traceObj[traceKey[i]];
traces.push(value);
}
- console.log("traces :"+traces);
-
-
- var dataForPlotly = traces;
var layout = {
title:'Simulation Output',
@@ -276,17 +284,9 @@ v(in) v(out) }
};
- Plotly.newPlot(document.getElementById('graph'), dataForPlotly, layout);
+ Plotly.newPlot(document.getElementById('graph'), traces, layout);
- });
-
-
- function destroyClickedElement(event)
- {
- // remove the link from the DOM
- document.body.removeChild(event.target);
}
-
|