var colors = ['red','orange','yellow','olive','green','teal','blue','violet','purple','pink','brown','grey','black'];
var recentcolor=0;
var mydata = {};
var startTime = new Date();
var activePlot=null;
var myplots = {}
var options = {}
var plotdatastack = {};
var clearPlot = function(){
plotdatastack = {};
resultplots.empty();
myplots = {};
options = {};
}
function createPlots(latestCode){
mydata = {}; startTime = new Date();
if(latestCode.indexOf('plot_radar(')>=0)
addPolarPlot();
}
var polarPositions = [];
var addPolarPlot = function(){
polarPositions = [];
resultplots.append(`
`);
plt = document.querySelector('.polar.circle');
for(var i=0;i<361;i++){
dot = document.createElementNS("http://www.w3.org/2000/svg", "circle");
dot.setAttribute('cx',100);
dot.setAttribute('cy',100);
dot.setAttribute('r',2);
dot.setAttribute('stroke','lightgreen');
dot.setAttribute('fill','green');
polarPositions.push(dot);
plt.appendChild(dot);
}
}
var makePlotIfUnavailable = function(plotname){
if(!(plotname in myplots)){
mydata[plotname] = [];
var w = resultplots.width()<300?300:resultplots.width();
var h = resultplots.height()<300 ? 300:resultplots.height();
if(h>400)h=400;
startTime = new Date();
resultplots.append($(''+plotname+''));
resultplots.append($('