From af0a1e7f2d785a6f0ef01cb6fd97725bbc27de1f Mon Sep 17 00:00:00 2001 From: fahimkhan Date: Fri, 2 Sep 2016 12:28:33 +0530 Subject: Remove Stacked plot option and make it work for multiple plot in different line --- views/index.html | 76 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/views/index.html b/views/index.html index 748b587..3471303 100644 --- a/views/index.html +++ b/views/index.html @@ -99,10 +99,10 @@ v(in) v(out) @@ -176,7 +176,7 @@ v(in) v(out) alert("Please give the proper name"); } - console.log(textFileAsBlob); + // console.log(textFileAsBlob); // create a link for our script to 'click' var downloadLink = document.createElement("a"); @@ -223,12 +223,9 @@ v(in) v(out) console.log("PlotList---->"+plotList); var keys = Object.keys(outData); - - nonStackPlot(keys,outData); - - + nonStackPlot(keys,outData,plotList); + }); - function destroyClickedElement(event) { @@ -236,7 +233,17 @@ v(in) v(out) document.body.removeChild(event.target); } - function nonStackPlot(keys,outData) + function nonStackPlot(keys,outData,PlotList) + { + traces = getTraces(keys,outData); + + var layout = getLayout(keys,plotList); + + Plotly.newPlot(document.getElementById('graph'), traces, layout); + + } + + function getTraces(keys,outData) { var traceObj = {}; var traces = []; @@ -261,36 +268,37 @@ v(in) v(out) var value = traceObj[traceKey[i]]; traces.push(value); } - + return traces; + } + + function getLayout(keys,PlotList) + { var layout = { - title:'Simulation Output', - yaxis: { - title: "Voltage(Volts) / Current(Amp)", // set the y axis title - titlefont: { - family: 'Courier New, monospace', - size: 15, - color: '#7f7f7f' - } - - }, - xaxis: { - title:"time(Sec) / Frequency(Hz)", - showgrid: true, // remove the x-axis grid lines - titlefont: { - family: 'Courier New, monospace', - size: 15, - color: '#7f7f7f' - } - } + + 'title':'Simulation Output', + yaxis: { + title: "Voltage(Volts) / Current(Amp)", + titlefont: { + family: 'Courier New, monospace', + size: 15, + color: '#7f7f7f' + } + }, + xaxis: { + title:"time(Sec) / Frequency(Hz)", + showgrid: true, // remove the x-axis grid lines + titlefont: { + family: 'Courier New, monospace', + size: 15, + color: '#7f7f7f' + } + } }; - Plotly.newPlot(document.getElementById('graph'), traces, layout); + return layout; } - - - - + -- cgit